OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ | 4 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ |
5 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ | 5 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ |
6 #pragma once | 6 #pragma once |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/tracked.h" | 10 #include "base/tracked.h" |
11 #include "chrome/browser/sync/engine/net/server_connection_manager.h" | 11 #include "chrome/browser/sync/engine/net/server_connection_manager.h" |
12 #include "chrome/browser/sync/engine/syncer_thread.h" | 12 #include "chrome/browser/sync/engine/syncer_thread.h" |
13 #include "chrome/browser/sync/engine/syncer_thread2.h" | |
14 #include "chrome/browser/sync/sessions/sync_session_context.h" | 13 #include "chrome/browser/sync/sessions/sync_session_context.h" |
15 #include "chrome/browser/sync/syncable/model_type.h" | 14 #include "chrome/browser/sync/syncable/model_type.h" |
16 #include "chrome/browser/sync/syncable/model_type_payload_map.h" | 15 #include "chrome/browser/sync/syncable/model_type_payload_map.h" |
17 | 16 |
18 namespace browser_sync { | 17 namespace browser_sync { |
19 | 18 |
20 class SyncerThreadAdapter { | 19 class SyncerThreadAdapter { |
21 public: | 20 public: |
22 SyncerThreadAdapter(sessions::SyncSessionContext* context, | 21 explicit SyncerThreadAdapter(sessions::SyncSessionContext* context); |
tim (not reviewing)
2011/04/18 16:11:47
This class only existed to choose between implemen
lipalani1
2011/04/18 20:36:41
Done.
| |
23 bool using_new_impl); | |
24 ~SyncerThreadAdapter(); | 22 ~SyncerThreadAdapter(); |
25 | 23 |
26 // We mimic the SyncerThread interface (an adaptee). | |
27 void WatchConnectionManager(ServerConnectionManager* conn_mgr); | |
28 bool Start(); | 24 bool Start(); |
29 bool Stop(int max_wait); | 25 bool Stop(int max_wait); |
30 bool RequestPause(); | |
31 bool RequestResume(); | |
32 void NudgeSyncer(int milliseconds_from_now, | 26 void NudgeSyncer(int milliseconds_from_now, |
33 SyncerThread::NudgeSource source, | 27 NudgeSource source, |
34 const tracked_objects::Location& nudge_location); | 28 const tracked_objects::Location& nudge_location); |
35 void NudgeSyncerWithDataTypes( | 29 void NudgeSyncerWithDataTypes( |
36 int milliseconds_from_now, | 30 int milliseconds_from_now, |
37 SyncerThread::NudgeSource source, | 31 NudgeSource source, |
38 const syncable::ModelTypeBitSet& model_types, | 32 const syncable::ModelTypeBitSet& model_types, |
39 const tracked_objects::Location& nudge_location); | 33 const tracked_objects::Location& nudge_location); |
40 void NudgeSyncerWithPayloads( | 34 void NudgeSyncerWithPayloads( |
41 int milliseconds_from_now, | 35 int milliseconds_from_now, |
42 SyncerThread::NudgeSource source, | 36 NudgeSource source, |
43 const syncable::ModelTypePayloadMap& model_types_with_payloads, | 37 const syncable::ModelTypePayloadMap& model_types_with_payloads, |
44 const tracked_objects::Location& nudge_location); | 38 const tracked_objects::Location& nudge_location); |
45 void SetNotificationsEnabled(bool enabled); | 39 void SetNotificationsEnabled(bool enabled); |
46 void CreateSyncer(const std::string& dirname); | |
47 | 40 |
48 // Expose the new impl to leverage new apis through the adapter. | 41 // Expose the new impl to leverage new apis through the adapter. |
49 s3::SyncerThread* new_impl(); | 42 SyncerThread* new_impl(); |
50 private: | 43 private: |
51 scoped_refptr<SyncerThread> legacy_; | 44 scoped_ptr<SyncerThread> new_impl_; |
52 scoped_ptr<s3::SyncerThread> new_impl_; | |
53 bool using_new_impl_; | |
54 | 45 |
55 DISALLOW_COPY_AND_ASSIGN(SyncerThreadAdapter); | 46 DISALLOW_COPY_AND_ASSIGN(SyncerThreadAdapter); |
56 }; | 47 }; |
57 | 48 |
58 } // namespace browser_sync | 49 } // namespace browser_sync |
59 | 50 |
60 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ | 51 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ |
OLD | NEW |