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 #include "content/browser/worker_host/worker_process_host.h" | 5 #include "content/browser/worker_host/worker_process_host.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | | 244 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | |
245 base::PLATFORM_FILE_WRITE); | 245 base::PLATFORM_FILE_WRITE); |
246 } | 246 } |
247 | 247 |
248 CreateMessageFilters(render_process_id); | 248 CreateMessageFilters(render_process_id); |
249 | 249 |
250 return true; | 250 return true; |
251 } | 251 } |
252 | 252 |
253 void WorkerProcessHost::CreateMessageFilters(int render_process_id) { | 253 void WorkerProcessHost::CreateMessageFilters(int render_process_id) { |
254 // TODO(michaeln): Put ChromeBlobStorageContext in StorageParition too. | |
255 ChromeBlobStorageContext* blob_storage_context = | |
256 content::GetChromeBlobStorageContextForResourceContext( | |
257 resource_context_); | |
258 | |
259 // TODO(michaeln): This is hacky but correct. The request context should be | |
michaeln
2012/09/13 21:47:22
ptal at this part too
awong
2012/09/14 00:09:57
Cleaver. I agree this is a good enough hack until
| |
260 // more directly accessible than digging it out of the appcache service. | |
254 net::URLRequestContext* request_context = | 261 net::URLRequestContext* request_context = |
255 resource_context_->GetRequestContext(); | 262 partition_.appcache_service()->request_context(); |
256 | 263 |
257 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 264 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
258 process_->GetData().id, content::PROCESS_TYPE_WORKER, resource_context_, | 265 process_->GetData().id, content::PROCESS_TYPE_WORKER, resource_context_, |
266 partition_.appcache_service(), | |
267 blob_storage_context, | |
259 new URLRequestContextSelector(request_context)); | 268 new URLRequestContextSelector(request_context)); |
260 process_->GetHost()->AddFilter(resource_message_filter); | 269 process_->GetHost()->AddFilter(resource_message_filter); |
261 | 270 |
262 worker_message_filter_ = new WorkerMessageFilter( | 271 worker_message_filter_ = new WorkerMessageFilter( |
263 render_process_id, resource_context_, partition_, | 272 render_process_id, resource_context_, partition_, |
264 base::Bind(&WorkerServiceImpl::next_worker_route_id, | 273 base::Bind(&WorkerServiceImpl::next_worker_route_id, |
265 base::Unretained(WorkerServiceImpl::GetInstance()))); | 274 base::Unretained(WorkerServiceImpl::GetInstance()))); |
266 process_->GetHost()->AddFilter(worker_message_filter_); | 275 process_->GetHost()->AddFilter(worker_message_filter_); |
267 process_->GetHost()->AddFilter(new AppCacheDispatcherHost( | 276 process_->GetHost()->AddFilter(new AppCacheDispatcherHost( |
268 static_cast<ChromeAppCacheService*>( | 277 partition_.appcache_service(), |
269 ResourceContext::GetAppCacheService(resource_context_)), | |
270 process_->GetData().id)); | 278 process_->GetData().id)); |
271 process_->GetHost()->AddFilter(new FileAPIMessageFilter( | 279 process_->GetHost()->AddFilter(new FileAPIMessageFilter( |
272 process_->GetData().id, | 280 process_->GetData().id, |
273 request_context, | 281 request_context, |
274 partition_.filesystem_context(), | 282 partition_.filesystem_context(), |
275 content::GetChromeBlobStorageContextForResourceContext( | 283 blob_storage_context)); |
276 resource_context_))); | |
277 process_->GetHost()->AddFilter(new FileUtilitiesMessageFilter( | 284 process_->GetHost()->AddFilter(new FileUtilitiesMessageFilter( |
278 process_->GetData().id)); | 285 process_->GetData().id)); |
279 process_->GetHost()->AddFilter(new MimeRegistryMessageFilter()); | 286 process_->GetHost()->AddFilter(new MimeRegistryMessageFilter()); |
280 process_->GetHost()->AddFilter( | 287 process_->GetHost()->AddFilter( |
281 new DatabaseMessageFilter(partition_.database_tracker())); | 288 new DatabaseMessageFilter(partition_.database_tracker())); |
282 | 289 |
283 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 290 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
284 new SocketStreamDispatcherHost(render_process_id, | 291 new SocketStreamDispatcherHost(render_process_id, |
285 new URLRequestContextSelector(request_context), resource_context_); | 292 new URLRequestContextSelector(request_context), resource_context_); |
286 process_->GetHost()->AddFilter(socket_stream_dispatcher_host); | 293 process_->GetHost()->AddFilter(socket_stream_dispatcher_host); |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 } | 708 } |
702 } | 709 } |
703 return false; | 710 return false; |
704 } | 711 } |
705 | 712 |
706 WorkerProcessHost::WorkerInstance::FilterInfo | 713 WorkerProcessHost::WorkerInstance::FilterInfo |
707 WorkerProcessHost::WorkerInstance::GetFilter() const { | 714 WorkerProcessHost::WorkerInstance::GetFilter() const { |
708 DCHECK(NumFilters() == 1); | 715 DCHECK(NumFilters() == 1); |
709 return *filters_.begin(); | 716 return *filters_.begin(); |
710 } | 717 } |
OLD | NEW |