 Chromium Code Reviews
 Chromium Code Reviews Issue 1325063002:
  Componentizing chrome/browser/services/gcm/gcm_desktop_utils.cc.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1325063002:
  Componentizing chrome/browser/services/gcm/gcm_desktop_utils.cc.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| OLD | NEW | 
|---|---|
| 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 "chrome/browser/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <map> | 8 #include <map> | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 102 | 
| 103 #if defined(OS_WIN) | 103 #if defined(OS_WIN) | 
| 104 #include "base/win/windows_version.h" | 104 #include "base/win/windows_version.h" | 
| 105 #include "ui/views/focus/view_storage.h" | 105 #include "ui/views/focus/view_storage.h" | 
| 106 #elif defined(OS_MACOSX) | 106 #elif defined(OS_MACOSX) | 
| 107 #include "chrome/browser/chrome_browser_main_mac.h" | 107 #include "chrome/browser/chrome_browser_main_mac.h" | 
| 108 #endif | 108 #endif | 
| 109 | 109 | 
| 110 #if !defined(OS_ANDROID) | 110 #if !defined(OS_ANDROID) | 
| 111 #include "chrome/browser/chrome_device_client.h" | 111 #include "chrome/browser/chrome_device_client.h" | 
| 112 #include "chrome/browser/services/gcm/gcm_desktop_utils.h" | |
| 113 #include "components/gcm_driver/gcm_client_factory.h" | 112 #include "components/gcm_driver/gcm_client_factory.h" | 
| 113 #include "components/gcm_driver/gcm_desktop_utils.h" | |
| 114 #endif | 114 #endif | 
| 115 | 115 | 
| 116 #if defined(ENABLE_BACKGROUND) | 116 #if defined(ENABLE_BACKGROUND) | 
| 117 #include "chrome/browser/background/background_mode_manager.h" | 117 #include "chrome/browser/background/background_mode_manager.h" | 
| 118 #endif | 118 #endif | 
| 119 | 119 | 
| 120 #if defined(ENABLE_CONFIGURATION_POLICY) | 120 #if defined(ENABLE_CONFIGURATION_POLICY) | 
| 121 #include "components/policy/core/browser/browser_policy_connector.h" | 121 #include "components/policy/core/browser/browser_policy_connector.h" | 
| 122 #else | 122 #else | 
| 123 #include "components/policy/core/common/policy_service_stub.h" | 123 #include "components/policy/core/common/policy_service_stub.h" | 
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1157 | 1157 | 
| 1158 #if defined(OS_ANDROID) | 1158 #if defined(OS_ANDROID) | 
| 1159 // Android's GCMDriver currently makes the assumption that it's a singleton. | 1159 // Android's GCMDriver currently makes the assumption that it's a singleton. | 
| 1160 // Until this gets fixed, instantiating multiple Java GCMDrivers will throw | 1160 // Until this gets fixed, instantiating multiple Java GCMDrivers will throw | 
| 1161 // an exception, but because they're only initialized on demand these crashes | 1161 // an exception, but because they're only initialized on demand these crashes | 
| 1162 // would be very difficult to triage. See http://crbug.com/437827. | 1162 // would be very difficult to triage. See http://crbug.com/437827. | 
| 1163 NOTREACHED(); | 1163 NOTREACHED(); | 
| 1164 #else | 1164 #else | 
| 1165 base::FilePath store_path; | 1165 base::FilePath store_path; | 
| 1166 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); | 1166 CHECK(PathService::Get(chrome::DIR_GLOBAL_GCM_STORE, &store_path)); | 
| 1167 scoped_refptr<base::SequencedWorkerPool> worker_pool( | |
| 
Lei Zhang
2015/09/03 04:53:26
This can just be a base::SequencedWorkerPool* - th
 
Jitu( very slow this week)
2015/09/03 05:31:36
Done.
 
Lei Zhang
2015/09/03 05:56:34
Slightly more natural to write:
Foo* foo = Bar()
 | |
| 1168 content::BrowserThread::GetBlockingPool()); | |
| 1169 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | |
| 1170 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | |
| 1171 worker_pool->GetSequenceToken(), | |
| 1172 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | |
| 1173 | |
| 1167 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 1174 gcm_driver_ = gcm::CreateGCMDriverDesktop( | 
| 1168 make_scoped_ptr(new gcm::GCMClientFactory), | 1175 make_scoped_ptr(new gcm::GCMClientFactory), | 
| 1169 local_state(), | 1176 local_state(), | 
| 1170 store_path, | 1177 store_path, | 
| 1171 system_request_context()); | 1178 system_request_context(), | 
| 1179 chrome::GetChannel(), | |
| 1180 content::BrowserThread::GetMessageLoopProxyForThread( | |
| 1181 content::BrowserThread::UI), | |
| 1182 content::BrowserThread::GetMessageLoopProxyForThread( | |
| 1183 content::BrowserThread::IO), | |
| 1184 blocking_task_runner); | |
| 1172 #endif // defined(OS_ANDROID) | 1185 #endif // defined(OS_ANDROID) | 
| 1173 } | 1186 } | 
| 1174 | 1187 | 
| 1175 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 1188 void BrowserProcessImpl::ApplyDefaultBrowserPolicy() { | 
| 1176 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 1189 if (local_state()->GetBoolean(prefs::kDefaultBrowserSettingEnabled)) { | 
| 1177 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 1190 scoped_refptr<ShellIntegration::DefaultWebClientWorker> | 
| 1178 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 1191 set_browser_worker = new ShellIntegration::DefaultBrowserWorker(NULL); | 
| 1179 set_browser_worker->StartSetAsDefault(); | 1192 set_browser_worker->StartSetAsDefault(); | 
| 1180 } | 1193 } | 
| 1181 } | 1194 } | 
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1255 } | 1268 } | 
| 1256 | 1269 | 
| 1257 void BrowserProcessImpl::OnAutoupdateTimer() { | 1270 void BrowserProcessImpl::OnAutoupdateTimer() { | 
| 1258 if (CanAutorestartForUpdate()) { | 1271 if (CanAutorestartForUpdate()) { | 
| 1259 DLOG(WARNING) << "Detected update. Restarting browser."; | 1272 DLOG(WARNING) << "Detected update. Restarting browser."; | 
| 1260 RestartBackgroundInstance(); | 1273 RestartBackgroundInstance(); | 
| 1261 } | 1274 } | 
| 1262 } | 1275 } | 
| 1263 | 1276 | 
| 1264 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1277 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 
| OLD | NEW |