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 12
12
// See the License for the specific language governing permissions and
13
13
// limitations under the License.
14
14
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_
17
17
18
18
#include " app/memory/shared_ptr.h"
19
19
#include " app/src/mutex.h"
20
20
21
- namespace firebase {
22
- namespace database {
21
+ #if !defined(FIREBASE_NAMESPACE)
22
+ #define FIREBASE_NAMESPACE firebase
23
+ #endif
24
+
25
+ namespace FIREBASE_NAMESPACE {
23
26
namespace internal {
24
- namespace connection {
27
+
28
+ // TODO(b/130544650): Add unit test to this file.
25
29
26
30
// SafeReference owns a pointers to an object which can be deleted in anytime.
27
31
// SafeReference can be shared to different thread that potentially have longer
@@ -72,9 +76,8 @@ class SafeReferenceLock {
72
76
SafeReference<T>* ref_;
73
77
MutexLock lock_;
74
78
};
75
- } // namespace connection
79
+
76
80
} // namespace internal
77
- } // namespace database
78
- } // namespace firebase
81
+ } // namespace FIREBASE_NAMESPACE
79
82
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 20
20
#include " app/memory/atomic.h"
21
21
#include " app/memory/unique_ptr.h"
22
22
#include " app/src/include/firebase/variant.h"
23
+ #include " app/src/safe_reference.h"
23
24
#include " app/src/scheduler.h"
24
25
#include " database/src/desktop/connection/host_info.h"
25
- #include " database/src/desktop/connection/safe_reference.h"
26
26
#include " database/src/desktop/connection/web_socket_client_interface.h"
27
27
28
28
namespace firebase {
@@ -175,8 +175,8 @@ class Connection : public WebSocketClientEventHandler {
175
175
// Safe reference to this. Set in constructor and cleared in destructor
176
176
// Should be safe to be copied in any thread because the SharedPtr never
177
177
// 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;
180
180
ConnectionRef safe_this_;
181
181
182
182
// Event handler for higher level
Original file line number Diff line number Diff line change 29
29
#include " app/src/include/firebase/variant.h"
30
30
#include " app/src/optional.h"
31
31
#include " app/src/path.h"
32
+ #include " app/src/safe_reference.h"
32
33
#include " app/src/scheduler.h"
33
34
#include " database/src/common/query_spec.h"
34
35
#include " database/src/desktop/connection/connection.h"
35
36
#include " database/src/desktop/connection/host_info.h"
36
- #include " database/src/desktop/connection/safe_reference.h"
37
37
#include " database/src/include/firebase/database/common.h"
38
38
39
39
namespace firebase {
@@ -465,8 +465,9 @@ class PersistentConnection : public ConnectionEventHandler {
465
465
// Safe reference to this. Set in constructor and cleared in destructor
466
466
// Should be safe to be copied in any thread because the SharedPtr never
467
467
// 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;
470
471
ThisRef safe_this_;
471
472
472
473
// Scheduler to make sure all Connection events are handled in worker
Original file line number Diff line number Diff line change 16
16
#define FIREBASE_DATABASE_CLIENT_CPP_SRC_DESKTOP_CORE_REPO_H_
17
17
18
18
#include < vector>
19
+
19
20
#include " app/memory/unique_ptr.h"
20
21
#include " app/src/include/firebase/variant.h"
21
22
#include " app/src/path.h"
22
23
#include " app/src/reference_counted_future_impl.h"
24
+ #include " app/src/safe_reference.h"
23
25
#include " database/src/desktop/connection/persistent_connection.h"
24
- #include " database/src/desktop/connection/safe_reference.h"
25
26
#include " database/src/desktop/core/event_registration.h"
26
27
#include " database/src/desktop/core/sparse_snapshot_tree.h"
27
28
#include " database/src/desktop/core/sync_tree.h"
@@ -40,8 +41,8 @@ class EventRegistration;
40
41
41
42
class Repo : public connection ::PersistentConnectionEventHandler {
42
43
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;
45
46
46
47
explicit Repo (App* app, DatabaseInternal* database, const char * url);
47
48
Original file line number Diff line number Diff line change 17
17
18
18
#include < list>
19
19
#include < string>
20
+
20
21
#include " app/src/cleanup_notifier.h"
21
22
#include " app/src/future_manager.h"
22
23
#include " app/src/include/firebase/app.h"
23
24
#include " app/src/mutex.h"
25
+ #include " app/src/safe_reference.h"
24
26
#include " app/src/scheduler.h"
25
27
#include " database/src/common/listener.h"
26
28
#include " database/src/common/query_spec.h"
27
29
#include " database/src/desktop/connection/host_info.h"
28
30
#include " database/src/desktop/connection/persistent_connection.h"
29
- #include " database/src/desktop/connection/safe_reference.h"
30
31
#include " database/src/desktop/core/indexed_variant.h"
31
32
#include " database/src/desktop/core/repo.h"
32
33
#include " database/src/desktop/push_child_name_generator.h"
@@ -144,8 +145,8 @@ class DatabaseInternal {
144
145
}
145
146
}
146
147
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;
149
150
150
151
// Call from transaction response to handle the response result.
151
152
void HandleTransactionResponse (const connection::ResponsePtr& ptr);
You can’t perform that action at this time.
0 commit comments