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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 292008: Fix ProfileSyncService unit test. (Closed)
Patch Set: Created 11 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 0e24c80d13a8733adf30d4a77d5b2cd8acec49ef..8432381bed802b7ae47d8fa581b8eba908817b37 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -45,10 +45,12 @@ void SyncBackendHost::Initialize(const GURL& sync_service_url,
if (!core_thread_.Start())
return;
bookmark_model_worker_ = new BookmarkModelWorker(frontend_loop_);
- core_.get()->SetBaseRequestContext(baseline_context);
+
core_thread_.message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize,
- sync_service_url, bookmark_model_worker_, true));
+ sync_service_url, bookmark_model_worker_, true,
+ new HttpBridgeFactory(baseline_context),
+ new HttpBridgeFactory(baseline_context)));
}
void SyncBackendHost::Authenticate(const std::string& username,
@@ -127,28 +129,11 @@ AuthErrorState SyncBackendHost::GetAuthErrorState() const {
return last_auth_error_;
}
-void SyncBackendHost::Core::SetBaseRequestContext(
- URLRequestContext* request_context) {
- DCHECK(base_request_context_ == NULL);
- base_request_context_ = request_context;
- // This ref is removed on the IO thread after the core thread is over.
- base_request_context_->AddRef();
-}
-
SyncBackendHost::Core::Core(SyncBackendHost* backend)
: host_(backend),
- base_request_context_(NULL),
syncapi_(new sync_api::SyncManager()) {
}
-SyncBackendHost::Core::~Core() {
- if (base_request_context_) {
- ChromeThread::GetMessageLoop(ChromeThread::IO)->ReleaseSoon(FROM_HERE,
- base_request_context_);
- base_request_context_ = NULL;
- }
-}
-
// Helper to construct a user agent string (ASCII) suitable for use by
// the syncapi for any HTTP communication. This string is used by the sync
// backend for classifying client types when calculating statistics.
@@ -179,7 +164,9 @@ std::string MakeUserAgentForSyncapi() {
void SyncBackendHost::Core::DoInitialize(
const GURL& service_url,
BookmarkModelWorker* bookmark_model_worker,
- bool attempt_last_user_authentication) {
+ bool attempt_last_user_authentication,
+ sync_api::HttpPostProviderFactory* http_provider_factory,
+ sync_api::HttpPostProviderFactory* auth_http_provider_factory) {
DCHECK(MessageLoop::current() == host_->core_thread_.message_loop());
// Make sure that the directory exists before initializing the backend.
@@ -200,8 +187,8 @@ void SyncBackendHost::Core::DoInitialize(
kGaiaServiceId,
kGaiaSourceForChrome,
service_url.SchemeIsSecure(),
- new HttpBridgeFactory(base_request_context_),
- new HttpBridgeFactory(base_request_context_),
+ http_provider_factory,
+ auth_http_provider_factory,
bookmark_model_worker,
attempt_last_user_authentication,
MakeUserAgentForSyncapi().c_str());
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698