Chromium Code Reviews| 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 #include "content/browser/resource_context.h" | 5 #include "content/browser/resource_context.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/plugin_process_host.h" | 8 #include "content/browser/plugin_process_host.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "webkit/database/database_tracker.h" | 10 #include "webkit/database/database_tracker.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 ResourceContext::ResourceContext() | 14 ResourceContext::ResourceContext() |
| 15 : host_resolver_(NULL), | 15 : host_resolver_(NULL), |
| 16 request_context_(NULL), | 16 request_context_(NULL), |
| 17 appcache_service_(NULL), | 17 appcache_service_(NULL), |
| 18 database_tracker_(NULL), | 18 database_tracker_(NULL), |
| 19 file_system_context_(NULL), | 19 file_system_context_(NULL), |
| 20 blob_storage_context_(NULL), | 20 blob_storage_context_(NULL), |
| 21 quota_manager_(NULL), | 21 quota_manager_(NULL), |
| 22 host_zoom_map_(NULL), | 22 host_zoom_map_(NULL), |
| 23 media_observer_(NULL), | 23 media_observer_(NULL), |
| 24 media_stream_manager_(NULL) { | 24 download_id_factory_(NULL), |
| 25 media_stream_manager_(NULL), | |
| 26 audio_manager_(NULL) { | |
| 25 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 27 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 26 } | 28 } |
| 27 | 29 |
| 28 ResourceContext::~ResourceContext() { | 30 ResourceContext::~ResourceContext() { |
| 29 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { | 31 if (BrowserThread::IsMessageLoopValid(BrowserThread::IO)) { |
| 30 // Band-aid for http://crbug.com/94704 until we change plug-in channel | 32 // Band-aid for http://crbug.com/94704 until we change plug-in channel |
| 31 // requests to be owned by the ResourceContext. | 33 // requests to be owned by the ResourceContext. |
| 32 PluginProcessHost::CancelPendingRequestsForResourceContext(this); | 34 PluginProcessHost::CancelPendingRequestsForResourceContext(this); |
| 33 } | 35 } |
| 34 } | 36 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 void ResourceContext::set_media_observer(MediaObserver* media_observer) { | 153 void ResourceContext::set_media_observer(MediaObserver* media_observer) { |
| 152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 154 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 153 media_observer_ = media_observer; | 155 media_observer_ = media_observer; |
| 154 } | 156 } |
| 155 | 157 |
| 156 DownloadIdFactory* ResourceContext::download_id_factory() const { | 158 DownloadIdFactory* ResourceContext::download_id_factory() const { |
| 157 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 158 EnsureInitialized(); | 160 EnsureInitialized(); |
| 159 return download_id_factory_; | 161 return download_id_factory_; |
| 160 } | 162 } |
| 163 | |
| 161 void ResourceContext::set_download_id_factory( | 164 void ResourceContext::set_download_id_factory( |
| 162 DownloadIdFactory* download_id_factory) { | 165 DownloadIdFactory* download_id_factory) { |
| 163 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 164 download_id_factory_ = download_id_factory; | 167 download_id_factory_ = download_id_factory; |
| 165 } | 168 } |
| 166 | 169 |
| 167 media_stream::MediaStreamManager* | 170 media_stream::MediaStreamManager* |
| 168 ResourceContext::media_stream_manager() const { | 171 ResourceContext::media_stream_manager() const { |
| 169 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 170 EnsureInitialized(); | 173 EnsureInitialized(); |
| 171 return media_stream_manager_; | 174 return media_stream_manager_; |
| 172 } | 175 } |
| 173 | 176 |
| 174 void ResourceContext::set_media_stream_manager( | 177 void ResourceContext::set_media_stream_manager( |
| 175 media_stream::MediaStreamManager* media_stream_manager) { | 178 media_stream::MediaStreamManager* media_stream_manager) { |
| 176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 177 media_stream_manager_ = media_stream_manager; | 180 media_stream_manager_ = media_stream_manager; |
| 178 } | 181 } |
| 179 | 182 |
| 183 AudioManager* ResourceContext::audio_manager() const { | |
| 184 // The AudioManager isn't necessarily initialized with other | |
|
willchan no longer on Chromium
2011/12/06 17:02:12
Can you explain this comment? When is AudioManager
tommi (sloooow) - chröme
2011/12/06 20:28:48
Sorry, this comment isn't correct. I must have for
willchan no longer on Chromium
2011/12/07 15:29:20
I see. While it's not strictly a problem, it's dif
| |
| 185 // resource context variables, so if we already have one, we can still | |
| 186 // delay initializing the other ones. | |
| 187 if (!audio_manager_) | |
| 188 EnsureInitialized(); | |
| 189 return audio_manager_; | |
| 190 } | |
| 191 | |
| 192 void ResourceContext::set_audio_manager(AudioManager* audio_manager) { | |
| 193 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 194 audio_manager_ = audio_manager; | |
| 195 } | |
| 196 | |
| 180 } // namespace content | 197 } // namespace content |
| OLD | NEW |