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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 6812004: sync: Make nudge + config jobs reliable in SyncerThread2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: upload before commit. 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 { 405 {
406 base::AutoLock lock(registrar_lock_); 406 base::AutoLock lock(registrar_lock_);
407 pending_config_mode_state_.reset( 407 pending_config_mode_state_.reset(
408 MakePendingConfigModeState(data_type_controllers, types, ready_task, 408 MakePendingConfigModeState(data_type_controllers, types, ready_task,
409 &registrar_.routing_info)); 409 &registrar_.routing_info));
410 } 410 }
411 411
412 // If we're doing the first configure (at startup) this is redundant as the 412 // If we're doing the first configure (at startup) this is redundant as the
413 // syncer thread always must start in config mode. 413 // syncer thread always must start in config mode.
414 if (using_new_syncer_thread_) { 414 if (using_new_syncer_thread_) {
415 core_->syncapi()->StartConfigurationMode(NewCallback(core_.get(), 415 core_thread_.message_loop()->PostTask(
416 &SyncBackendHost::Core::FinishConfigureDataTypes)); 416 FROM_HERE,
417 NewRunnableMethod(core_.get(),
418 &SyncBackendHost::Core::DoStartConfigurationMode));
417 } else { 419 } else {
418 FinishConfigureDataTypesOnFrontendLoop(); 420 FinishConfigureDataTypesOnFrontendLoop();
419 } 421 }
420 } 422 }
421 423
422 void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { 424 void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() {
423 DCHECK_EQ(MessageLoop::current(), frontend_loop_); 425 DCHECK_EQ(MessageLoop::current(), frontend_loop_);
424 // Nudge the syncer. This is necessary for both datatype addition/deletion. 426 // Nudge the syncer. This is necessary for both datatype addition/deletion.
425 // 427 //
426 // Deletions need a nudge in order to ensure the deletion occurs in a timely 428 // Deletions need a nudge in order to ensure the deletion occurs in a timely
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 syncapi_->RemoveObserver(&sync_manager_observer_); 1206 syncapi_->RemoveObserver(&sync_manager_observer_);
1205 } 1207 }
1206 1208
1207 void SyncBackendHost::Core::DoProcessMessage( 1209 void SyncBackendHost::Core::DoProcessMessage(
1208 const std::string& name, const JsArgList& args, 1210 const std::string& name, const JsArgList& args,
1209 const JsEventHandler* sender) { 1211 const JsEventHandler* sender) {
1210 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); 1212 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop());
1211 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); 1213 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender);
1212 } 1214 }
1213 1215
1216 void SyncBackendHost::Core::DoStartConfigurationMode() {
1217 syncapi_->StartConfigurationMode(NewCallback(this,
1218 &SyncBackendHost::Core::FinishConfigureDataTypes));
1219 }
1220
1214 void SyncBackendHost::Core::DeferNudgeForCleanup() { 1221 void SyncBackendHost::Core::DeferNudgeForCleanup() {
1215 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); 1222 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop());
1216 deferred_nudge_for_cleanup_requested_ = true; 1223 deferred_nudge_for_cleanup_requested_ = true;
1217 } 1224 }
1218 1225
1219 } // namespace browser_sync 1226 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/profile_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698