Skip to content

Commit 6a59781

Browse files
authored
Use C++'s smart pointers std::unique_ptr and std::shared_ptr instead of our own. (#1365)
* Remove headers from CMake file. * Find-and-replace change. * Format code. * Find and replace for std::atomic. * Format code. * Update to Dec 2022 release of boringssl. In this release, the "src" directory is removed from boringssl, so there are some CMake and patch changes necessary for compatibility. * Re-add patch file. * Switch to std::make_unique. * Fix make_shared, std::move, and class initialization. * WIP. * Fix more move syntax. * Fix more std::move issues. Revert Firestore. * Remove debug output * Fix Android Firestore test, and Storage assignment. * Make the callback safer via shared_ptr. * Fix lint errors. * Format code. * More lint fixes. * More lint. * Additional lint warning fixes. * Fix Firestore test. * Fix more lints. * Lint lint lint. * Change RequestDataPtr to a unique_ptr since STLPort is no longer used. * Remove Move() and Forward(), replacing with std::move() and std::foward<>(). * Format code and lint fixes. * Change firebase::Move explicitly to std::move. * Remove lint warnings for headers. * More lint warnings on includes. * Format code. * Return back to shared pointer. * Add note about NewCallback and link to TODO. * Fix lint error. * Fix a lingering firebase::Move. * Fix optional_test to mock Move correctly again. * Revert prereqs script, python3 change will be made elsewhere. * Lint. * Remove references to atomic_test. * Fix Move -> std::move once more * Fix a seg fault race condition on Linux by using a unique_ptr. This code always wanted to use a unique_ptr, but was previously using a SharedPtr because of STLPort. However, even without STLPort, there is still an issue switching it to a unique_ptr, which is that std::priority_queue is misdesigned and does not return a mutable reference in C++14. Because of this, if we want to std::move from a priority queue, we need to do a const cast. * Empty commit. * Fix test error. * Fix test compilation error. * Fix additional test build error. * Vector initializer lists use copy semantics. Switch to push_back since these are just tests. * Fix Forward --> std::forward from the merged Firestore change. * Add callback tests for shared_ptr wrapping a unique_ptr.
1 parent 2506fd9 commit 6a59781

File tree

167 files changed

+867
-1877
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+867
-1877
lines changed

app/CMakeLists.txt

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ set(FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS
5959
"--no-union-value-namespacing"
6060
"--gen-generated"
6161
"--gen-object-api"
62-
"--cpp-ptr-type" "flatbuffers::unique_ptr")
62+
"--cpp-ptr-type" "std::unique_ptr")
6363
# Because of a bug in the version of Flatbuffers we are pinned to,
6464
# additional flags need to be set.
6565
set(FLATC_ARGS "${FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS}")
@@ -180,7 +180,7 @@ set(FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS
180180
"--no-union-value-namespacing"
181181
"--gen-generated"
182182
"--gen-object-api"
183-
"--cpp-ptr-type" "flatbuffers::unique_ptr")
183+
"--cpp-ptr-type" "std::unique_ptr")
184184
# Because of a bug in the version of Flatbuffers we are pinned to,
185185
# additional flags need to be set.
186186
# also see if app_generated_includes will conflict
@@ -351,10 +351,6 @@ add_library(firebase_app STATIC
351351
${utility_HDRS}
352352
${app_platform_HDRS}
353353
${FIREBASE_GEN_FILE_DIR}/app/google_services_generated.h
354-
memory/atomic.h
355-
meta/move.h
356-
memory/unique_ptr.h
357-
memory/shared_ptr.h
358354
${app_flatbuffers_srcs})
359355

360356
set_property(TARGET firebase_app PROPERTY FOLDER "Firebase Cpp")

app/memory/atomic.h

Lines changed: 0 additions & 149 deletions
This file was deleted.

app/memory/atomic_test.cc

Lines changed: 0 additions & 99 deletions
This file was deleted.

0 commit comments

Comments
 (0)