| OLD | NEW |
| 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 // 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_ |
| 11 #define CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 11 #define CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
| 12 #pragma once | 12 #pragma once |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/message_loop.h" | 18 #include "base/message_loop.h" |
| 19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
| 20 #include "base/timer.h" | 20 #include "base/timer.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/prefs/pref_change_registrar.h" | 22 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 23 #include "chrome/browser/prefs/pref_member.h" | 23 #include "chrome/browser/prefs/pref_member.h" |
| 24 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/notification_observer.h" | 25 #include "content/public/browser/notification_observer.h" |
| 25 #include "content/public/browser/notification_registrar.h" | 26 #include "content/public/browser/notification_registrar.h" |
| 26 #include "ipc/ipc_message.h" | 27 #include "ipc/ipc_message.h" |
| 27 | 28 |
| 28 class BrowserOnlineStateObserver; | 29 class BrowserOnlineStateObserver; |
| 29 class ChromeNetLog; | 30 class ChromeNetLog; |
| 30 class ChromeResourceDispatcherHostDelegate; | 31 class ChromeResourceDispatcherHostDelegate; |
| 31 class CommandLine; | 32 class CommandLine; |
| 32 class DevToolsProtocolHandler; | 33 class DevToolsProtocolHandler; |
| 33 class RemoteDebuggingServer; | 34 class RemoteDebuggingServer; |
| 34 class TabCloseableStateWatcher; | 35 class TabCloseableStateWatcher; |
| 35 | 36 |
| 36 namespace policy { | 37 namespace policy { |
| 37 class BrowserPolicyConnector; | 38 class BrowserPolicyConnector; |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 // Real implementation of BrowserProcess that creates and returns the services. | 41 // Real implementation of BrowserProcess that creates and returns the services. |
| 41 class BrowserProcessImpl : public BrowserProcess, | 42 class BrowserProcessImpl : public BrowserProcess, |
| 42 public base::NonThreadSafe, | 43 public base::NonThreadSafe, |
| 43 public content::NotificationObserver { | 44 public content::NotificationObserver { |
| 44 public: | 45 public: |
| 45 explicit BrowserProcessImpl(const CommandLine& command_line); | 46 explicit BrowserProcessImpl(const CommandLine& command_line); |
| 46 virtual ~BrowserProcessImpl(); | 47 virtual ~BrowserProcessImpl(); |
| 47 | 48 |
| 49 // Some of our startup is interleaved with thread creation, driven |
| 50 // by these functions. |
| 51 void PreStartThread(content::BrowserThread::ID identifier); |
| 52 void PostStartThread(content::BrowserThread::ID identifier); |
| 53 |
| 54 // Most cleanup is done by these functions, driven from |
| 55 // ChromeBrowserMain based on notifications from the content |
| 56 // framework, rather than in the destructor, so that we can |
| 57 // interleave cleanup with threads being stopped. |
| 58 void StartTearDown(); |
| 59 void PreStopThread(content::BrowserThread::ID identifier); |
| 60 void PostStopThread(content::BrowserThread::ID identifier); |
| 61 |
| 48 base::Thread* process_launcher_thread(); | 62 base::Thread* process_launcher_thread(); |
| 49 | 63 |
| 50 // BrowserProcess methods | 64 // BrowserProcess methods |
| 51 virtual void EndSession() OVERRIDE; | 65 virtual void EndSession() OVERRIDE; |
| 52 virtual ResourceDispatcherHost* resource_dispatcher_host() OVERRIDE; | 66 virtual ResourceDispatcherHost* resource_dispatcher_host() OVERRIDE; |
| 53 virtual MetricsService* metrics_service() OVERRIDE; | 67 virtual MetricsService* metrics_service() OVERRIDE; |
| 54 virtual IOThread* io_thread() OVERRIDE; | 68 virtual IOThread* io_thread() OVERRIDE; |
| 55 virtual base::Thread* file_thread() OVERRIDE; | 69 virtual base::Thread* file_thread() OVERRIDE; |
| 56 virtual base::Thread* db_thread() OVERRIDE; | 70 virtual base::Thread* db_thread() OVERRIDE; |
| 57 virtual base::Thread* cache_thread() OVERRIDE; | 71 virtual base::Thread* cache_thread() OVERRIDE; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 #endif | 126 #endif |
| 113 | 127 |
| 114 virtual ChromeNetLog* net_log() OVERRIDE; | 128 virtual ChromeNetLog* net_log() OVERRIDE; |
| 115 virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; | 129 virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; |
| 116 virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; | 130 virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; |
| 117 virtual GpuBlacklistUpdater* gpu_blacklist_updater() OVERRIDE; | 131 virtual GpuBlacklistUpdater* gpu_blacklist_updater() OVERRIDE; |
| 118 virtual ComponentUpdateService* component_updater() OVERRIDE; | 132 virtual ComponentUpdateService* component_updater() OVERRIDE; |
| 119 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; | 133 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; |
| 120 | 134 |
| 121 private: | 135 private: |
| 136 // Must be called right before the IO thread is started. |
| 137 void CreateIOThreadState(); |
| 138 |
| 122 void CreateResourceDispatcherHost(); | 139 void CreateResourceDispatcherHost(); |
| 123 void CreateMetricsService(); | 140 void CreateMetricsService(); |
| 124 | 141 |
| 125 void CreateIOThread(); | |
| 126 static void CleanupOnIOThread(); | |
| 127 | |
| 128 void CreateFileThread(); | |
| 129 void CreateDBThread(); | |
| 130 void CreateProcessLauncherThread(); | |
| 131 void CreateCacheThread(); | |
| 132 void CreateGpuThread(); | |
| 133 void CreateWatchdogThread(); | 142 void CreateWatchdogThread(); |
| 134 #if defined(OS_CHROMEOS) | 143 #if defined(OS_CHROMEOS) |
| 135 void CreateWebSocketProxyThread(); | 144 void InitializeWebSocketProxyThread(); |
| 136 #endif | 145 #endif |
| 137 void CreateTemplateURLService(); | 146 void CreateTemplateURLService(); |
| 138 void CreateProfileManager(); | 147 void CreateProfileManager(); |
| 139 void CreateWebDataService(); | 148 void CreateWebDataService(); |
| 140 void CreateLocalState(); | 149 void CreateLocalState(); |
| 141 void CreateViewedPageTracker(); | 150 void CreateViewedPageTracker(); |
| 142 void CreateIconManager(); | 151 void CreateIconManager(); |
| 143 void CreateSidebarManager(); | 152 void CreateSidebarManager(); |
| 144 void CreateGoogleURLTracker(); | 153 void CreateGoogleURLTracker(); |
| 145 void CreateIntranetRedirectDetector(); | 154 void CreateIntranetRedirectDetector(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 156 void ApplyDisabledSchemesPolicy(); | 165 void ApplyDisabledSchemesPolicy(); |
| 157 void ApplyAllowCrossOriginAuthPromptPolicy(); | 166 void ApplyAllowCrossOriginAuthPromptPolicy(); |
| 158 void ApplyDefaultBrowserPolicy(); | 167 void ApplyDefaultBrowserPolicy(); |
| 159 | 168 |
| 160 bool created_resource_dispatcher_host_; | 169 bool created_resource_dispatcher_host_; |
| 161 scoped_ptr<ResourceDispatcherHost> resource_dispatcher_host_; | 170 scoped_ptr<ResourceDispatcherHost> resource_dispatcher_host_; |
| 162 | 171 |
| 163 bool created_metrics_service_; | 172 bool created_metrics_service_; |
| 164 scoped_ptr<MetricsService> metrics_service_; | 173 scoped_ptr<MetricsService> metrics_service_; |
| 165 | 174 |
| 166 bool created_io_thread_; | |
| 167 scoped_ptr<IOThread> io_thread_; | 175 scoped_ptr<IOThread> io_thread_; |
| 168 | 176 |
| 169 bool created_file_thread_; | |
| 170 scoped_ptr<base::Thread> file_thread_; | |
| 171 | |
| 172 bool created_db_thread_; | |
| 173 scoped_ptr<base::Thread> db_thread_; | |
| 174 | |
| 175 bool created_process_launcher_thread_; | |
| 176 scoped_ptr<base::Thread> process_launcher_thread_; | |
| 177 | |
| 178 bool created_cache_thread_; | |
| 179 scoped_ptr<base::Thread> cache_thread_; | |
| 180 | |
| 181 bool created_watchdog_thread_; | 177 bool created_watchdog_thread_; |
| 182 scoped_ptr<WatchDogThread> watchdog_thread_; | 178 scoped_ptr<WatchDogThread> watchdog_thread_; |
| 183 | 179 |
| 184 #if defined(OS_CHROMEOS) | |
| 185 bool created_web_socket_proxy_thread_; | |
| 186 scoped_ptr<base::Thread> web_socket_proxy_thread_; | |
| 187 #endif | |
| 188 | |
| 189 bool created_profile_manager_; | 180 bool created_profile_manager_; |
| 190 scoped_ptr<ProfileManager> profile_manager_; | 181 scoped_ptr<ProfileManager> profile_manager_; |
| 191 | 182 |
| 192 bool created_local_state_; | 183 bool created_local_state_; |
| 193 scoped_ptr<PrefService> local_state_; | 184 scoped_ptr<PrefService> local_state_; |
| 194 | 185 |
| 195 bool created_icon_manager_; | 186 bool created_icon_manager_; |
| 196 scoped_ptr<IconManager> icon_manager_; | 187 scoped_ptr<IconManager> icon_manager_; |
| 197 | 188 |
| 198 scoped_refptr<ExtensionEventRouterForwarder> | 189 scoped_refptr<ExtensionEventRouterForwarder> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; | 258 scoped_ptr<prerender::PrerenderTracker> prerender_tracker_; |
| 268 | 259 |
| 269 scoped_ptr<ChromeResourceDispatcherHostDelegate> | 260 scoped_ptr<ChromeResourceDispatcherHostDelegate> |
| 270 resource_dispatcher_host_delegate_; | 261 resource_dispatcher_host_delegate_; |
| 271 | 262 |
| 272 content::NotificationRegistrar notification_registrar_; | 263 content::NotificationRegistrar notification_registrar_; |
| 273 | 264 |
| 274 scoped_refptr<MHTMLGenerationManager> mhtml_generation_manager_; | 265 scoped_refptr<MHTMLGenerationManager> mhtml_generation_manager_; |
| 275 | 266 |
| 276 // Monitors the state of the 'DisablePluginFinder' policy. | 267 // Monitors the state of the 'DisablePluginFinder' policy. |
| 277 BooleanPrefMember plugin_finder_disabled_pref_; | 268 scoped_ptr<BooleanPrefMember> plugin_finder_disabled_pref_; |
| 278 | 269 |
| 279 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 270 #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| 280 base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; | 271 base::RepeatingTimer<BrowserProcessImpl> autoupdate_timer_; |
| 281 | 272 |
| 282 // Gets called by autoupdate timer to see if browser needs restart and can be | 273 // Gets called by autoupdate timer to see if browser needs restart and can be |
| 283 // restarted, and if that's the case, restarts the browser. | 274 // restarted, and if that's the case, restarts the browser. |
| 284 void OnAutoupdateTimer(); | 275 void OnAutoupdateTimer(); |
| 285 bool CanAutorestartForUpdate() const; | 276 bool CanAutorestartForUpdate() const; |
| 286 void RestartBackgroundInstance(); | 277 void RestartBackgroundInstance(); |
| 287 #endif // defined(OS_WIN) || defined(OS_LINUX) | 278 #endif // defined(OS_WIN) || defined(OS_LINUX) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 298 #if !defined(OS_CHROMEOS) | 289 #if !defined(OS_CHROMEOS) |
| 299 scoped_ptr<ComponentUpdateService> component_updater_; | 290 scoped_ptr<ComponentUpdateService> component_updater_; |
| 300 | 291 |
| 301 scoped_refptr<CRLSetFetcher> crl_set_fetcher_; | 292 scoped_refptr<CRLSetFetcher> crl_set_fetcher_; |
| 302 #endif | 293 #endif |
| 303 | 294 |
| 304 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); | 295 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); |
| 305 }; | 296 }; |
| 306 | 297 |
| 307 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ | 298 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ |
| OLD | NEW |