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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/hash_tables.h" | 11 #include "base/hash_tables.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "chrome/browser/profiles/profile_io_data.h" | 13 #include "chrome/browser/profiles/profile_io_data.h" |
14 | 14 |
15 namespace chrome_browser_net { | |
16 class Predictor; | |
17 } | |
18 | |
15 namespace net { | 19 namespace net { |
16 class HttpTransactionFactory; | 20 class HttpTransactionFactory; |
17 } // namespace net | 21 } // namespace net |
18 | 22 |
19 class ProfileImplIOData : public ProfileIOData { | 23 class ProfileImplIOData : public ProfileIOData { |
20 public: | 24 public: |
21 class Handle { | 25 class Handle { |
22 public: | 26 public: |
23 explicit Handle(Profile* profile); | 27 explicit Handle(Profile* profile); |
24 ~Handle(); | 28 ~Handle(); |
25 | 29 |
26 bool HasMainRequestContext() const { | 30 bool HasMainRequestContext() const { |
27 return main_request_context_getter_ != NULL; | 31 return main_request_context_getter_ != NULL; |
28 } | 32 } |
29 | 33 |
30 // Init() must be called before ~Handle(). It records all the necessary | 34 // Init() must be called before ~Handle(). It records all the necessary |
31 // parameters needed to construct a ChromeURLRequestContextGetter. | 35 // parameters needed to construct a ChromeURLRequestContextGetter. |
32 void Init(const FilePath& cookie_path, | 36 void Init(const FilePath& cookie_path, |
33 const FilePath& cache_path, | 37 const FilePath& cache_path, |
34 int cache_max_size, | 38 int cache_max_size, |
35 const FilePath& media_cache_path, | 39 const FilePath& media_cache_path, |
36 int media_cache_max_size, | 40 int media_cache_max_size, |
37 const FilePath& extensions_cookie_path, | 41 const FilePath& extensions_cookie_path, |
38 const FilePath& app_path); | 42 const FilePath& app_path, |
43 chrome_browser_net::Predictor* predictor); | |
39 | 44 |
40 base::Callback<ChromeURLDataManagerBackend*(void)> | 45 base::Callback<ChromeURLDataManagerBackend*(void)> |
41 GetChromeURLDataManagerBackendGetter() const; | 46 GetChromeURLDataManagerBackendGetter() const; |
42 const content::ResourceContext& GetResourceContext() const; | 47 const content::ResourceContext& GetResourceContext() const; |
43 scoped_refptr<ChromeURLRequestContextGetter> | 48 scoped_refptr<ChromeURLRequestContextGetter> |
44 GetMainRequestContextGetter() const; | 49 GetMainRequestContextGetter() const; |
45 scoped_refptr<ChromeURLRequestContextGetter> | 50 scoped_refptr<ChromeURLRequestContextGetter> |
46 GetMediaRequestContextGetter() const; | 51 GetMediaRequestContextGetter() const; |
47 scoped_refptr<ChromeURLRequestContextGetter> | 52 scoped_refptr<ChromeURLRequestContextGetter> |
48 GetExtensionsRequestContextGetter() const; | 53 GetExtensionsRequestContextGetter() const; |
49 scoped_refptr<ChromeURLRequestContextGetter> | 54 scoped_refptr<ChromeURLRequestContextGetter> |
50 GetIsolatedAppRequestContextGetter( | 55 GetIsolatedAppRequestContextGetter( |
51 const std::string& app_id) const; | 56 const std::string& app_id) const; |
52 | 57 |
58 chrome_browser_net::Predictor* GetNetworkPredictor(); | |
willchan no longer on Chromium
2011/08/10 07:04:08
Where is this used? Is it needed? If it's not, I s
rpetterson
2011/08/12 03:12:36
You're right. Now that ProfileImpl has a weak poin
| |
59 | |
53 private: | 60 private: |
54 typedef base::hash_map<std::string, | 61 typedef base::hash_map<std::string, |
55 scoped_refptr<ChromeURLRequestContextGetter> > | 62 scoped_refptr<ChromeURLRequestContextGetter> > |
56 ChromeURLRequestContextGetterMap; | 63 ChromeURLRequestContextGetterMap; |
57 | 64 |
58 // Lazily initialize ProfileParams. We do this on the calls to | 65 // Lazily initialize ProfileParams. We do this on the calls to |
59 // Get*RequestContextGetter(), so we only initialize ProfileParams right | 66 // Get*RequestContextGetter(), so we only initialize ProfileParams right |
60 // before posting a task to the IO thread to start using them. This prevents | 67 // before posting a task to the IO thread to start using them. This prevents |
61 // objects that are supposed to be deleted on the IO thread, but are created | 68 // objects that are supposed to be deleted on the IO thread, but are created |
62 // on the UI thread from being unnecessarily initialized. | 69 // on the UI thread from being unnecessarily initialized. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 int media_cache_max_size; | 106 int media_cache_max_size; |
100 FilePath extensions_cookie_path; | 107 FilePath extensions_cookie_path; |
101 }; | 108 }; |
102 | 109 |
103 typedef base::hash_map<std::string, net::HttpTransactionFactory* > | 110 typedef base::hash_map<std::string, net::HttpTransactionFactory* > |
104 HttpTransactionFactoryMap; | 111 HttpTransactionFactoryMap; |
105 | 112 |
106 ProfileImplIOData(); | 113 ProfileImplIOData(); |
107 virtual ~ProfileImplIOData(); | 114 virtual ~ProfileImplIOData(); |
108 | 115 |
116 // The profile_io_data_ owns this predictor. | |
117 chrome_browser_net::Predictor* GetNetworkPredictor(); | |
118 | |
109 virtual void LazyInitializeInternal(ProfileParams* profile_params) const; | 119 virtual void LazyInitializeInternal(ProfileParams* profile_params) const; |
110 virtual scoped_refptr<ChromeURLRequestContext> InitializeAppRequestContext( | 120 virtual scoped_refptr<ChromeURLRequestContext> InitializeAppRequestContext( |
111 scoped_refptr<ChromeURLRequestContext> main_context, | 121 scoped_refptr<ChromeURLRequestContext> main_context, |
112 const std::string& app_id) const; | 122 const std::string& app_id) const; |
113 virtual scoped_refptr<ChromeURLRequestContext> | 123 virtual scoped_refptr<ChromeURLRequestContext> |
114 AcquireMediaRequestContext() const; | 124 AcquireMediaRequestContext() const; |
115 virtual scoped_refptr<ChromeURLRequestContext> | 125 virtual scoped_refptr<ChromeURLRequestContext> |
116 AcquireIsolatedAppRequestContext( | 126 AcquireIsolatedAppRequestContext( |
117 scoped_refptr<ChromeURLRequestContext> main_context, | 127 scoped_refptr<ChromeURLRequestContext> main_context, |
118 const std::string& app_id) const; | 128 const std::string& app_id) const; |
119 | 129 |
120 // Lazy initialization params. | 130 // Lazy initialization params. |
121 mutable scoped_ptr<LazyParams> lazy_params_; | 131 mutable scoped_ptr<LazyParams> lazy_params_; |
122 | 132 |
123 mutable scoped_refptr<ChromeURLRequestContext> media_request_context_; | 133 mutable scoped_refptr<ChromeURLRequestContext> media_request_context_; |
124 | 134 |
125 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 135 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
126 mutable scoped_ptr<net::HttpTransactionFactory> media_http_factory_; | 136 mutable scoped_ptr<net::HttpTransactionFactory> media_http_factory_; |
127 | 137 |
138 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; | |
139 | |
128 // Parameters needed for isolated apps. | 140 // Parameters needed for isolated apps. |
129 FilePath app_path_; | 141 FilePath app_path_; |
130 mutable bool clear_local_state_on_exit_; | 142 mutable bool clear_local_state_on_exit_; |
131 | 143 |
132 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 144 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
133 }; | 145 }; |
134 | 146 |
135 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 147 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |