OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "blimp/net/helium/helium_sync_manager.h" |
| 6 |
| 7 #include <utility> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" |
| 11 |
| 12 namespace blimp { |
| 13 namespace { |
| 14 |
| 15 class HeliumSyncManagerImpl : public HeliumSyncManager { |
| 16 public: |
| 17 explicit HeliumSyncManagerImpl(std::unique_ptr<HeliumTransport> transport); |
| 18 ~HeliumSyncManagerImpl() override; |
| 19 |
| 20 // HeliumSyncManager implementation. |
| 21 std::unique_ptr<SyncRegistration> Register(Syncable* object) override; |
| 22 std::unique_ptr<SyncRegistration> RegisterExisting(HeliumObjectId id, |
| 23 Syncable* object) override; |
| 24 void Unregister(HeliumObjectId id) override; |
| 25 void Pause(HeliumObjectId id, bool paused) override; |
| 26 |
| 27 private: |
| 28 std::unique_ptr<HeliumTransport> transport_; |
| 29 |
| 30 DISALLOW_COPY_AND_ASSIGN(HeliumSyncManagerImpl); |
| 31 }; |
| 32 |
| 33 HeliumSyncManagerImpl::HeliumSyncManagerImpl( |
| 34 std::unique_ptr<HeliumTransport> transport) |
| 35 : transport_(std::move(transport)) { |
| 36 DCHECK(transport_); |
| 37 } |
| 38 |
| 39 HeliumSyncManagerImpl::~HeliumSyncManagerImpl() {} |
| 40 |
| 41 std::unique_ptr<HeliumSyncManager::SyncRegistration> |
| 42 HeliumSyncManagerImpl::Register(Syncable* object) { |
| 43 NOTIMPLEMENTED(); |
| 44 return nullptr; |
| 45 } |
| 46 |
| 47 std::unique_ptr<HeliumSyncManager::SyncRegistration> |
| 48 HeliumSyncManagerImpl::RegisterExisting(HeliumObjectId id, Syncable* object) { |
| 49 NOTIMPLEMENTED(); |
| 50 return nullptr; |
| 51 } |
| 52 |
| 53 void HeliumSyncManagerImpl::Unregister(HeliumObjectId id) { |
| 54 NOTIMPLEMENTED(); |
| 55 } |
| 56 |
| 57 void HeliumSyncManagerImpl::Pause(HeliumObjectId id, bool paused) { |
| 58 NOTIMPLEMENTED(); |
| 59 } |
| 60 |
| 61 } // namespace |
| 62 |
| 63 // static |
| 64 std::unique_ptr<HeliumSyncManager> HeliumSyncManager::Create( |
| 65 std::unique_ptr<HeliumTransport> transport) { |
| 66 return base::MakeUnique<HeliumSyncManagerImpl>(std::move(transport)); |
| 67 } |
| 68 |
| 69 HeliumSyncManager::SyncRegistration::SyncRegistration( |
| 70 HeliumSyncManager* sync_manager, |
| 71 HeliumObjectId id) |
| 72 : id_(id), sync_manager_(sync_manager) { |
| 73 DCHECK(sync_manager); |
| 74 } |
| 75 |
| 76 HeliumSyncManager::SyncRegistration::~SyncRegistration() { |
| 77 sync_manager_->Unregister(id_); |
| 78 } |
| 79 |
| 80 void HeliumSyncManager::SyncRegistration::Pause(bool paused) { |
| 81 sync_manager_->Pause(id_, paused); |
| 82 } |
| 83 |
| 84 } // namespace blimp |
OLD | NEW |