OLD | NEW |
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_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 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 content::ResourceContext* GetResourceContextNoInit() const; | 59 content::ResourceContext* GetResourceContextNoInit() const; |
60 scoped_refptr<ChromeURLRequestContextGetter> | 60 scoped_refptr<ChromeURLRequestContextGetter> |
61 GetMainRequestContextGetter() const; | 61 GetMainRequestContextGetter() const; |
62 scoped_refptr<ChromeURLRequestContextGetter> | 62 scoped_refptr<ChromeURLRequestContextGetter> |
63 GetMediaRequestContextGetter() const; | 63 GetMediaRequestContextGetter() const; |
64 scoped_refptr<ChromeURLRequestContextGetter> | 64 scoped_refptr<ChromeURLRequestContextGetter> |
65 GetExtensionsRequestContextGetter() const; | 65 GetExtensionsRequestContextGetter() const; |
66 scoped_refptr<ChromeURLRequestContextGetter> | 66 scoped_refptr<ChromeURLRequestContextGetter> |
67 GetIsolatedAppRequestContextGetter( | 67 GetIsolatedAppRequestContextGetter( |
68 const std::string& app_id) const; | 68 const std::string& app_id) const; |
| 69 scoped_refptr<ChromeURLRequestContextGetter> |
| 70 GetIsolatedMediaRequestContextGetter( |
| 71 const std::string& app_id) const; |
69 | 72 |
70 void ClearNetworkingHistorySince(base::Time time); | 73 void ClearNetworkingHistorySince(base::Time time); |
71 | 74 |
72 private: | 75 private: |
73 typedef base::hash_map<std::string, | 76 typedef base::hash_map<std::string, |
74 scoped_refptr<ChromeURLRequestContextGetter> > | 77 scoped_refptr<ChromeURLRequestContextGetter> > |
75 ChromeURLRequestContextGetterMap; | 78 ChromeURLRequestContextGetterMap; |
76 | 79 |
77 // Lazily initialize ProfileParams. We do this on the calls to | 80 // Lazily initialize ProfileParams. We do this on the calls to |
78 // Get*RequestContextGetter(), so we only initialize ProfileParams right | 81 // Get*RequestContextGetter(), so we only initialize ProfileParams right |
79 // before posting a task to the IO thread to start using them. This prevents | 82 // before posting a task to the IO thread to start using them. This prevents |
80 // objects that are supposed to be deleted on the IO thread, but are created | 83 // objects that are supposed to be deleted on the IO thread, but are created |
81 // on the UI thread from being unnecessarily initialized. | 84 // on the UI thread from being unnecessarily initialized. |
82 void LazyInitialize() const; | 85 void LazyInitialize() const; |
83 | 86 |
84 // Ordering is important here. Do not reorder unless you know what you're | 87 // Ordering is important here. Do not reorder unless you know what you're |
85 // doing. We need to release |io_data_| *before* the getters, because we | 88 // doing. We need to release |io_data_| *before* the getters, because we |
86 // want to make sure that the last reference for |io_data_| is on the IO | 89 // want to make sure that the last reference for |io_data_| is on the IO |
87 // thread. The getters will be deleted on the IO thread, so they will | 90 // thread. The getters will be deleted on the IO thread, so they will |
88 // release their refs to their contexts, which will release the last refs to | 91 // release their refs to their contexts, which will release the last refs to |
89 // the ProfileIOData on the IO thread. | 92 // the ProfileIOData on the IO thread. |
90 mutable scoped_refptr<ChromeURLRequestContextGetter> | 93 mutable scoped_refptr<ChromeURLRequestContextGetter> |
91 main_request_context_getter_; | 94 main_request_context_getter_; |
92 mutable scoped_refptr<ChromeURLRequestContextGetter> | 95 mutable scoped_refptr<ChromeURLRequestContextGetter> |
93 media_request_context_getter_; | 96 media_request_context_getter_; |
94 mutable scoped_refptr<ChromeURLRequestContextGetter> | 97 mutable scoped_refptr<ChromeURLRequestContextGetter> |
95 extensions_request_context_getter_; | 98 extensions_request_context_getter_; |
96 mutable ChromeURLRequestContextGetterMap app_request_context_getter_map_; | 99 mutable ChromeURLRequestContextGetterMap app_request_context_getter_map_; |
| 100 mutable ChromeURLRequestContextGetterMap |
| 101 isolated_media_request_context_getter_map_; |
97 ProfileImplIOData* const io_data_; | 102 ProfileImplIOData* const io_data_; |
98 | 103 |
99 Profile* const profile_; | 104 Profile* const profile_; |
100 | 105 |
101 mutable bool initialized_; | 106 mutable bool initialized_; |
102 | 107 |
103 DISALLOW_COPY_AND_ASSIGN(Handle); | 108 DISALLOW_COPY_AND_ASSIGN(Handle); |
104 }; | 109 }; |
105 | 110 |
106 private: | 111 private: |
(...skipping 19 matching lines...) Expand all Loading... |
126 HttpTransactionFactoryMap; | 131 HttpTransactionFactoryMap; |
127 | 132 |
128 ProfileImplIOData(); | 133 ProfileImplIOData(); |
129 virtual ~ProfileImplIOData(); | 134 virtual ~ProfileImplIOData(); |
130 | 135 |
131 virtual void LazyInitializeInternal( | 136 virtual void LazyInitializeInternal( |
132 ProfileParams* profile_params) const OVERRIDE; | 137 ProfileParams* profile_params) const OVERRIDE; |
133 virtual ChromeURLRequestContext* InitializeAppRequestContext( | 138 virtual ChromeURLRequestContext* InitializeAppRequestContext( |
134 ChromeURLRequestContext* main_context, | 139 ChromeURLRequestContext* main_context, |
135 const std::string& app_id) const OVERRIDE; | 140 const std::string& app_id) const OVERRIDE; |
| 141 virtual ChromeURLRequestContext* InitializeMediaRequestContext( |
| 142 ChromeURLRequestContext* original_context, |
| 143 const std::string& app_id) const OVERRIDE; |
136 virtual ChromeURLRequestContext* | 144 virtual ChromeURLRequestContext* |
137 AcquireMediaRequestContext() const OVERRIDE; | 145 AcquireMediaRequestContext() const OVERRIDE; |
138 virtual ChromeURLRequestContext* | 146 virtual ChromeURLRequestContext* |
139 AcquireIsolatedAppRequestContext( | 147 AcquireIsolatedAppRequestContext( |
140 ChromeURLRequestContext* main_context, | 148 ChromeURLRequestContext* main_context, |
141 const std::string& app_id) const OVERRIDE; | 149 const std::string& app_id) const OVERRIDE; |
| 150 virtual ChromeURLRequestContext* |
| 151 AcquireIsolatedMediaRequestContext( |
| 152 ChromeURLRequestContext* app_context, |
| 153 const std::string& app_id) const OVERRIDE; |
142 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( | 154 virtual chrome_browser_net::LoadTimeStats* GetLoadTimeStats( |
143 IOThread::Globals* io_thread_globals) const OVERRIDE; | 155 IOThread::Globals* io_thread_globals) const OVERRIDE; |
144 | 156 |
145 void CreateFtpProtocolHandler(net::URLRequestJobFactory* job_factory, | 157 void CreateFtpProtocolHandler(net::URLRequestJobFactory* job_factory, |
146 net::FtpAuthCache* ftp_auth_cache) const; | 158 net::FtpAuthCache* ftp_auth_cache) const; |
147 | 159 |
148 // Clears the networking history since |time|. | 160 // Clears the networking history since |time|. |
149 void ClearNetworkingHistorySinceOnIOThread(base::Time time); | 161 void ClearNetworkingHistorySinceOnIOThread(base::Time time); |
150 | 162 |
151 // Lazy initialization params. | 163 // Lazy initialization params. |
152 mutable scoped_ptr<LazyParams> lazy_params_; | 164 mutable scoped_ptr<LazyParams> lazy_params_; |
153 | 165 |
154 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; | 166 mutable scoped_ptr<net::HttpTransactionFactory> main_http_factory_; |
155 mutable scoped_ptr<net::HttpTransactionFactory> media_http_factory_; | |
156 mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_; | 167 mutable scoped_ptr<net::FtpTransactionFactory> ftp_factory_; |
157 | 168 |
158 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; | 169 mutable scoped_ptr<chrome_browser_net::Predictor> predictor_; |
159 | 170 |
160 mutable scoped_ptr<ChromeURLRequestContext> media_request_context_; | 171 mutable scoped_ptr<ChromeURLRequestContext> media_request_context_; |
161 | 172 |
162 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; | 173 mutable scoped_ptr<net::URLRequestJobFactory> main_job_factory_; |
163 mutable scoped_ptr<net::URLRequestJobFactory> media_request_job_factory_; | 174 mutable scoped_ptr<net::URLRequestJobFactory> media_request_job_factory_; |
164 mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; | 175 mutable scoped_ptr<net::URLRequestJobFactory> extensions_job_factory_; |
165 | 176 |
166 // Parameters needed for isolated apps. | 177 // Parameters needed for isolated apps. |
167 FilePath app_path_; | 178 FilePath app_path_; |
| 179 int app_cache_max_size_; |
| 180 int app_media_cache_max_size_; |
168 | 181 |
169 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); | 182 DISALLOW_COPY_AND_ASSIGN(ProfileImplIOData); |
170 }; | 183 }; |
171 | 184 |
172 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ | 185 #endif // CHROME_BROWSER_PROFILES_PROFILE_IMPL_IO_DATA_H_ |
OLD | NEW |