Chromium Code Reviews| 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 | 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 Loading... | |
| 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 ®istrar_.routing_info)); | 409 ®istrar_.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::StartConfigurationMode)); | |
| 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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 | 648 |
| 647 void SyncBackendHost::Core::CreateSyncNotifier( | 649 void SyncBackendHost::Core::CreateSyncNotifier( |
| 648 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { | 650 const scoped_refptr<net::URLRequestContextGetter>& request_context_getter) { |
| 649 const std::string& client_info = webkit_glue::GetUserAgent(GURL()); | 651 const std::string& client_info = webkit_glue::GetUserAgent(GURL()); |
| 650 SyncNotifierFactory sync_notifier_factory(client_info); | 652 SyncNotifierFactory sync_notifier_factory(client_info); |
| 651 sync_notifier_.reset(sync_notifier_factory.CreateSyncNotifier( | 653 sync_notifier_.reset(sync_notifier_factory.CreateSyncNotifier( |
| 652 *CommandLine::ForCurrentProcess(), | 654 *CommandLine::ForCurrentProcess(), |
| 653 request_context_getter)); | 655 request_context_getter)); |
| 654 } | 656 } |
| 655 | 657 |
| 658 void SyncBackendHost::Core::StartConfigurationMode() { | |
|
tim (not reviewing)
2011/04/15 00:21:43
should call this 'DoStartConfigurationMode'
lipalani1
2011/04/15 01:24:39
Done.
| |
| 659 syncapi_->StartConfigurationMode(NewCallback(this, | |
| 660 &SyncBackendHost::Core::FinishConfigureDataTypes)); | |
| 661 } | |
| 662 | |
| 656 SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions( | 663 SyncBackendHost::Core::DoInitializeOptions::DoInitializeOptions( |
| 657 const GURL& service_url, | 664 const GURL& service_url, |
| 658 sync_api::HttpPostProviderFactory* http_bridge_factory, | 665 sync_api::HttpPostProviderFactory* http_bridge_factory, |
| 659 const sync_api::SyncCredentials& credentials, | 666 const sync_api::SyncCredentials& credentials, |
| 660 bool delete_sync_data_folder, | 667 bool delete_sync_data_folder, |
| 661 const std::string& restored_key_for_bootstrapping, | 668 const std::string& restored_key_for_bootstrapping, |
| 662 bool setup_for_test_mode) | 669 bool setup_for_test_mode) |
| 663 : service_url(service_url), | 670 : service_url(service_url), |
| 664 http_bridge_factory(http_bridge_factory), | 671 http_bridge_factory(http_bridge_factory), |
| 665 credentials(credentials), | 672 credentials(credentials), |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1210 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); | 1217 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); |
| 1211 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); | 1218 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); |
| 1212 } | 1219 } |
| 1213 | 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 |
| OLD | NEW |