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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 4118004: Update NetLog to be thread safe. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Add short test description Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <map> 7 #include <map>
8 8
9 #include "app/clipboard/clipboard.h" 9 #include "app/clipboard/clipboard.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 16 matching lines...) Expand all
27 #include "chrome/browser/download/download_file_manager.h" 27 #include "chrome/browser/download/download_file_manager.h"
28 #include "chrome/browser/download/save_file_manager.h" 28 #include "chrome/browser/download/save_file_manager.h"
29 #include "chrome/browser/first_run/first_run.h" 29 #include "chrome/browser/first_run/first_run.h"
30 #include "chrome/browser/google/google_url_tracker.h" 30 #include "chrome/browser/google/google_url_tracker.h"
31 #include "chrome/browser/icon_manager.h" 31 #include "chrome/browser/icon_manager.h"
32 #include "chrome/browser/in_process_webkit/dom_storage_context.h" 32 #include "chrome/browser/in_process_webkit/dom_storage_context.h"
33 #include "chrome/browser/in_process_webkit/indexed_db_context.h" 33 #include "chrome/browser/in_process_webkit/indexed_db_context.h"
34 #include "chrome/browser/intranet_redirect_detector.h" 34 #include "chrome/browser/intranet_redirect_detector.h"
35 #include "chrome/browser/io_thread.h" 35 #include "chrome/browser/io_thread.h"
36 #include "chrome/browser/metrics/metrics_service.h" 36 #include "chrome/browser/metrics/metrics_service.h"
37 #include "chrome/browser/net/chrome_net_log.h"
37 #include "chrome/browser/net/predictor_api.h" 38 #include "chrome/browser/net/predictor_api.h"
38 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 39 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
39 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" 40 #include "chrome/browser/net/sqlite_persistent_cookie_store.h"
40 #include "chrome/browser/notifications/notification_ui_manager.h" 41 #include "chrome/browser/notifications/notification_ui_manager.h"
41 #include "chrome/browser/plugin_service.h" 42 #include "chrome/browser/plugin_service.h"
42 #include "chrome/browser/plugin_updater.h" 43 #include "chrome/browser/plugin_updater.h"
43 #include "chrome/browser/prefs/pref_service.h" 44 #include "chrome/browser/prefs/pref_service.h"
44 #include "chrome/browser/printing/print_job_manager.h" 45 #include "chrome/browser/printing/print_job_manager.h"
45 #include "chrome/browser/printing/print_preview_tab_controller.h" 46 #include "chrome/browser/printing/print_preview_tab_controller.h"
46 #include "chrome/browser/profile_manager.h" 47 #include "chrome/browser/profile_manager.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 using_new_frames_(false), 107 using_new_frames_(false),
107 have_inspector_files_(true) { 108 have_inspector_files_(true) {
108 g_browser_process = this; 109 g_browser_process = this;
109 clipboard_.reset(new Clipboard); 110 clipboard_.reset(new Clipboard);
110 main_notification_service_.reset(new NotificationService); 111 main_notification_service_.reset(new NotificationService);
111 112
112 // Must be created after the NotificationService. 113 // Must be created after the NotificationService.
113 print_job_manager_.reset(new printing::PrintJobManager); 114 print_job_manager_.reset(new printing::PrintJobManager);
114 115
115 shutdown_event_.reset(new base::WaitableEvent(true, false)); 116 shutdown_event_.reset(new base::WaitableEvent(true, false));
117
118 net_log_.reset(new ChromeNetLog);
116 } 119 }
117 120
118 BrowserProcessImpl::~BrowserProcessImpl() { 121 BrowserProcessImpl::~BrowserProcessImpl() {
119 FilePath profile_path; 122 FilePath profile_path;
120 bool clear_local_state_on_exit; 123 bool clear_local_state_on_exit;
121 124
122 // Store the profile path for clearing local state data on exit. 125 // Store the profile path for clearing local state data on exit.
123 clear_local_state_on_exit = ShouldClearLocalState(&profile_path); 126 clear_local_state_on_exit = ShouldClearLocalState(&profile_path);
124 127
125 // Delete the AutomationProviderList before NotificationService, 128 // Delete the AutomationProviderList before NotificationService,
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 #if defined(USE_X11) 562 #if defined(USE_X11)
560 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so 563 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so
561 // we start it now. 564 // we start it now.
562 scoped_ptr<base::Thread> background_x11_thread( 565 scoped_ptr<base::Thread> background_x11_thread(
563 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11)); 566 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11));
564 if (!background_x11_thread->Start()) 567 if (!background_x11_thread->Start())
565 return; 568 return;
566 background_x11_thread_.swap(background_x11_thread); 569 background_x11_thread_.swap(background_x11_thread);
567 #endif 570 #endif
568 571
569 scoped_ptr<IOThread> thread(new IOThread(local_state())); 572 scoped_ptr<IOThread> thread(new IOThread(local_state(), net_log_.get()));
570 base::Thread::Options options; 573 base::Thread::Options options;
571 options.message_loop_type = MessageLoop::TYPE_IO; 574 options.message_loop_type = MessageLoop::TYPE_IO;
572 if (!thread->StartWithOptions(options)) 575 if (!thread->StartWithOptions(options))
573 return; 576 return;
574 io_thread_.swap(thread); 577 io_thread_.swap(thread);
575 } 578 }
576 579
577 void BrowserProcessImpl::CreateFileThread() { 580 void BrowserProcessImpl::CreateFileThread() {
578 DCHECK(!created_file_thread_ && file_thread_.get() == NULL); 581 DCHECK(!created_file_thread_ && file_thread_.get() == NULL);
579 created_file_thread_ = true; 582 created_file_thread_ = true;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 823 }
821 824
822 void BrowserProcessImpl::OnAutoupdateTimer() { 825 void BrowserProcessImpl::OnAutoupdateTimer() {
823 if (CanAutorestartForUpdate()) { 826 if (CanAutorestartForUpdate()) {
824 DLOG(WARNING) << "Detected update. Restarting browser."; 827 DLOG(WARNING) << "Detected update. Restarting browser.";
825 RestartPersistentInstance(); 828 RestartPersistentInstance();
826 } 829 }
827 } 830 }
828 831
829 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 832 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698