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

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

Issue 9150016: Move creation and ownership of ResourceDispatcherHost and PluginService to content. This gives a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
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 // 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
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 SidebarManager* sidebar_manager() OVERRIDE; 71 virtual SidebarManager* sidebar_manager() OVERRIDE;
75 virtual ui::Clipboard* clipboard() OVERRIDE; 72 virtual ui::Clipboard* clipboard() OVERRIDE;
76 virtual net::URLRequestContextGetter* system_request_context() OVERRIDE; 73 virtual net::URLRequestContextGetter* system_request_context() OVERRIDE;
77 #if defined(OS_CHROMEOS) 74 #if defined(OS_CHROMEOS)
78 virtual browser::OomPriorityManager* oom_priority_manager() OVERRIDE; 75 virtual browser::OomPriorityManager* oom_priority_manager() OVERRIDE;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 #endif 118 #endif
122 119
123 virtual ChromeNetLog* net_log() OVERRIDE; 120 virtual ChromeNetLog* net_log() OVERRIDE;
124 virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE; 121 virtual prerender::PrerenderTracker* prerender_tracker() OVERRIDE;
125 virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE; 122 virtual MHTMLGenerationManager* mhtml_generation_manager() OVERRIDE;
126 virtual ComponentUpdateService* component_updater() OVERRIDE; 123 virtual ComponentUpdateService* component_updater() OVERRIDE;
127 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE; 124 virtual CRLSetFetcher* crl_set_fetcher() OVERRIDE;
128 virtual AudioManager* audio_manager() OVERRIDE; 125 virtual AudioManager* audio_manager() OVERRIDE;
129 126
130 private: 127 private:
131 // Must be called right before the IO thread is started.
132 void CreateIOThreadState();
133
134 void CreateResourceDispatcherHost();
135 void CreateMetricsService(); 128 void CreateMetricsService();
136
137 void CreateWatchdogThread(); 129 void CreateWatchdogThread();
138 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
139 void InitializeWebSocketProxyThread(); 131 void InitializeWebSocketProxyThread();
140 #endif 132 #endif
141 void CreateTemplateURLService(); 133 void CreateTemplateURLService();
142 void CreateProfileManager(); 134 void CreateProfileManager();
143 void CreateWebDataService(); 135 void CreateWebDataService();
144 void CreateLocalState(); 136 void CreateLocalState();
145 void CreateViewedPageTracker(); 137 void CreateViewedPageTracker();
146 void CreateIconManager(); 138 void CreateIconManager();
147 void CreateSidebarManager(); 139 void CreateSidebarManager();
148 void CreateGoogleURLTracker(); 140 void CreateGoogleURLTracker();
149 void CreateIntranetRedirectDetector(); 141 void CreateIntranetRedirectDetector();
150 void CreateNotificationUIManager(); 142 void CreateNotificationUIManager();
151 void CreateStatusTrayManager(); 143 void CreateStatusTrayManager();
152 void CreateTabCloseableStateWatcher(); 144 void CreateTabCloseableStateWatcher();
153 void CreatePrintPreviewTabController(); 145 void CreatePrintPreviewTabController();
154 void CreateBackgroundPrintingManager(); 146 void CreateBackgroundPrintingManager();
155 void CreateSafeBrowsingService(); 147 void CreateSafeBrowsingService();
156 void CreateSafeBrowsingDetectionService(); 148 void CreateSafeBrowsingDetectionService();
157 void CreateStatusTray(); 149 void CreateStatusTray();
158 void CreateBackgroundModeManager(); 150 void CreateBackgroundModeManager();
159 151
160 void ApplyDisabledSchemesPolicy(); 152 void ApplyDisabledSchemesPolicy();
161 void ApplyAllowCrossOriginAuthPromptPolicy(); 153 void ApplyAllowCrossOriginAuthPromptPolicy();
162 void ApplyDefaultBrowserPolicy(); 154 void ApplyDefaultBrowserPolicy();
163 155
164 bool created_resource_dispatcher_host_;
165 scoped_ptr<ResourceDispatcherHost> resource_dispatcher_host_;
166
167 bool created_metrics_service_; 156 bool created_metrics_service_;
168 scoped_ptr<MetricsService> metrics_service_; 157 scoped_ptr<MetricsService> metrics_service_;
169 158
170 scoped_ptr<IOThread> io_thread_; 159 scoped_ptr<IOThread> io_thread_;
171 160
172 bool created_watchdog_thread_; 161 bool created_watchdog_thread_;
173 scoped_ptr<WatchDogThread> watchdog_thread_; 162 scoped_ptr<WatchDogThread> watchdog_thread_;
174 163
175 bool created_profile_manager_; 164 bool created_profile_manager_;
176 scoped_ptr<ProfileManager> profile_manager_; 165 scoped_ptr<ProfileManager> profile_manager_;
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 271
283 scoped_refptr<CRLSetFetcher> crl_set_fetcher_; 272 scoped_refptr<CRLSetFetcher> crl_set_fetcher_;
284 #endif 273 #endif
285 274
286 scoped_refptr<AudioManager> audio_manager_; 275 scoped_refptr<AudioManager> audio_manager_;
287 276
288 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl); 277 DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
289 }; 278 };
290 279
291 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_ 280 #endif // CHROME_BROWSER_BROWSER_PROCESS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698