| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // When each service is created, we set a flag indicating this. At this point, | 5 // When each service is created, we set a flag indicating this. At this point, |
| 6 // the service initialization could fail or succeed. This allows us to remember | 6 // the service initialization could fail or succeed. This allows us to remember |
| 7 // if we tried to create a service, and not try creating it over and over if | 7 // if we tried to create a service, and not try creating it over and over if |
| 8 // the creation failed. | 8 // the creation failed. |
| 9 | 9 |
| 10 #ifndef CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 10 #ifndef CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 // Real implementation of BrowserProcess that creates and returns the services. | 40 // Real implementation of BrowserProcess that creates and returns the services. |
| 41 class BrowserProcessImpl : public BrowserProcess, | 41 class BrowserProcessImpl : public BrowserProcess, |
| 42 public base::NonThreadSafe, | 42 public base::NonThreadSafe, |
| 43 public content::NotificationObserver { | 43 public content::NotificationObserver { |
| 44 public: | 44 public: |
| 45 explicit BrowserProcessImpl(const CommandLine& command_line); | 45 explicit BrowserProcessImpl(const CommandLine& command_line); |
| 46 virtual ~BrowserProcessImpl(); | 46 virtual ~BrowserProcessImpl(); |
| 47 | 47 |
| 48 // Some of our startup is interleaved with thread creation, driven | 48 // Called before the browser threads are created. |
| 49 // by these functions. | 49 void PreCreateThreads(); |
| 50 void PreStartThread(content::BrowserThread::ID identifier); | |
| 51 void PostStartThread(content::BrowserThread::ID identifier); | |
| 52 | 50 |
| 53 // Called after the threads have been created but before the message loops | 51 // Called after the threads have been created but before the message loops |
| 54 // starts running. Allows the browser process to do any initialization that | 52 // starts running. Allows the browser process to do any initialization that |
| 55 // requires all threads running. | 53 // requires all threads running. |
| 56 void PreMainMessageLoopRun(); | 54 void PreMainMessageLoopRun(); |
| 57 | 55 |
| 58 // Most cleanup is done by these functions, driven from | 56 // Most cleanup is done by these functions, driven from |
| 59 // ChromeBrowserMain based on notifications from the content | 57 // ChromeBrowserMain based on notifications from the content |
| 60 // framework, rather than in the destructor, so that we can | 58 // framework, rather than in the destructor, so that we can |
| 61 // interleave cleanup with threads being stopped. | 59 // interleave cleanup with threads being stopped. |
| 62 void StartTearDown(); | 60 void StartTearDown(); |
| 63 void PreStopThread(content::BrowserThread::ID identifier); | 61 void PostDestroyThreads(); |
| 64 void PostStopThread(content::BrowserThread::ID identifier); | |
| 65 | 62 |
| 66 // BrowserProcess methods | 63 // BrowserProcess methods |
| 64 virtual void ResourceDispatcherHostCreated() OVERRIDE; |
| 67 virtual void EndSession() OVERRIDE; | 65 virtual void EndSession() OVERRIDE; |
| 68 virtual ResourceDispatcherHost* resource_dispatcher_host() OVERRIDE; | |
| 69 virtual MetricsService* metrics_service() OVERRIDE; | 66 virtual MetricsService* metrics_service() OVERRIDE; |
| 70 virtual IOThread* io_thread() OVERRIDE; | 67 virtual IOThread* io_thread() OVERRIDE; |
| 71 virtual WatchDogThread* watchdog_thread() OVERRIDE; | 68 virtual WatchDogThread* watchdog_thread() OVERRIDE; |
| 72 virtual ProfileManager* profile_manager() OVERRIDE; | 69 virtual ProfileManager* profile_manager() OVERRIDE; |
| 73 virtual PrefService* local_state() OVERRIDE; | 70 virtual PrefService* local_state() OVERRIDE; |
| 74 virtual ui::Clipboard* clipboard() OVERRIDE; | 71 virtual ui::Clipboard* clipboard() OVERRIDE; |
| 75 virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; | 72 virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; |
| 76 #if defined(OS_CHROMEOS) | 73 #if defined(OS_CHROMEOS) |
| 77 virtual browser::OomPriorityManager* oom_priority_manager() OVERRIDE; | 74 virtual browser::OomPriorityManager* oom_priority_manager() OVERRIDE; |
| 78 #endif // defined(OS_CHROMEOS) | 75 #endif // defined(OS_CHROMEOS) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #endif | 117 #endif |
| 121 | 118 |
| 122 virtual ChromeNetLog* net_log() OVERRIDE; | 119 virtual ChromeNetLog* net_log() OVERRIDE; |
| 123 virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; | 120 virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; |
| 124 virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; | 121 virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; |
| 125 virtual ComponentUpdateService* component_updater() OVERRIDE; | 122 virtual ComponentUpdateService* component_updater() OVERRIDE; |
| 126 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; | 123 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; |
| 127 virtual AudioManager* audio_manager() OVERRIDE; | 124 virtual AudioManager* audio_manager() OVERRIDE; |
| 128 | 125 |
| 129 private: | 126 private: |
| 130 // Must be called right before the IO thread is started. | |
| 131 void CreateIOThreadState(); | |
| 132 | |
| 133 void CreateResourceDispatcherHost(); | |
| 134 void CreateMetricsService(); | 127 void CreateMetricsService(); |
| 135 | |
| 136 void CreateWatchdogThread(); | 128 void CreateWatchdogThread(); |
| 137 #if defined(OS_CHROMEOS) | 129 #if defined(OS_CHROMEOS) |
| 138 void InitializeWebSocketProxyThread(); | 130 void InitializeWebSocketProxyThread(); |
| 139 #endif | 131 #endif |
| 140 void CreateTemplateURLService(); | 132 void CreateTemplateURLService(); |
| 141 void CreateProfileManager(); | 133 void CreateProfileManager(); |
| 142 void CreateWebDataService(); | 134 void CreateWebDataService(); |
| 143 void CreateLocalState(); | 135 void CreateLocalState(); |
| 144 void CreateViewedPageTracker(); | 136 void CreateViewedPageTracker(); |
| 145 void CreateIconManager(); | 137 void CreateIconManager(); |
| 146 void CreateGoogleURLTracker(); | 138 void CreateGoogleURLTracker(); |
| 147 void CreateIntranetRedirectDetector(); | 139 void CreateIntranetRedirectDetector(); |
| 148 void CreateNotificationUIManager(); | 140 void CreateNotificationUIManager(); |
| 149 void CreateStatusTrayManager(); | 141 void CreateStatusTrayManager(); |
| 150 void CreateTabCloseableStateWatcher(); | 142 void CreateTabCloseableStateWatcher(); |
| 151 void CreatePrintPreviewTabController(); | 143 void CreatePrintPreviewTabController(); |
| 152 void CreateBackgroundPrintingManager(); | 144 void CreateBackgroundPrintingManager(); |
| 153 void CreateSafeBrowsingService(); | 145 void CreateSafeBrowsingService(); |
| 154 void CreateSafeBrowsingDetectionService(); | 146 void CreateSafeBrowsingDetectionService(); |
| 155 void CreateStatusTray(); | 147 void CreateStatusTray(); |
| 156 void CreateBackgroundModeManager(); | 148 void CreateBackgroundModeManager(); |
| 157 | 149 |
| 158 void ApplyDisabledSchemesPolicy(); | 150 void ApplyDisabledSchemesPolicy(); |
| 159 void ApplyAllowCrossOriginAuthPromptPolicy(); | 151 void ApplyAllowCrossOriginAuthPromptPolicy(); |
| 160 void ApplyDefaultBrowserPolicy(); | 152 void ApplyDefaultBrowserPolicy(); |
| 161 | 153 |
| 162 bool created_resource_dispatcher_host_; | |
| 163 scoped_ptr<ResourceDispatcherHost> resource_dispatcher_host_; | |
| 164 | |
| 165 bool created_metrics_service_; | 154 bool created_metrics_service_; |
| 166 scoped_ptr<MetricsService> metrics_service_; | 155 scoped_ptr<MetricsService> metrics_service_; |
| 167 | 156 |
| 168 scoped_ptr<IOThread> io_thread_; | 157 scoped_ptr<IOThread> io_thread_; |
| 169 | 158 |
| 170 bool created_watchdog_thread_; | 159 bool created_watchdog_thread_; |
| 171 scoped_ptr<WatchDogThread> watchdog_thread_; | 160 scoped_ptr<WatchDogThread> watchdog_thread_; |
| 172 | 161 |
| 173 bool created_profile_manager_; | 162 bool created_profile_manager_; |
| 174 scoped_ptr<ProfileManager> profile_manager_; | 163 scoped_ptr<ProfileManager> profile_manager_; |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 266 |
| 278 scoped_refptr<CRLSetFetcher> crl_set_fetcher_; | 267 scoped_refptr<CRLSetFetcher> crl_set_fetcher_; |
| 279 #endif | 268 #endif |
| 280 | 269 |
| 281 scoped_refptr<AudioManager> audio_manager_; | 270 scoped_refptr<AudioManager> audio_manager_; |
| 282 | 271 |
| 283 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); | 272 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); |
| 284 }; | 273 }; |
| 285 | 274 |
| 286 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 275 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
| OLD | NEW |