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

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: Response to comments Created 10 years, 1 month 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/profile_manager.h" 45 #include "chrome/browser/profile_manager.h"
45 #include "chrome/browser/renderer_host/render_process_host.h" 46 #include "chrome/browser/renderer_host/render_process_host.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 using_new_frames_(false), 105 using_new_frames_(false),
105 have_inspector_files_(true) { 106 have_inspector_files_(true) {
106 g_browser_process = this; 107 g_browser_process = this;
107 clipboard_.reset(new Clipboard); 108 clipboard_.reset(new Clipboard);
108 main_notification_service_.reset(new NotificationService); 109 main_notification_service_.reset(new NotificationService);
109 110
110 // Must be created after the NotificationService. 111 // Must be created after the NotificationService.
111 print_job_manager_.reset(new printing::PrintJobManager); 112 print_job_manager_.reset(new printing::PrintJobManager);
112 113
113 shutdown_event_.reset(new base::WaitableEvent(true, false)); 114 shutdown_event_.reset(new base::WaitableEvent(true, false));
115
116 net_log_.reset(new ChromeNetLog);
114 } 117 }
115 118
116 BrowserProcessImpl::~BrowserProcessImpl() { 119 BrowserProcessImpl::~BrowserProcessImpl() {
117 FilePath profile_path; 120 FilePath profile_path;
118 bool clear_local_state_on_exit; 121 bool clear_local_state_on_exit;
119 122
120 // Store the profile path for clearing local state data on exit. 123 // Store the profile path for clearing local state data on exit.
121 clear_local_state_on_exit = ShouldClearLocalState(&profile_path); 124 clear_local_state_on_exit = ShouldClearLocalState(&profile_path);
122 125
123 // Delete the AutomationProviderList before NotificationService, 126 // Delete the AutomationProviderList before NotificationService,
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 #if defined(USE_X11) 551 #if defined(USE_X11)
549 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so 552 // The lifetime of the BACKGROUND_X11 thread is a subset of the IO thread so
550 // we start it now. 553 // we start it now.
551 scoped_ptr<base::Thread> background_x11_thread( 554 scoped_ptr<base::Thread> background_x11_thread(
552 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11)); 555 new BrowserProcessSubThread(BrowserThread::BACKGROUND_X11));
553 if (!background_x11_thread->Start()) 556 if (!background_x11_thread->Start())
554 return; 557 return;
555 background_x11_thread_.swap(background_x11_thread); 558 background_x11_thread_.swap(background_x11_thread);
556 #endif 559 #endif
557 560
558 scoped_ptr<IOThread> thread(new IOThread); 561 scoped_ptr<IOThread> thread(new IOThread(net_log_.get()));
559 base::Thread::Options options; 562 base::Thread::Options options;
560 options.message_loop_type = MessageLoop::TYPE_IO; 563 options.message_loop_type = MessageLoop::TYPE_IO;
561 if (!thread->StartWithOptions(options)) 564 if (!thread->StartWithOptions(options))
562 return; 565 return;
563 io_thread_.swap(thread); 566 io_thread_.swap(thread);
564 } 567 }
565 568
566 void BrowserProcessImpl::CreateFileThread() { 569 void BrowserProcessImpl::CreateFileThread() {
567 DCHECK(!created_file_thread_ && file_thread_.get() == NULL); 570 DCHECK(!created_file_thread_ && file_thread_.get() == NULL);
568 created_file_thread_ = true; 571 created_file_thread_ = true;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 } 813 }
811 814
812 void BrowserProcessImpl::OnAutoupdateTimer() { 815 void BrowserProcessImpl::OnAutoupdateTimer() {
813 if (CanAutorestartForUpdate()) { 816 if (CanAutorestartForUpdate()) {
814 DLOG(WARNING) << "Detected update. Restarting browser."; 817 DLOG(WARNING) << "Detected update. Restarting browser.";
815 RestartPersistentInstance(); 818 RestartPersistentInstance();
816 } 819 }
817 } 820 }
818 821
819 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 822 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698