Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: chrome/browser/sync/engine/syncer_thread_adapter.cc

Issue 6690020: sync: hook up ServerConnectionManager <> SyncerThread2 and tie up more loose ends (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: fix Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 4
5 #include "base/time.h" 5 #include "base/time.h"
6 #include "chrome/browser/sync/engine/syncer_thread_adapter.h" 6 #include "chrome/browser/sync/engine/syncer_thread_adapter.h"
7 #include "chrome/browser/sync/syncable/model_type.h" 7 #include "chrome/browser/sync/syncable/model_type.h"
8 8
9 using base::TimeDelta; 9 using base::TimeDelta;
10 using syncable::ModelTypeBitSet; 10 using syncable::ModelTypeBitSet;
11 11
12 namespace browser_sync { 12 namespace browser_sync {
13 13
14 SyncerThreadAdapter::SyncerThreadAdapter(sessions::SyncSessionContext* context, 14 SyncerThreadAdapter::SyncerThreadAdapter(sessions::SyncSessionContext* context,
15 bool using_new_impl) 15 bool using_new_impl)
16 : legacy_(NULL), new_impl_(NULL), using_new_impl_(using_new_impl) { 16 : legacy_(NULL), new_impl_(NULL), using_new_impl_(using_new_impl) {
17 if (using_new_impl_) { 17 if (using_new_impl_) {
18 new_impl_.reset(new s3::SyncerThread(context, new Syncer())); 18 new_impl_.reset(new s3::SyncerThread(context, new Syncer()));
19 new_impl_->Start(s3::SyncerThread::CONFIGURATION_MODE); 19 new_impl_->Start(s3::SyncerThread::CONFIGURATION_MODE, NULL);
20 } else { 20 } else {
21 legacy_ = new SyncerThread(context); 21 legacy_ = new SyncerThread(context);
22 } 22 }
23 } 23 }
24 24
25 SyncerThreadAdapter::~SyncerThreadAdapter() { 25 SyncerThreadAdapter::~SyncerThreadAdapter() {
26 legacy_ = NULL; 26 legacy_ = NULL;
27 new_impl_.reset(); 27 new_impl_.reset();
28 } 28 }
29 29
30 void SyncerThreadAdapter::WatchConnectionManager( 30 void SyncerThreadAdapter::WatchConnectionManager(
31 ServerConnectionManager* conn_mgr) { 31 ServerConnectionManager* conn_mgr) {
32 DCHECK(!using_new_impl_); 32 DCHECK(!using_new_impl_);
33 legacy_->WatchConnectionManager(conn_mgr); 33 legacy_->WatchConnectionManager(conn_mgr);
34 } 34 }
35 35
36 bool SyncerThreadAdapter::Start() { 36 bool SyncerThreadAdapter::Start() {
37 if (using_new_impl_) { 37 if (using_new_impl_) {
38 new_impl_->Start(s3::SyncerThread::NORMAL_MODE); 38 new_impl_->Start(s3::SyncerThread::NORMAL_MODE, NULL);
39 return true; 39 return true;
40 } else { 40 } else {
41 return legacy_->Start(); 41 return legacy_->Start();
42 } 42 }
43 } 43 }
44 44
45 bool SyncerThreadAdapter::Stop(int max_wait) { 45 bool SyncerThreadAdapter::Stop(int max_wait) {
46 if (using_new_impl_) { 46 if (using_new_impl_) {
47 new_impl_->Stop(); 47 new_impl_->Stop();
48 return true; 48 return true;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 if (!using_new_impl_) 133 if (!using_new_impl_)
134 legacy_->CreateSyncer(dirname); 134 legacy_->CreateSyncer(dirname);
135 // No-op if using new impl. 135 // No-op if using new impl.
136 } 136 }
137 137
138 s3::SyncerThread* SyncerThreadAdapter::new_impl() { 138 s3::SyncerThread* SyncerThreadAdapter::new_impl() {
139 return new_impl_.get(); 139 return new_impl_.get();
140 } 140 }
141 141
142 } // namespace browser_sync 142 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_thread2_unittest.cc ('k') | chrome/browser/sync/engine/syncer_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698