| 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/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 helium { | |
| 14 namespace { | |
| 15 | |
| 16 class SyncManagerImpl : public SyncManager { | |
| 17 public: | |
| 18 explicit SyncManagerImpl(std::unique_ptr<HeliumTransport> transport); | |
| 19 ~SyncManagerImpl() override; | |
| 20 | |
| 21 // HeliumSyncManager implementation. | |
| 22 std::unique_ptr<SyncRegistration> Register(Syncable* object) override; | |
| 23 std::unique_ptr<SyncRegistration> RegisterExisting(HeliumObjectId id, | |
| 24 Syncable* object) override; | |
| 25 void Unregister(HeliumObjectId id) override; | |
| 26 void Pause(HeliumObjectId id, bool paused) override; | |
| 27 | |
| 28 private: | |
| 29 std::unique_ptr<HeliumTransport> transport_; | |
| 30 | |
| 31 DISALLOW_COPY_AND_ASSIGN(SyncManagerImpl); | |
| 32 }; | |
| 33 | |
| 34 SyncManagerImpl::SyncManagerImpl(std::unique_ptr<HeliumTransport> transport) | |
| 35 : transport_(std::move(transport)) { | |
| 36 DCHECK(transport_); | |
| 37 } | |
| 38 | |
| 39 SyncManagerImpl::~SyncManagerImpl() {} | |
| 40 | |
| 41 std::unique_ptr<SyncManager::SyncRegistration> SyncManagerImpl::Register( | |
| 42 Syncable* object) { | |
| 43 NOTIMPLEMENTED(); | |
| 44 return nullptr; | |
| 45 } | |
| 46 | |
| 47 std::unique_ptr<SyncManager::SyncRegistration> | |
| 48 SyncManagerImpl::RegisterExisting(HeliumObjectId id, Syncable* object) { | |
| 49 NOTIMPLEMENTED(); | |
| 50 return nullptr; | |
| 51 } | |
| 52 | |
| 53 void SyncManagerImpl::Unregister(HeliumObjectId id) { | |
| 54 NOTIMPLEMENTED(); | |
| 55 } | |
| 56 | |
| 57 void SyncManagerImpl::Pause(HeliumObjectId id, bool paused) { | |
| 58 NOTIMPLEMENTED(); | |
| 59 } | |
| 60 | |
| 61 } // namespace | |
| 62 | |
| 63 // static | |
| 64 std::unique_ptr<SyncManager> SyncManager::Create( | |
| 65 std::unique_ptr<HeliumTransport> transport) { | |
| 66 return base::MakeUnique<SyncManagerImpl>(std::move(transport)); | |
| 67 } | |
| 68 | |
| 69 SyncManager::SyncRegistration::SyncRegistration(SyncManager* sync_manager, | |
| 70 HeliumObjectId id) | |
| 71 : id_(id), sync_manager_(sync_manager) { | |
| 72 DCHECK(sync_manager); | |
| 73 } | |
| 74 | |
| 75 SyncManager::SyncRegistration::~SyncRegistration() { | |
| 76 sync_manager_->Unregister(id_); | |
| 77 } | |
| 78 | |
| 79 void SyncManager::SyncRegistration::Pause(bool paused) { | |
| 80 sync_manager_->Pause(id_, paused); | |
| 81 } | |
| 82 | |
| 83 } // namespace helium | |
| 84 } // namespace blimp | |
| OLD | NEW |