| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 (*i)->MarkAsCleanShutdown(); | 226 (*i)->MarkAsCleanShutdown(); |
| 227 | 227 |
| 228 // Tell the metrics service it was cleanly shutdown. | 228 // Tell the metrics service it was cleanly shutdown. |
| 229 MetricsService* metrics = g_browser_process->metrics_service(); | 229 MetricsService* metrics = g_browser_process->metrics_service(); |
| 230 if (metrics && local_state()) { | 230 if (metrics && local_state()) { |
| 231 metrics->RecordCleanShutdown(); | 231 metrics->RecordCleanShutdown(); |
| 232 | 232 |
| 233 metrics->RecordStartOfSessionEnd(); | 233 metrics->RecordStartOfSessionEnd(); |
| 234 | 234 |
| 235 // MetricsService lazily writes to prefs, force it to write now. | 235 // MetricsService lazily writes to prefs, force it to write now. |
| 236 local_state()->SavePersistentPrefs(file_thread()); | 236 local_state()->SavePersistentPrefs(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 // We must write that the profile and metrics service shutdown cleanly, | 239 // We must write that the profile and metrics service shutdown cleanly, |
| 240 // otherwise on startup we'll think we crashed. So we block until done and | 240 // otherwise on startup we'll think we crashed. So we block until done and |
| 241 // then proceed with normal shutdown. | 241 // then proceed with normal shutdown. |
| 242 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | 242 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
| 243 NewRunnableFunction(PostQuit, MessageLoop::current())); | 243 NewRunnableFunction(PostQuit, MessageLoop::current())); |
| 244 MessageLoop::current()->Run(); | 244 MessageLoop::current()->Run(); |
| 245 } | 245 } |
| 246 | 246 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 profile_manager_.reset(new ProfileManager()); | 345 profile_manager_.reset(new ProfileManager()); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void BrowserProcessImpl::CreateLocalState() { | 348 void BrowserProcessImpl::CreateLocalState() { |
| 349 DCHECK(!created_local_state_ && local_state_.get() == NULL); | 349 DCHECK(!created_local_state_ && local_state_.get() == NULL); |
| 350 created_local_state_ = true; | 350 created_local_state_ = true; |
| 351 | 351 |
| 352 FilePath local_state_path; | 352 FilePath local_state_path; |
| 353 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 353 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
| 354 local_state_.reset(new PrefService(local_state_path)); | 354 local_state_.reset(new PrefService(local_state_path, file_thread())); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void BrowserProcessImpl::InitBrokerServices( | 357 void BrowserProcessImpl::InitBrokerServices( |
| 358 sandbox::BrokerServices* broker_services) { | 358 sandbox::BrokerServices* broker_services) { |
| 359 DCHECK(!initialized_broker_services_ && broker_services_ == NULL); | 359 DCHECK(!initialized_broker_services_ && broker_services_ == NULL); |
| 360 broker_services->Init(); | 360 broker_services->Init(); |
| 361 initialized_broker_services_ = true; | 361 initialized_broker_services_ = true; |
| 362 broker_services_ = broker_services; | 362 broker_services_ = broker_services; |
| 363 } | 363 } |
| 364 | 364 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 390 #else | 390 #else |
| 391 // TODO(port): remove this completely, it has no business being here. | 391 // TODO(port): remove this completely, it has no business being here. |
| 392 #endif | 392 #endif |
| 393 } | 393 } |
| 394 | 394 |
| 395 void BrowserProcessImpl::CreateGoogleURLTracker() { | 395 void BrowserProcessImpl::CreateGoogleURLTracker() { |
| 396 DCHECK(google_url_tracker_.get() == NULL); | 396 DCHECK(google_url_tracker_.get() == NULL); |
| 397 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); | 397 scoped_ptr<GoogleURLTracker> google_url_tracker(new GoogleURLTracker); |
| 398 google_url_tracker_.swap(google_url_tracker); | 398 google_url_tracker_.swap(google_url_tracker); |
| 399 } | 399 } |
| OLD | NEW |