FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Firestore: Remove copies in FieldValueInternal to reduce global refs consumption. by dconeybe · Pull Request #1111 · firebase/firebase-cpp-sdk · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .cc  (1) .h  (1) .md  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions firestore/src/android/field_value_android.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ FieldValueInternal::FieldValueInternal(GeoPoint value)
object_ = GeoPointInternal::Create(env, value);
}

FieldValueInternal::FieldValueInternal(std::vector<FieldValue> value)
FieldValueInternal::FieldValueInternal(const std::vector<FieldValue>& value)
: cached_type_(Type::kArray) {
Env env = GetEnv();
Local<ArrayList> list = ArrayList::Create(env, value.size());
Expand All @@ -167,7 +167,7 @@ FieldValueInternal::FieldValueInternal(std::vector<FieldValue> value)
object_ = list;
}

FieldValueInternal::FieldValueInternal(MapFieldValue value)
FieldValueInternal::FieldValueInternal(const MapFieldValue& value)
: cached_type_(Type::kMap) {
Env env = GetEnv();
Local<HashMap> map = HashMap::Create(env);
Expand Down
10 changes: 8 additions & 2 deletions firestore/src/android/field_value_android.h
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,14 @@ class FieldValueInternal {
FieldValueInternal(const uint8_t* value, size_t size);
explicit FieldValueInternal(DocumentReference value);
explicit FieldValueInternal(GeoPoint value);
explicit FieldValueInternal(std::vector<FieldValue> value);
explicit FieldValueInternal(MapFieldValue value);
// Deviate from the iOS signatures of the following two constructors. The iOS
// versions take values into which the caller moves, to elide a copy. In
// Android, this actually *costs* an extra copy when calling from
// `DocumentReferenceInternal::Set()`, doubling the number of global
// references needed. Using const references in Android avoids this extra,
// costly copy (https://github.com/firebase/quickstart-unity/issues/1303).
explicit FieldValueInternal(const std::vector<FieldValue>& value);
explicit FieldValueInternal(const MapFieldValue& value);

Type type() const;

Expand Down
6 changes: 6 additions & 0 deletions release_build_files/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,12 @@ workflow use only during the development of your app, not for publicly shipping
code.

## Release Notes
### Upcoming
- Changes
- Firestore (Android): Reduce the number of JNI global references consumed
when creating or updating documents
([#1111](https://github.com/firebase/firebase-cpp-sdk/pull/1111)).

### 10.0.0
- Changes
- General (Android): Update to Firebase Android BoM version 31.0.0.
Expand Down

Back | FazBrowse Home | New Git URL