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

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

Issue 6602004: Trying changes to see the perfomance impact on Mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 9 months 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
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/metrics/thread_watcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/debugger/devtools_manager.h" 25 #include "chrome/browser/debugger/devtools_manager.h"
26 #include "chrome/browser/debugger/devtools_protocol_handler.h" 26 #include "chrome/browser/debugger/devtools_protocol_handler.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/intranet_redirect_detector.h" 32 #include "chrome/browser/intranet_redirect_detector.h"
33 #include "chrome/browser/io_thread.h" 33 #include "chrome/browser/io_thread.h"
34 #include "chrome/browser/metrics/metrics_service.h" 34 #include "chrome/browser/metrics/metrics_service.h"
35 #include "chrome/browser/metrics/thread_watcher.h"
35 #include "chrome/browser/net/chrome_net_log.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/notifications/notification_ui_manager.h" 39 #include "chrome/browser/notifications/notification_ui_manager.h"
39 #include "chrome/browser/plugin_data_remover.h" 40 #include "chrome/browser/plugin_data_remover.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/policy/browser_policy_connector.h" 43 #include "chrome/browser/policy/browser_policy_connector.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"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #endif 91 #endif
91 92
92 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) 93 BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line)
93 : created_resource_dispatcher_host_(false), 94 : created_resource_dispatcher_host_(false),
94 created_metrics_service_(false), 95 created_metrics_service_(false),
95 created_io_thread_(false), 96 created_io_thread_(false),
96 created_file_thread_(false), 97 created_file_thread_(false),
97 created_db_thread_(false), 98 created_db_thread_(false),
98 created_process_launcher_thread_(false), 99 created_process_launcher_thread_(false),
99 created_cache_thread_(false), 100 created_cache_thread_(false),
101 created_watchdog_thread_(false),
100 created_profile_manager_(false), 102 created_profile_manager_(false),
101 created_local_state_(false), 103 created_local_state_(false),
102 created_icon_manager_(false), 104 created_icon_manager_(false),
103 created_devtools_manager_(false), 105 created_devtools_manager_(false),
104 created_sidebar_manager_(false), 106 created_sidebar_manager_(false),
105 created_browser_policy_connector_(false), 107 created_browser_policy_connector_(false),
106 created_notification_ui_manager_(false), 108 created_notification_ui_manager_(false),
107 created_safe_browsing_detection_service_(false), 109 created_safe_browsing_detection_service_(false),
108 module_ref_count_(0), 110 module_ref_count_(0),
109 did_start_(false), 111 did_start_(false),
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // former registers for notifications. 240 // former registers for notifications.
239 tab_closeable_state_watcher_.reset(); 241 tab_closeable_state_watcher_.reset();
240 242
241 // Now OK to destroy NotificationService. 243 // Now OK to destroy NotificationService.
242 main_notification_service_.reset(); 244 main_notification_service_.reset();
243 245
244 // Prior to clearing local state, we want to complete tasks pending 246 // Prior to clearing local state, we want to complete tasks pending
245 // on the db thread too. 247 // on the db thread too.
246 db_thread_.reset(); 248 db_thread_.reset();
247 249
250 // Stop the watchdog thread after stopping other threads.
251 watchdog_thread_.reset();
252
248 // At this point, no render process exist and the file, io, db, and 253 // At this point, no render process exist and the file, io, db, and
249 // webkit threads in this process have all terminated, so it's safe 254 // webkit threads in this process have all terminated, so it's safe
250 // to access local state data such as cookies, database, or local storage. 255 // to access local state data such as cookies, database, or local storage.
251 if (clear_local_state_on_exit) 256 if (clear_local_state_on_exit)
252 ClearLocalState(profile_path); 257 ClearLocalState(profile_path);
253 258
254 g_browser_process = NULL; 259 g_browser_process = NULL;
255 } 260 }
256 261
257 #if defined(OS_WIN) 262 #if defined(OS_WIN)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 #if defined(USE_X11) 388 #if defined(USE_X11)
384 base::Thread* BrowserProcessImpl::background_x11_thread() { 389 base::Thread* BrowserProcessImpl::background_x11_thread() {
385 DCHECK(CalledOnValidThread()); 390 DCHECK(CalledOnValidThread());
386 // The BACKGROUND_X11 thread is created when the IO thread is created. 391 // The BACKGROUND_X11 thread is created when the IO thread is created.
387 if (!created_io_thread_) 392 if (!created_io_thread_)
388 CreateIOThread(); 393 CreateIOThread();
389 return background_x11_thread_.get(); 394 return background_x11_thread_.get();
390 } 395 }
391 #endif 396 #endif
392 397
398 WatchDogThread* BrowserProcessImpl::watchdog_thread() {
399 DCHECK(CalledOnValidThread());
400 if (!created_watchdog_thread_)
401 CreateWatchdogThread();
402 DCHECK(watchdog_thread_.get() != NULL);
403 return watchdog_thread_.get();
404 }
405
393 ProfileManager* BrowserProcessImpl::profile_manager() { 406 ProfileManager* BrowserProcessImpl::profile_manager() {
394 DCHECK(CalledOnValidThread()); 407 DCHECK(CalledOnValidThread());
395 if (!created_profile_manager_) 408 if (!created_profile_manager_)
396 CreateProfileManager(); 409 CreateProfileManager();
397 return profile_manager_.get(); 410 return profile_manager_.get();
398 } 411 }
399 412
400 PrefService* BrowserProcessImpl::local_state() { 413 PrefService* BrowserProcessImpl::local_state() {
401 DCHECK(CalledOnValidThread()); 414 DCHECK(CalledOnValidThread());
402 if (!created_local_state_) 415 if (!created_local_state_)
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 731
719 scoped_ptr<base::Thread> thread( 732 scoped_ptr<base::Thread> thread(
720 new BrowserThread(BrowserThread::CACHE)); 733 new BrowserThread(BrowserThread::CACHE));
721 base::Thread::Options options; 734 base::Thread::Options options;
722 options.message_loop_type = MessageLoop::TYPE_IO; 735 options.message_loop_type = MessageLoop::TYPE_IO;
723 if (!thread->StartWithOptions(options)) 736 if (!thread->StartWithOptions(options))
724 return; 737 return;
725 cache_thread_.swap(thread); 738 cache_thread_.swap(thread);
726 } 739 }
727 740
741 void BrowserProcessImpl::CreateWatchdogThread() {
742 DCHECK(!created_watchdog_thread_ && watchdog_thread_.get() == NULL);
743 created_watchdog_thread_ = true;
744
745 scoped_ptr<WatchDogThread> thread(new WatchDogThread());
746 base::Thread::Options options;
747 options.stack_size = 48*1024;
748 if (!thread->StartWithOptions(options))
749 return;
750 watchdog_thread_.swap(thread);
751 }
752
728 void BrowserProcessImpl::CreateProfileManager() { 753 void BrowserProcessImpl::CreateProfileManager() {
729 DCHECK(!created_profile_manager_ && profile_manager_.get() == NULL); 754 DCHECK(!created_profile_manager_ && profile_manager_.get() == NULL);
730 created_profile_manager_ = true; 755 created_profile_manager_ = true;
731 756
732 profile_manager_.reset(new ProfileManager()); 757 profile_manager_.reset(new ProfileManager());
733 } 758 }
734 759
735 void BrowserProcessImpl::CreateLocalState() { 760 void BrowserProcessImpl::CreateLocalState() {
736 DCHECK(!created_local_state_ && local_state_.get() == NULL); 761 DCHECK(!created_local_state_ && local_state_.get() == NULL);
737 created_local_state_ = true; 762 created_local_state_ = true;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 } 981 }
957 982
958 void BrowserProcessImpl::OnAutoupdateTimer() { 983 void BrowserProcessImpl::OnAutoupdateTimer() {
959 if (CanAutorestartForUpdate()) { 984 if (CanAutorestartForUpdate()) {
960 DLOG(WARNING) << "Detected update. Restarting browser."; 985 DLOG(WARNING) << "Detected update. Restarting browser.";
961 RestartPersistentInstance(); 986 RestartPersistentInstance();
962 } 987 }
963 } 988 }
964 989
965 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) 990 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/browser_process_impl.h ('k') | chrome/browser/metrics/thread_watcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698