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