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

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: Sync with trunk 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 15 matching lines...) Expand all
26 #include "chrome/browser/debugger/devtools_manager.h" 26 #include "chrome/browser/debugger/devtools_manager.h"
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/intranet_redirect_detector.h" 33 #include "chrome/browser/intranet_redirect_detector.h"
34 #include "chrome/browser/io_thread.h" 34 #include "chrome/browser/io_thread.h"
35 #include "chrome/browser/metrics/metrics_service.h" 35 #include "chrome/browser/metrics/metrics_service.h"
36 #include "chrome/browser/net/chrome_net_log.h"
36 #include "chrome/browser/net/predictor_api.h" 37 #include "chrome/browser/net/predictor_api.h"
37 #include "chrome/browser/net/sdch_dictionary_fetcher.h" 38 #include "chrome/browser/net/sdch_dictionary_fetcher.h"
38 #include "chrome/browser/net/sqlite_persistent_cookie_store.h" 39 #include "chrome/browser/net/sqlite_persistent_cookie_store.h"
39 #include "chrome/browser/notifications/notification_ui_manager.h" 40 #include "chrome/browser/notifications/notification_ui_manager.h"
40 #include "chrome/browser/plugin_service.h" 41 #include "chrome/browser/plugin_service.h"
41 #include "chrome/browser/plugin_updater.h" 42 #include "chrome/browser/plugin_updater.h"
42 #include "chrome/browser/prefs/pref_service.h" 43 #include "chrome/browser/prefs/pref_service.h"
43 #include "chrome/browser/printing/print_job_manager.h" 44 #include "chrome/browser/printing/print_job_manager.h"
44 #include "chrome/browser/printing/print_preview_tab_controller.h" 45 #include "chrome/browser/printing/print_preview_tab_controller.h"
45 #include "chrome/browser/profile_manager.h" 46 #include "chrome/browser/profile_manager.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 using_new_frames_(false), 106 using_new_frames_(false),
106 have_inspector_files_(true) { 107 have_inspector_files_(true) {
107 g_browser_process = this; 108 g_browser_process = this;
108 clipboard_.reset(new Clipboard); 109 clipboard_.reset(new Clipboard);
109 main_notification_service_.reset(new NotificationService); 110 main_notification_service_.reset(new NotificationService);
110 111
111 // Must be created after the NotificationService. 112 // Must be created after the NotificationService.
112 print_job_manager_.reset(new printing::PrintJobManager); 113 print_job_manager_.reset(new printing::PrintJobManager);
113 114
114 shutdown_event_.reset(new base::WaitableEvent(true, false)); 115 shutdown_event_.reset(new base::WaitableEvent(true, false));
116
117 net_log_.reset(new ChromeNetLog);
115 } 118 }
116 119
117 BrowserProcessImpl::~BrowserProcessImpl() { 120 BrowserProcessImpl::~BrowserProcessImpl() {
118 FilePath profile_path; 121 FilePath profile_path;
119 bool clear_local_state_on_exit; 122 bool clear_local_state_on_exit;
120 123
121 // Store the profile path for clearing local state data on exit. 124 // Store the profile path for clearing local state data on exit.
122 clear_local_state_on_exit = ShouldClearLocalState(&profile_path); 125 clear_local_state_on_exit = ShouldClearLocalState(&profile_path);
123 126
124 // Delete the AutomationProviderList before NotificationService, 127 // Delete the AutomationProviderList before NotificationService,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 #if defined(USE_X11) 560 #if defined(USE_X11)
558 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so 561 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so
559 // we start it now. 562 // we start it now.
560 scoped_ptr<base::Thread> background_x11_thread( 563 scoped_ptr<base::Thread> background_x11_thread(
561 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11)); 564 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11));
562 if (!background_x11_thread->Start()) 565 if (!background_x11_thread->Start())
563 return; 566 return;
564 background_x11_thread_.swap(background_x11_thread); 567 background_x11_thread_.swap(background_x11_thread);
565 #endif 568 #endif
566 569
567 scoped_ptr<IOThread> thread(new IOThread(local_state())); 570 scoped_ptr<IOThread> thread(new IOThread(local_state(), net_log_.get()));
568 base::Thread::Options options; 571 base::Thread::Options options;
569 options.message_loop_type = MessageLoop::TYPE_IO; 572 options.message_loop_type = MessageLoop::TYPE_IO;
570 if (!thread->StartWithOptions(options)) 573 if (!thread->StartWithOptions(options))
571 return; 574 return;
572 io_thread_.swap(thread); 575 io_thread_.swap(thread);
573 } 576 }
574 577
575 void BrowserProcessImpl::CreateFileThread() { 578 void BrowserProcessImpl::CreateFileThread() {
576 DCHECK(!created_file_thread_ && file_thread_.get() == NULL); 579 DCHECK(!created_file_thread_ && file_thread_.get() == NULL);
577 created_file_thread_ = true; 580 created_file_thread_ = true;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 } 821 }
819 822
820 void BrowserProcessImpl::OnAutoupdateTimer() { 823 void BrowserProcessImpl::OnAutoupdateTimer() {
821 if (CanAutorestartForUpdate()) { 824 if (CanAutorestartForUpdate()) {
822 DLOG(WARNING) << "Detected update. Restarting browser."; 825 DLOG(WARNING) << "Detected update. Restarting browser.";
823 RestartPersistentInstance(); 826 RestartPersistentInstance();
824 } 827 }
825 } 828 }
826 829
827 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 830 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698