File tree Expand file tree Collapse file tree 5 files changed +27
-21
lines changed Expand file tree Collapse file tree 5 files changed +27
-21
lines changed Original file line number Diff line number Diff line change 1212// See the License for the specific language governing permissions and
1313// limitations under the License.
1414
15- #ifndef FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_CONNECTION_SAFE_REFERENCE_H_
16- #define FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_CONNECTION_SAFE_REFERENCE_H_
15+ #ifndef FIREBASE_APP_CLIENT_CPP_SRC_SAFE_REFERENCE_H_
16+ #define FIREBASE_APP_CLIENT_CPP_SRC_SAFE_REFERENCE_H_
1717
1818#include " app/memory/shared_ptr.h"
1919#include " app/src/mutex.h"
2020
21- namespace firebase {
22- namespace database {
21+ #if !defined(FIREBASE_NAMESPACE)
22+ #define FIREBASE_NAMESPACE firebase
23+ #endif
24+
25+ namespace FIREBASE_NAMESPACE {
2326namespace internal {
24- namespace connection {
27+
28+ // TODO(b/130544650): Add unit test to this file.
2529
2630// SafeReference owns a pointers to an object which can be deleted in anytime.
2731// SafeReference can be shared to different thread that potentially have longer
@@ -72,9 +76,8 @@ class SafeReferenceLock {
7276 SafeReference<T>* ref_;
7377 MutexLock lock_;
7478};
75- } // namespace connection
79+
7680} // namespace internal
77- } // namespace database
78- } // namespace firebase
81+ } // namespace FIREBASE_NAMESPACE
7982
80- #endif // FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_CONNECTION_SAFE_REFERENCE_H_
83+ #endif // FIREBASE_APP_CLIENT_CPP_SRC_SAFE_REFERENCE_H_
Original file line number Diff line number Diff line change 2020#include " app/memory/atomic.h"
2121#include " app/memory/unique_ptr.h"
2222#include " app/src/include/firebase/variant.h"
23+ #include " app/src/safe_reference.h"
2324#include " app/src/scheduler.h"
2425#include " database/src/desktop/connection/host_info.h"
25- #include " database/src/desktop/connection/safe_reference.h"
2626#include " database/src/desktop/connection/web_socket_client_interface.h"
2727
2828namespace firebase {
@@ -175,8 +175,8 @@ class Connection : public WebSocketClientEventHandler {
175175 // Safe reference to this. Set in constructor and cleared in destructor
176176 // Should be safe to be copied in any thread because the SharedPtr never
177177 // changes, until safe_this_ is completely destroyed.
178- typedef SafeReference<Connection> ConnectionRef;
179- typedef SafeReferenceLock<Connection> ConnectionRefLock;
178+ typedef firebase::internal:: SafeReference<Connection> ConnectionRef;
179+ typedef firebase::internal:: SafeReferenceLock<Connection> ConnectionRefLock;
180180 ConnectionRef safe_this_;
181181
182182 // Event handler for higher level
Original file line number Diff line number Diff line change 2929#include " app/src/include/firebase/variant.h"
3030#include " app/src/optional.h"
3131#include " app/src/path.h"
32+ #include " app/src/safe_reference.h"
3233#include " app/src/scheduler.h"
3334#include " database/src/common/query_spec.h"
3435#include " database/src/desktop/connection/connection.h"
3536#include " database/src/desktop/connection/host_info.h"
36- #include " database/src/desktop/connection/safe_reference.h"
3737#include " database/src/include/firebase/database/common.h"
3838
3939namespace firebase {
@@ -465,8 +465,9 @@ class PersistentConnection : public ConnectionEventHandler {
465465 // Safe reference to this. Set in constructor and cleared in destructor
466466 // Should be safe to be copied in any thread because the SharedPtr never
467467 // changes, until safe_this_ is completely destroyed.
468- typedef SafeReference<PersistentConnection> ThisRef;
469- typedef SafeReferenceLock<PersistentConnection> ThisRefLock;
468+ typedef firebase::internal::SafeReference<PersistentConnection> ThisRef;
469+ typedef firebase::internal::SafeReferenceLock<PersistentConnection>
470+ ThisRefLock;
470471 ThisRef safe_this_;
471472
472473 // Scheduler to make sure all Connection events are handled in worker
Original file line number Diff line number Diff line change 1616#define FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_CORE_REPO_H_
1717
1818#include < vector>
19+
1920#include " app/memory/unique_ptr.h"
2021#include " app/src/include/firebase/variant.h"
2122#include " app/src/path.h"
2223#include " app/src/reference_counted_future_impl.h"
24+ #include " app/src/safe_reference.h"
2325#include " database/src/desktop/connection/persistent_connection.h"
24- #include " database/src/desktop/connection/safe_reference.h"
2526#include " database/src/desktop/core/event_registration.h"
2627#include " database/src/desktop/core/sparse_snapshot_tree.h"
2728#include " database/src/desktop/core/sync_tree.h"
@@ -40,8 +41,8 @@ class EventRegistration;
4041
4142class Repo : public connection ::PersistentConnectionEventHandler {
4243 public:
43- typedef connection ::SafeReference<Repo> ThisRef;
44- typedef connection ::SafeReferenceLock<Repo> ThisRefLock;
44+ typedef firebase::internal ::SafeReference<Repo> ThisRef;
45+ typedef firebase::internal ::SafeReferenceLock<Repo> ThisRefLock;
4546
4647 explicit Repo (App* app, DatabaseInternal* database, const char * url);
4748
Original file line number Diff line number Diff line change 1717
1818#include < list>
1919#include < string>
20+
2021#include " app/src/cleanup_notifier.h"
2122#include " app/src/future_manager.h"
2223#include " app/src/include/firebase/app.h"
2324#include " app/src/mutex.h"
25+ #include " app/src/safe_reference.h"
2426#include " app/src/scheduler.h"
2527#include " database/src/common/listener.h"
2628#include " database/src/common/query_spec.h"
2729#include " database/src/desktop/connection/host_info.h"
2830#include " database/src/desktop/connection/persistent_connection.h"
29- #include " database/src/desktop/connection/safe_reference.h"
3031#include " database/src/desktop/core/indexed_variant.h"
3132#include " database/src/desktop/core/repo.h"
3233#include " database/src/desktop/push_child_name_generator.h"
@@ -144,8 +145,8 @@ class DatabaseInternal {
144145 }
145146 }
146147
147- typedef connection ::SafeReference<DatabaseInternal> ThisRef;
148- typedef connection ::SafeReferenceLock<DatabaseInternal> ThisRefLock;
148+ typedef firebase::internal ::SafeReference<DatabaseInternal> ThisRef;
149+ typedef firebase::internal ::SafeReferenceLock<DatabaseInternal> ThisRefLock;
149150
150151 // Call from transaction response to handle the response result.
151152 void HandleTransactionResponse (const connection::ResponsePtr& ptr);
You can’t perform that action at this time.
0 commit comments