Chromium Code Reviews| Index: content/browser/worker_host/worker_process_host.cc |
| =================================================================== |
| --- content/browser/worker_host/worker_process_host.cc (revision 119868) |
| +++ content/browser/worker_host/worker_process_host.cc (working copy) |
| @@ -18,6 +18,7 @@ |
| #include "content/browser/appcache/appcache_dispatcher_host.h" |
| #include "content/browser/browser_child_process_host_impl.h" |
| #include "content/browser/child_process_security_policy.h" |
| +#include "content/browser/debugger/worker_devtools_manager.h" |
| #include "content/browser/debugger/worker_devtools_message_filter.h" |
| #include "content/browser/file_system/file_system_dispatcher_host.h" |
| #include "content/browser/mime_registry_message_filter.h" |
| @@ -52,6 +53,7 @@ |
| using content::ChildProcessData; |
| using content::ChildProcessHost; |
| using content::UserMetricsAction; |
| +using content::WorkerDevToolsManager; |
| using content::WorkerServiceImpl; |
| namespace { |
| @@ -76,6 +78,26 @@ |
| net::URLRequestContext* url_request_context_; |
| }; |
| +std::vector<std::pair<int, int> > GetRenderViewIDsForWorker( |
| + WorkerProcessHost* process, |
| + int worker_route_id) { |
| + std::vector<std::pair<int, int> > result; |
|
Andrew T Wilson (Slow)
2012/02/01 05:51:37
How many copies of the vector does this end up cre
jam
2012/02/01 16:53:53
yep: see http://en.wikipedia.org/wiki/Return_value
|
| + WorkerProcessHost::Instances::const_iterator i; |
| + for (i = process->instances().begin(); i != process->instances().end(); ++i) { |
| + if (i->worker_route_id() != worker_route_id) |
| + continue; |
| + const WorkerDocumentSet::DocumentInfoSet& documents = |
| + i->worker_document_set()->documents(); |
| + for (WorkerDocumentSet::DocumentInfoSet::const_iterator doc = |
| + documents.begin(); doc != documents.end(); ++doc) { |
| + result.push_back( |
| + std::make_pair(doc->render_process_id(), doc->render_view_id())); |
| + } |
| + break; |
| + } |
| + return result; |
| +} |
| + |
| } // namespace |
| // Notifies RenderViewHost that one or more worker objects crashed. |
| @@ -373,14 +395,16 @@ |
| unsigned long estimated_size, |
| bool* result) { |
| *result = content::GetContentClient()->browser()->AllowWorkerDatabase( |
| - worker_route_id, url, name, display_name, estimated_size, this); |
| + url, name, display_name, estimated_size, *resource_context_, |
| + GetRenderViewIDsForWorker(this, worker_route_id)); |
| } |
| void WorkerProcessHost::OnAllowFileSystem(int worker_route_id, |
| const GURL& url, |
| bool* result) { |
| *result = content::GetContentClient()->browser()->AllowWorkerFileSystem( |
| - worker_route_id, url, this); |
| + url, *resource_context_, |
| + GetRenderViewIDsForWorker(this, worker_route_id)); |
| } |
| void WorkerProcessHost::RelayMessage( |
| @@ -440,7 +464,7 @@ |
| new_message->set_routing_id(route_id); |
| filter->Send(new_message); |
| if (message.type() == WorkerMsg_StartWorkerContext::ID) { |
| - WorkerServiceImpl::GetInstance()->NotifyWorkerContextStarted( |
| + WorkerDevToolsManager::GetInstance()->WorkerContextStarted( |
| this, route_id); |
| } |
| return; |