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

Side by Side Diff: components/sync/engine_impl/sync_manager_impl.cc

Issue 2442453002: [Sync] Adds a new switch for enabling the new local server backend. (Closed)
Patch Set: Fix InitArgs contructor. Created 4 years, 1 month 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
« no previous file with comments | « components/sync/engine_impl/sync_manager_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "components/sync/engine_impl/sync_manager_impl.h" 5 #include "components/sync/engine_impl/sync_manager_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 29 matching lines...) Expand all
40 #include "components/sync/syncable/base_node.h" 40 #include "components/sync/syncable/base_node.h"
41 #include "components/sync/syncable/directory.h" 41 #include "components/sync/syncable/directory.h"
42 #include "components/sync/syncable/entry.h" 42 #include "components/sync/syncable/entry.h"
43 #include "components/sync/syncable/in_memory_directory_backing_store.h" 43 #include "components/sync/syncable/in_memory_directory_backing_store.h"
44 #include "components/sync/syncable/on_disk_directory_backing_store.h" 44 #include "components/sync/syncable/on_disk_directory_backing_store.h"
45 #include "components/sync/syncable/read_node.h" 45 #include "components/sync/syncable/read_node.h"
46 #include "components/sync/syncable/read_transaction.h" 46 #include "components/sync/syncable/read_transaction.h"
47 #include "components/sync/syncable/write_node.h" 47 #include "components/sync/syncable/write_node.h"
48 #include "components/sync/syncable/write_transaction.h" 48 #include "components/sync/syncable/write_transaction.h"
49 49
50 #if defined(OS_WIN)
51 #include "components/sync/engine_impl/loopback_server/loopback_connection_manage r.h"
52 #endif
53
50 using base::TimeDelta; 54 using base::TimeDelta;
51 using sync_pb::GetUpdatesCallerInfo; 55 using sync_pb::GetUpdatesCallerInfo;
52 56
53 class GURL; 57 class GURL;
54 58
55 namespace syncer { 59 namespace syncer {
56 60
57 using syncable::ImmutableWriteTransactionInfo; 61 using syncable::ImmutableWriteTransactionInfo;
58 using syncable::SPECIFICS; 62 using syncable::SPECIFICS;
59 using syncable::UNIQUE_POSITION; 63 using syncable::UNIQUE_POSITION;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 return; 279 return;
276 } 280 }
277 281
278 // Now that we have opened the Directory we can restore any previously saved 282 // Now that we have opened the Directory we can restore any previously saved
279 // nigori specifics. 283 // nigori specifics.
280 if (args->saved_nigori_state) { 284 if (args->saved_nigori_state) {
281 sync_encryption_handler_->RestoreNigori(*args->saved_nigori_state); 285 sync_encryption_handler_->RestoreNigori(*args->saved_nigori_state);
282 args->saved_nigori_state.reset(); 286 args->saved_nigori_state.reset();
283 } 287 }
284 288
285 connection_manager_ = base::MakeUnique<SyncServerConnectionManager>( 289 if (args->enable_local_sync_backend) {
286 args->service_url.host() + args->service_url.path(), 290 #if defined(OS_WIN)
287 args->service_url.EffectiveIntPort(), 291 VLOG(1) << "Running against local sync backend.";
288 args->service_url.SchemeIsCryptographic(), args->post_factory.release(), 292 connection_manager_ = base::MakeUnique<LoopbackConnectionManager>(
289 args->cancelation_signal); 293 args->cancelation_signal, args->local_sync_backend_folder);
294 #else
295 NOTREACHED();
296 #endif // defined(OS_WIN)
297 } else {
298 connection_manager_ = base::MakeUnique<SyncServerConnectionManager>(
299 args->service_url.host() + args->service_url.path(),
300 args->service_url.EffectiveIntPort(),
301 args->service_url.SchemeIsCryptographic(), args->post_factory.release(),
302 args->cancelation_signal);
303 }
290 connection_manager_->set_client_id(directory()->cache_guid()); 304 connection_manager_->set_client_id(directory()->cache_guid());
291 connection_manager_->AddListener(this); 305 connection_manager_->AddListener(this);
292 306
293 std::string sync_id = directory()->cache_guid(); 307 std::string sync_id = directory()->cache_guid();
294 308
295 DVLOG(1) << "Setting sync client ID: " << sync_id; 309 DVLOG(1) << "Setting sync client ID: " << sync_id;
296 allstatus_.SetSyncId(sync_id); 310 allstatus_.SetSyncId(sync_id);
297 DVLOG(1) << "Setting invalidator client ID: " << args->invalidator_client_id; 311 DVLOG(1) << "Setting invalidator client ID: " << args->invalidator_client_id;
298 allstatus_.SetInvalidatorClientId(args->invalidator_client_id); 312 allstatus_.SetInvalidatorClientId(args->invalidator_client_id);
299 313
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 1012 }
999 1013
1000 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch, 1014 void SyncManagerImpl::OnCookieJarChanged(bool account_mismatch,
1001 bool empty_jar) { 1015 bool empty_jar) {
1002 DCHECK(thread_checker_.CalledOnValidThread()); 1016 DCHECK(thread_checker_.CalledOnValidThread());
1003 cycle_context_->set_cookie_jar_mismatch(account_mismatch); 1017 cycle_context_->set_cookie_jar_mismatch(account_mismatch);
1004 cycle_context_->set_cookie_jar_empty(empty_jar); 1018 cycle_context_->set_cookie_jar_empty(empty_jar);
1005 } 1019 }
1006 1020
1007 } // namespace syncer 1021 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/engine_impl/sync_manager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698