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

Side by Side Diff: chrome/browser/profiles/profile_io_data.h

Issue 10174008: Fix up ordering in ProfileIOData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 8 years, 8 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) 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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 6 #define CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 scoped_refptr<ChromeURLRequestContext> GetMediaRequestContext() const; 78 scoped_refptr<ChromeURLRequestContext> GetMediaRequestContext() const;
79 scoped_refptr<ChromeURLRequestContext> GetExtensionsRequestContext() const; 79 scoped_refptr<ChromeURLRequestContext> GetExtensionsRequestContext() const;
80 scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext( 80 scoped_refptr<ChromeURLRequestContext> GetIsolatedAppRequestContext(
81 scoped_refptr<ChromeURLRequestContext> main_context, 81 scoped_refptr<ChromeURLRequestContext> main_context,
82 const std::string& app_id) const; 82 const std::string& app_id) const;
83 83
84 // These are useful when the Chrome layer is called from the content layer 84 // These are useful when the Chrome layer is called from the content layer
85 // with a content::ResourceContext, and they want access to Chrome data for 85 // with a content::ResourceContext, and they want access to Chrome data for
86 // that profile. 86 // that profile.
87 ExtensionInfoMap* GetExtensionInfoMap() const; 87 ExtensionInfoMap* GetExtensionInfoMap() const;
88 HostContentSettingsMap* GetHostContentSettingsMap() const;
89 CookieSettings* GetCookieSettings() const; 88 CookieSettings* GetCookieSettings() const;
90 89
91 #if defined(ENABLE_NOTIFICATIONS) 90 #if defined(ENABLE_NOTIFICATIONS)
92 DesktopNotificationService* GetNotificationService() const; 91 DesktopNotificationService* GetNotificationService() const;
93 #endif 92 #endif
94 93
95 BooleanPrefMember* clear_local_state_on_exit() const { 94 BooleanPrefMember* clear_local_state_on_exit() const {
96 return &clear_local_state_on_exit_; 95 return &clear_local_state_on_exit_;
97 } 96 }
98 97
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ProfileParams(); 134 ProfileParams();
136 ~ProfileParams(); 135 ~ProfileParams();
137 136
138 FilePath path; 137 FilePath path;
139 bool is_incognito; 138 bool is_incognito;
140 bool clear_local_state_on_exit; 139 bool clear_local_state_on_exit;
141 std::string accept_language; 140 std::string accept_language;
142 std::string accept_charset; 141 std::string accept_charset;
143 std::string referrer_charset; 142 std::string referrer_charset;
144 IOThread* io_thread; 143 IOThread* io_thread;
145 scoped_refptr<HostContentSettingsMap> host_content_settings_map;
146 scoped_refptr<CookieSettings> cookie_settings; 144 scoped_refptr<CookieSettings> cookie_settings;
147 scoped_refptr<net::SSLConfigService> ssl_config_service; 145 scoped_refptr<net::SSLConfigService> ssl_config_service;
148 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate; 146 scoped_refptr<net::CookieMonster::Delegate> cookie_monster_delegate;
149 scoped_refptr<ExtensionInfoMap> extension_info_map; 147 scoped_refptr<ExtensionInfoMap> extension_info_map;
150 148
151 #if defined(ENABLE_NOTIFICATIONS) 149 #if defined(ENABLE_NOTIFICATIONS)
152 DesktopNotificationService* notification_service; 150 DesktopNotificationService* notification_service;
153 #endif 151 #endif
154 152
155 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry; 153 scoped_refptr<ProtocolHandlerRegistry> protocol_handler_registry;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 return job_factory_.get(); 208 return job_factory_.get();
211 } 209 }
212 210
213 void set_http_server_properties_manager( 211 void set_http_server_properties_manager(
214 chrome_browser_net::HttpServerPropertiesManager* manager) const; 212 chrome_browser_net::HttpServerPropertiesManager* manager) const;
215 213
216 ChromeURLRequestContext* main_request_context() const { 214 ChromeURLRequestContext* main_request_context() const {
217 return main_request_context_; 215 return main_request_context_;
218 } 216 }
219 217
218 // Destroys the ResourceContext first, to cancel any URLRequests that are
219 // using it still, before we destroy the member variables that those
220 // URLRequests may be accessing.
221 void DestroyResourceContext();
222
220 private: 223 private:
221 class ResourceContext : public content::ResourceContext { 224 class ResourceContext : public content::ResourceContext {
222 public: 225 public:
223 explicit ResourceContext(ProfileIOData* io_data); 226 explicit ResourceContext(ProfileIOData* io_data);
224 virtual ~ResourceContext(); 227 virtual ~ResourceContext();
225 228
229 // ResourceContext implementation:
230 virtual net::HostResolver* GetHostResolver() OVERRIDE;
231 virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
232
226 private: 233 private:
227 friend class ProfileIOData; 234 friend class ProfileIOData;
228 235
229 // ResourceContext implementation:
230 virtual net::HostResolver* GetHostResolver() OVERRIDE;
231 virtual net::URLRequestContext* GetRequestContext() OVERRIDE;
232 void EnsureInitialized(); 236 void EnsureInitialized();
233 237
234 ProfileIOData* const io_data_; 238 ProfileIOData* const io_data_;
235 239
236 net::HostResolver* host_resolver_; 240 net::HostResolver* host_resolver_;
237 net::URLRequestContext* request_context_; 241 net::URLRequestContext* request_context_;
238 }; 242 };
239 243
240 typedef base::hash_map<std::string, scoped_refptr<ChromeURLRequestContext> > 244 typedef base::hash_map<std::string, scoped_refptr<ChromeURLRequestContext> >
241 AppRequestContextMap; 245 AppRequestContextMap;
(...skipping 14 matching lines...) Expand all
256 260
257 // These functions are used to transfer ownership of the lazily initialized 261 // These functions are used to transfer ownership of the lazily initialized
258 // context from ProfileIOData to the URLRequestContextGetter. 262 // context from ProfileIOData to the URLRequestContextGetter.
259 virtual scoped_refptr<ChromeURLRequestContext> 263 virtual scoped_refptr<ChromeURLRequestContext>
260 AcquireMediaRequestContext() const = 0; 264 AcquireMediaRequestContext() const = 0;
261 virtual scoped_refptr<ChromeURLRequestContext> 265 virtual scoped_refptr<ChromeURLRequestContext>
262 AcquireIsolatedAppRequestContext( 266 AcquireIsolatedAppRequestContext(
263 scoped_refptr<ChromeURLRequestContext> main_context, 267 scoped_refptr<ChromeURLRequestContext> main_context,
264 const std::string& app_id) const = 0; 268 const std::string& app_id) const = 0;
265 269
270 // The order *DOES* matter for the majority of these member variables, so
271 // don't move them around unless you know what you're doing!
272 // General rules:
273 // * ResourceContext references the URLRequestContexts, so
274 // URLRequestContexts must outlive ResourceContext, hence ResourceContext
275 // should be destroyed first.
276 // * URLRequestContexts reference a whole bunch of members, so
277 // URLRequestContext needs to be destroyed before them.
278 // * Therefore, ResourceContext should be listed last, and then the
279 // URLRequestContexts, and then the URLRequestContext members.
280 // * Note that URLRequestContext members have a directed dependency graph
281 // too, so they must themselves be ordered correctly.
282
266 // Tracks whether or not we've been lazily initialized. 283 // Tracks whether or not we've been lazily initialized.
267 mutable bool initialized_; 284 mutable bool initialized_;
268 285
269 // Data from the UI thread from the Profile, used to initialize ProfileIOData. 286 // Data from the UI thread from the Profile, used to initialize ProfileIOData.
270 // Deleted after lazy initialization. 287 // Deleted after lazy initialization.
271 mutable scoped_ptr<ProfileParams> profile_params_; 288 mutable scoped_ptr<ProfileParams> profile_params_;
272 289
273 // Member variables which are pointed to by the various context objects. 290 // Member variables which are pointed to by the various context objects.
274 mutable BooleanPrefMember enable_referrers_; 291 mutable BooleanPrefMember enable_referrers_;
275 mutable BooleanPrefMember clear_local_state_on_exit_; 292 mutable BooleanPrefMember clear_local_state_on_exit_;
(...skipping 10 matching lines...) Expand all
286 mutable scoped_ptr<net::ServerBoundCertService> server_bound_cert_service_; 303 mutable scoped_ptr<net::ServerBoundCertService> server_bound_cert_service_;
287 mutable scoped_ptr<net::NetworkDelegate> network_delegate_; 304 mutable scoped_ptr<net::NetworkDelegate> network_delegate_;
288 mutable scoped_ptr<net::FraudulentCertificateReporter> 305 mutable scoped_ptr<net::FraudulentCertificateReporter>
289 fraudulent_certificate_reporter_; 306 fraudulent_certificate_reporter_;
290 mutable scoped_ptr<net::ProxyService> proxy_service_; 307 mutable scoped_ptr<net::ProxyService> proxy_service_;
291 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_; 308 mutable scoped_ptr<net::TransportSecurityState> transport_security_state_;
292 mutable scoped_ptr<net::URLRequestJobFactory> job_factory_; 309 mutable scoped_ptr<net::URLRequestJobFactory> job_factory_;
293 mutable scoped_ptr<chrome_browser_net::HttpServerPropertiesManager> 310 mutable scoped_ptr<chrome_browser_net::HttpServerPropertiesManager>
294 http_server_properties_manager_; 311 http_server_properties_manager_;
295 312
296 // Pointed to by ResourceContext.
297
298 // TODO(willchan): Remove from ResourceContext.
299 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_;
300 mutable scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
301 mutable scoped_refptr<CookieSettings> cookie_settings_;
302
303 #if defined(ENABLE_NOTIFICATIONS) 313 #if defined(ENABLE_NOTIFICATIONS)
304 mutable DesktopNotificationService* notification_service_; 314 mutable DesktopNotificationService* notification_service_;
305 #endif 315 #endif
306 316
307 mutable ResourceContext resource_context_;
308
309 mutable scoped_ptr<TransportSecurityPersister> 317 mutable scoped_ptr<TransportSecurityPersister>
310 transport_security_persister_; 318 transport_security_persister_;
311 319
312 // These are only valid in between LazyInitialize() and their accessor being 320 // These are only valid in between LazyInitialize() and their accessor being
313 // called. 321 // called.
314 mutable scoped_refptr<ChromeURLRequestContext> main_request_context_; 322 mutable scoped_refptr<ChromeURLRequestContext> main_request_context_;
315 mutable scoped_refptr<ChromeURLRequestContext> extensions_request_context_; 323 mutable scoped_refptr<ChromeURLRequestContext> extensions_request_context_;
316 // One AppRequestContext per isolated app. 324 // One AppRequestContext per isolated app.
317 mutable AppRequestContextMap app_request_context_map_; 325 mutable AppRequestContextMap app_request_context_map_;
318 326
327 mutable scoped_ptr<ResourceContext> resource_context_;
328
329 mutable scoped_refptr<ExtensionInfoMap> extension_info_map_;
330 mutable scoped_refptr<CookieSettings> cookie_settings_;
331
319 // TODO(jhawkins): Remove once crbug.com/102004 is fixed. 332 // TODO(jhawkins): Remove once crbug.com/102004 is fixed.
320 bool initialized_on_UI_thread_; 333 bool initialized_on_UI_thread_;
321 334
322 DISALLOW_COPY_AND_ASSIGN(ProfileIOData); 335 DISALLOW_COPY_AND_ASSIGN(ProfileIOData);
323 }; 336 };
324 337
325 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_ 338 #endif // CHROME_BROWSER_PROFILES_PROFILE_IO_DATA_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_impl_io_data.cc ('k') | chrome/browser/profiles/profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698