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

Side by Side Diff: chrome/browser/sync/startup_controller.cc

Issue 1143343005: chrome/browser: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/sync/startup_controller.h" 5 #include "chrome/browser/sync/startup_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/location.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/single_thread_task_runner.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/thread_task_runner_handle.h"
11 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h" 13 #include "chrome/browser/sync/supervised_user_signin_manager_wrapper.h"
12 #include "chrome/common/chrome_switches.h" 14 #include "chrome/common/chrome_switches.h"
13 #include "components/signin/core/browser/profile_oauth2_token_service.h" 15 #include "components/signin/core/browser/profile_oauth2_token_service.h"
14 #include "components/sync_driver/sync_prefs.h" 16 #include "components/sync_driver/sync_prefs.h"
15 17
16 namespace browser_sync { 18 namespace browser_sync {
17 19
18 namespace { 20 namespace {
19 21
20 // The amount of time we'll wait to initialize sync if no data type triggers 22 // The amount of time we'll wait to initialize sync if no data type triggers
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const bool first_start = start_up_time_.is_null(); 87 const bool first_start = start_up_time_.is_null();
86 if (first_start) 88 if (first_start)
87 start_up_time_ = base::Time::Now(); 89 start_up_time_ = base::Time::Now();
88 90
89 if (deferred_option == STARTUP_BACKEND_DEFERRED && 91 if (deferred_option == STARTUP_BACKEND_DEFERRED &&
90 !base::CommandLine::ForCurrentProcess()->HasSwitch( 92 !base::CommandLine::ForCurrentProcess()->HasSwitch(
91 switches::kSyncDisableDeferredStartup) && 93 switches::kSyncDisableDeferredStartup) &&
92 sync_prefs_->GetPreferredDataTypes(registered_types_) 94 sync_prefs_->GetPreferredDataTypes(registered_types_)
93 .Has(syncer::SESSIONS)) { 95 .Has(syncer::SESSIONS)) {
94 if (first_start) { 96 if (first_start) {
95 base::MessageLoop::current()->PostDelayedTask( 97 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
96 FROM_HERE, 98 FROM_HERE,
97 base::Bind(&StartupController::OnFallbackStartupTimerExpired, 99 base::Bind(&StartupController::OnFallbackStartupTimerExpired,
98 weak_factory_.GetWeakPtr()), fallback_timeout_); 100 weak_factory_.GetWeakPtr()),
101 fallback_timeout_);
99 } 102 }
100 return false; 103 return false;
101 } 104 }
102 105
103 if (start_backend_time_.is_null()) { 106 if (start_backend_time_.is_null()) {
104 start_backend_time_ = base::Time::Now(); 107 start_backend_time_ = base::Time::Now();
105 start_backend_.Run(); 108 start_backend_.Run();
106 first_start_ = false; 109 first_start_ = false;
107 } 110 }
108 111
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 syncer::MODEL_TYPE_COUNT); 233 syncer::MODEL_TYPE_COUNT);
231 UMA_HISTOGRAM_ENUMERATION("Sync.Startup.DeferredInitTrigger", 234 UMA_HISTOGRAM_ENUMERATION("Sync.Startup.DeferredInitTrigger",
232 TRIGGER_DATA_TYPE_REQUEST, 235 TRIGGER_DATA_TYPE_REQUEST,
233 MAX_TRIGGER_VALUE); 236 MAX_TRIGGER_VALUE);
234 } 237 }
235 received_start_request_ = true; 238 received_start_request_ = true;
236 TryStart(); 239 TryStart();
237 } 240 }
238 241
239 } // namespace browser_sync 242 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/profile_sync_test_util.cc ('k') | chrome/browser/sync/sync_stopped_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698