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 ScopedSyncRegistration; | |
scf
2016/09/28 17:18:00
unused?
Kevin M
2016/09/29 00:06:28
Done.
| |
16 | |
17 class HeliumSyncManagerImpl : public HeliumSyncManager { | |
18 public: | |
19 explicit HeliumSyncManagerImpl(std::unique_ptr<HeliumTransport> transport); | |
scf
2016/09/28 17:18:00
Don't you also need the "RunningAs" enum (Client/S
Kevin M
2016/09/29 00:06:28
Was waiting on the common enums to be landed.
| |
20 ~HeliumSyncManagerImpl() override; | |
21 | |
22 // HeliumSyncManager implementation. | |
23 std::unique_ptr<SyncRegistration> Register(Syncable* object) override; | |
24 std::unique_ptr<SyncRegistration> RegisterExisting(HeliumObjectId id, | |
25 Syncable* object) override; | |
26 void Unregister(HeliumObjectId id) override; | |
27 void Pause(HeliumObjectId id, bool paused) override; | |
28 | |
29 private: | |
30 std::unique_ptr<HeliumTransport> transport_; | |
31 | |
32 DISALLOW_COPY_AND_ASSIGN(HeliumSyncManagerImpl); | |
33 }; | |
34 | |
35 HeliumSyncManagerImpl::HeliumSyncManagerImpl( | |
36 std::unique_ptr<HeliumTransport> transport) | |
37 : transport_(std::move(transport)) { | |
38 DCHECK(transport_); | |
scf
2016/09/28 17:18:00
change to CHECK? if we don't have transport we are
Kevin M
2016/09/29 00:06:28
Coding errors (dev messed up) are typically DCHECK
| |
39 } | |
40 | |
41 HeliumSyncManagerImpl::~HeliumSyncManagerImpl() {} | |
42 | |
43 std::unique_ptr<HeliumSyncManager::SyncRegistration> | |
44 HeliumSyncManagerImpl::Register(Syncable* object) { | |
45 NOTIMPLEMENTED(); | |
46 return nullptr; | |
47 } | |
48 | |
49 std::unique_ptr<HeliumSyncManager::SyncRegistration> | |
50 HeliumSyncManagerImpl::RegisterExisting(HeliumObjectId id, Syncable* object) { | |
51 NOTIMPLEMENTED(); | |
52 return nullptr; | |
53 } | |
54 | |
55 void HeliumSyncManagerImpl::Unregister(HeliumObjectId id) { | |
56 NOTIMPLEMENTED(); | |
57 } | |
58 | |
59 void HeliumSyncManagerImpl::Pause(HeliumObjectId id, bool paused) { | |
60 NOTIMPLEMENTED(); | |
61 } | |
62 | |
63 } // namespace | |
64 | |
65 // static | |
66 std::unique_ptr<HeliumSyncManager> HeliumSyncManager::Create( | |
67 std::unique_ptr<HeliumTransport> transport) { | |
68 return base::MakeUnique<HeliumSyncManagerImpl>(std::move(transport)); | |
69 } | |
70 | |
71 HeliumSyncManager::SyncRegistration::SyncRegistration( | |
72 HeliumSyncManager* sync_manager, | |
73 HeliumObjectId id) | |
74 : id_(id), sync_manager_(sync_manager) { | |
75 DCHECK(sync_manager); | |
76 } | |
77 | |
78 HeliumSyncManager::SyncRegistration::~SyncRegistration() { | |
79 sync_manager_->Unregister(id_); | |
80 } | |
81 | |
82 void HeliumSyncManager::SyncRegistration::Pause(bool paused) { | |
83 sync_manager_->Pause(id_, paused); | |
84 } | |
85 | |
86 } // namespace blimp | |
OLD | NEW |