| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 #ifndef CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ | |
| 5 #define CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ | |
| 6 #pragma once | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/tracked.h" | |
| 11 #include "chrome/browser/sync/engine/net/server_connection_manager.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" | |
| 15 #include "chrome/browser/sync/syncable/model_type.h" | |
| 16 #include "chrome/browser/sync/syncable/model_type_payload_map.h" | |
| 17 | |
| 18 namespace browser_sync { | |
| 19 | |
| 20 class SyncerThreadAdapter { | |
| 21 public: | |
| 22 SyncerThreadAdapter(sessions::SyncSessionContext* context, | |
| 23 bool using_new_impl); | |
| 24 ~SyncerThreadAdapter(); | |
| 25 | |
| 26 // We mimic the SyncerThread interface (an adaptee). | |
| 27 void WatchConnectionManager(ServerConnectionManager* conn_mgr); | |
| 28 bool Start(); | |
| 29 bool Stop(int max_wait); | |
| 30 bool RequestPause(); | |
| 31 bool RequestResume(); | |
| 32 void NudgeSyncer(int milliseconds_from_now, | |
| 33 SyncerThread::NudgeSource source, | |
| 34 const tracked_objects::Location& nudge_location); | |
| 35 void NudgeSyncerWithDataTypes( | |
| 36 int milliseconds_from_now, | |
| 37 SyncerThread::NudgeSource source, | |
| 38 const syncable::ModelTypeBitSet& model_types, | |
| 39 const tracked_objects::Location& nudge_location); | |
| 40 void NudgeSyncerWithPayloads( | |
| 41 int milliseconds_from_now, | |
| 42 SyncerThread::NudgeSource source, | |
| 43 const syncable::ModelTypePayloadMap& model_types_with_payloads, | |
| 44 const tracked_objects::Location& nudge_location); | |
| 45 void SetNotificationsEnabled(bool enabled); | |
| 46 void CreateSyncer(const std::string& dirname); | |
| 47 | |
| 48 // Expose the new impl to leverage new apis through the adapter. | |
| 49 s3::SyncerThread* new_impl(); | |
| 50 private: | |
| 51 scoped_refptr<SyncerThread> legacy_; | |
| 52 scoped_ptr<s3::SyncerThread> new_impl_; | |
| 53 bool using_new_impl_; | |
| 54 | |
| 55 DISALLOW_COPY_AND_ASSIGN(SyncerThreadAdapter); | |
| 56 }; | |
| 57 | |
| 58 } // namespace browser_sync | |
| 59 | |
| 60 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCER_THREAD_ADAPTER_H_ | |
| OLD | NEW |