Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3675)

Unified Diff: blimp/net/helium/helium_sync_manager.cc

Issue 2377873002: Initial definition of HeliumSyncManager and SyncRegistration objects. (Closed)
Patch Set: Remove review cruft from CL Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: blimp/net/helium/helium_sync_manager.cc
diff --git a/blimp/net/helium/helium_sync_manager.cc b/blimp/net/helium/helium_sync_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..958ef53e0e86c1a420d6acf6ac4a944a0bf29f5b
--- /dev/null
+++ b/blimp/net/helium/helium_sync_manager.cc
@@ -0,0 +1,84 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/net/helium/helium_sync_manager.h"
+
+#include <utility>
+
+#include "base/logging.h"
+#include "base/memory/ptr_util.h"
+
+namespace blimp {
+namespace {
+
+class HeliumSyncManagerImpl : public HeliumSyncManager {
+ public:
+ explicit HeliumSyncManagerImpl(std::unique_ptr<HeliumTransport> transport);
+ ~HeliumSyncManagerImpl() override;
+
+ // HeliumSyncManager implementation.
+ std::unique_ptr<SyncRegistration> Register(Syncable* object) override;
+ std::unique_ptr<SyncRegistration> RegisterExisting(HeliumObjectId id,
+ Syncable* object) override;
+ void Unregister(HeliumObjectId id) override;
+ void Pause(HeliumObjectId id, bool paused) override;
+
+ private:
+ std::unique_ptr<HeliumTransport> transport_;
+
+ DISALLOW_COPY_AND_ASSIGN(HeliumSyncManagerImpl);
+};
+
+HeliumSyncManagerImpl::HeliumSyncManagerImpl(
+ std::unique_ptr<HeliumTransport> transport)
+ : transport_(std::move(transport)) {
+ DCHECK(transport_);
+}
+
+HeliumSyncManagerImpl::~HeliumSyncManagerImpl() {}
+
+std::unique_ptr<HeliumSyncManager::SyncRegistration>
+HeliumSyncManagerImpl::Register(Syncable* object) {
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+std::unique_ptr<HeliumSyncManager::SyncRegistration>
+HeliumSyncManagerImpl::RegisterExisting(HeliumObjectId id, Syncable* object) {
+ NOTIMPLEMENTED();
+ return nullptr;
+}
+
+void HeliumSyncManagerImpl::Unregister(HeliumObjectId id) {
+ NOTIMPLEMENTED();
+}
+
+void HeliumSyncManagerImpl::Pause(HeliumObjectId id, bool paused) {
+ NOTIMPLEMENTED();
+}
+
+} // namespace
+
+// static
+std::unique_ptr<HeliumSyncManager> HeliumSyncManager::Create(
+ std::unique_ptr<HeliumTransport> transport) {
+ return base::MakeUnique<HeliumSyncManagerImpl>(std::move(transport));
+}
+
+HeliumSyncManager::SyncRegistration::SyncRegistration(
+ HeliumSyncManager* sync_manager,
+ HeliumObjectId id)
+ : id_(id), sync_manager_(sync_manager) {
+ DCHECK(sync_manager);
+}
+
+HeliumSyncManager::SyncRegistration::~SyncRegistration() {
+ sync_manager_->Unregister(id_);
+}
+
+void HeliumSyncManager::SyncRegistration::Pause(bool paused) {
+ sync_manager_->Pause(id_, paused);
+}
+
+} // namespace blimp
« blimp/net/helium/helium_sync_manager.h ('K') | « blimp/net/helium/helium_sync_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698