| 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 ChromeBlobStorageContext* blob_storage_context = |
| 255 content::GetChromeBlobStorageContextForResourceContext( |
| 256 resource_context_); |
| 257 |
| 258 // TODO(michaeln): This is hacky but correct. The request context should be |
| 259 // more directly accessible than digging it out of the appcache service. |
| 254 net::URLRequestContext* request_context = | 260 net::URLRequestContext* request_context = |
| 255 resource_context_->GetRequestContext(); | 261 partition_.appcache_service()->request_context(); |
| 256 | 262 |
| 257 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 263 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
| 258 process_->GetData().id, content::PROCESS_TYPE_WORKER, resource_context_, | 264 process_->GetData().id, content::PROCESS_TYPE_WORKER, resource_context_, |
| 265 partition_.appcache_service(), |
| 266 blob_storage_context, |
| 259 new URLRequestContextSelector(request_context)); | 267 new URLRequestContextSelector(request_context)); |
| 260 process_->GetHost()->AddFilter(resource_message_filter); | 268 process_->GetHost()->AddFilter(resource_message_filter); |
| 261 | 269 |
| 262 worker_message_filter_ = new WorkerMessageFilter( | 270 worker_message_filter_ = new WorkerMessageFilter( |
| 263 render_process_id, resource_context_, partition_, | 271 render_process_id, resource_context_, partition_, |
| 264 base::Bind(&WorkerServiceImpl::next_worker_route_id, | 272 base::Bind(&WorkerServiceImpl::next_worker_route_id, |
| 265 base::Unretained(WorkerServiceImpl::GetInstance()))); | 273 base::Unretained(WorkerServiceImpl::GetInstance()))); |
| 266 process_->GetHost()->AddFilter(worker_message_filter_); | 274 process_->GetHost()->AddFilter(worker_message_filter_); |
| 267 process_->GetHost()->AddFilter(new AppCacheDispatcherHost( | 275 process_->GetHost()->AddFilter(new AppCacheDispatcherHost( |
| 268 static_cast<ChromeAppCacheService*>( | 276 partition_.appcache_service(), |
| 269 ResourceContext::GetAppCacheService(resource_context_)), | |
| 270 process_->GetData().id)); | 277 process_->GetData().id)); |
| 271 process_->GetHost()->AddFilter(new FileAPIMessageFilter( | 278 process_->GetHost()->AddFilter(new FileAPIMessageFilter( |
| 272 process_->GetData().id, | 279 process_->GetData().id, |
| 273 request_context, | 280 request_context, |
| 274 partition_.filesystem_context(), | 281 partition_.filesystem_context(), |
| 275 content::GetChromeBlobStorageContextForResourceContext( | 282 blob_storage_context)); |
| 276 resource_context_))); | |
| 277 process_->GetHost()->AddFilter(new FileUtilitiesMessageFilter( | 283 process_->GetHost()->AddFilter(new FileUtilitiesMessageFilter( |
| 278 process_->GetData().id)); | 284 process_->GetData().id)); |
| 279 process_->GetHost()->AddFilter(new MimeRegistryMessageFilter()); | 285 process_->GetHost()->AddFilter(new MimeRegistryMessageFilter()); |
| 280 process_->GetHost()->AddFilter( | 286 process_->GetHost()->AddFilter( |
| 281 new DatabaseMessageFilter(partition_.database_tracker())); | 287 new DatabaseMessageFilter(partition_.database_tracker())); |
| 282 | 288 |
| 283 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 289 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
| 284 new SocketStreamDispatcherHost(render_process_id, | 290 new SocketStreamDispatcherHost(render_process_id, |
| 285 new URLRequestContextSelector(request_context), resource_context_); | 291 new URLRequestContextSelector(request_context), resource_context_); |
| 286 process_->GetHost()->AddFilter(socket_stream_dispatcher_host); | 292 process_->GetHost()->AddFilter(socket_stream_dispatcher_host); |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 } | 707 } |
| 702 } | 708 } |
| 703 return false; | 709 return false; |
| 704 } | 710 } |
| 705 | 711 |
| 706 WorkerProcessHost::WorkerInstance::FilterInfo | 712 WorkerProcessHost::WorkerInstance::FilterInfo |
| 707 WorkerProcessHost::WorkerInstance::GetFilter() const { | 713 WorkerProcessHost::WorkerInstance::GetFilter() const { |
| 708 DCHECK(NumFilters() == 1); | 714 DCHECK(NumFilters() == 1); |
| 709 return *filters_.begin(); | 715 return *filters_.begin(); |
| 710 } | 716 } |
| OLD | NEW |