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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/message_loop.h" | 15 #include "base/message_loop.h" |
16 #include "base/string_util.h" | 16 #include "base/string_util.h" |
17 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
18 #include "content/browser/appcache/appcache_dispatcher_host.h" | 18 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 19 #include "content/browser/browser_child_process_host.h" |
19 #include "content/browser/child_process_security_policy.h" | 20 #include "content/browser/child_process_security_policy.h" |
20 #include "content/browser/debugger/worker_devtools_message_filter.h" | 21 #include "content/browser/debugger/worker_devtools_message_filter.h" |
21 #include "content/browser/file_system/file_system_dispatcher_host.h" | 22 #include "content/browser/file_system/file_system_dispatcher_host.h" |
22 #include "content/browser/mime_registry_message_filter.h" | 23 #include "content/browser/mime_registry_message_filter.h" |
23 #include "content/browser/renderer_host/blob_message_filter.h" | 24 #include "content/browser/renderer_host/blob_message_filter.h" |
24 #include "content/browser/renderer_host/database_message_filter.h" | 25 #include "content/browser/renderer_host/database_message_filter.h" |
25 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 26 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
26 #include "content/browser/renderer_host/render_view_host.h" | 27 #include "content/browser/renderer_host/render_view_host.h" |
27 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 28 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
28 #include "content/browser/resource_context.h" | 29 #include "content/browser/resource_context.h" |
(...skipping 12 matching lines...) Expand all Loading... |
41 #include "content/public/common/result_codes.h" | 42 #include "content/public/common/result_codes.h" |
42 #include "ipc/ipc_switches.h" | 43 #include "ipc/ipc_switches.h" |
43 #include "net/base/mime_util.h" | 44 #include "net/base/mime_util.h" |
44 #include "net/base/registry_controlled_domain.h" | 45 #include "net/base/registry_controlled_domain.h" |
45 #include "ui/base/ui_base_switches.h" | 46 #include "ui/base/ui_base_switches.h" |
46 #include "webkit/fileapi/file_system_context.h" | 47 #include "webkit/fileapi/file_system_context.h" |
47 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 48 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
48 #include "webkit/glue/resource_type.h" | 49 #include "webkit/glue/resource_type.h" |
49 | 50 |
50 using content::BrowserThread; | 51 using content::BrowserThread; |
| 52 using content::ChildProcessData; |
51 using content::ChildProcessHost; | 53 using content::ChildProcessHost; |
52 using content::UserMetricsAction; | 54 using content::UserMetricsAction; |
53 using content::WorkerServiceImpl; | 55 using content::WorkerServiceImpl; |
54 | 56 |
55 namespace { | 57 namespace { |
56 | 58 |
57 // Helper class that we pass to SocketStreamDispatcherHost so that it can find | 59 // Helper class that we pass to SocketStreamDispatcherHost so that it can find |
58 // the right net::URLRequestContext for a request. | 60 // the right net::URLRequestContext for a request. |
59 class URLRequestContextSelector | 61 class URLRequestContextSelector |
60 : public ResourceMessageFilter::URLRequestContextSelector { | 62 : public ResourceMessageFilter::URLRequestContextSelector { |
(...skipping 18 matching lines...) Expand all Loading... |
79 // Notifies RenderViewHost that one or more worker objects crashed. | 81 // Notifies RenderViewHost that one or more worker objects crashed. |
80 void WorkerCrashCallback(int render_process_unique_id, int render_view_id) { | 82 void WorkerCrashCallback(int render_process_unique_id, int render_view_id) { |
81 RenderViewHost* host = | 83 RenderViewHost* host = |
82 RenderViewHost::FromID(render_process_unique_id, render_view_id); | 84 RenderViewHost::FromID(render_process_unique_id, render_view_id); |
83 if (host) | 85 if (host) |
84 host->delegate()->WorkerCrashed(); | 86 host->delegate()->WorkerCrashed(); |
85 } | 87 } |
86 | 88 |
87 WorkerProcessHost::WorkerProcessHost( | 89 WorkerProcessHost::WorkerProcessHost( |
88 const content::ResourceContext* resource_context) | 90 const content::ResourceContext* resource_context) |
89 : BrowserChildProcessHost(content::PROCESS_TYPE_WORKER), | 91 : resource_context_(resource_context) { |
90 resource_context_(resource_context) { | |
91 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 92 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
92 DCHECK(resource_context); | 93 DCHECK(resource_context); |
| 94 process_.reset(new BrowserChildProcessHost( |
| 95 content::PROCESS_TYPE_WORKER, this)); |
93 } | 96 } |
94 | 97 |
95 WorkerProcessHost::~WorkerProcessHost() { | 98 WorkerProcessHost::~WorkerProcessHost() { |
96 // If we crashed, tell the RenderViewHosts. | 99 // If we crashed, tell the RenderViewHosts. |
97 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { | 100 for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) { |
98 const WorkerDocumentSet::DocumentInfoSet& parents = | 101 const WorkerDocumentSet::DocumentInfoSet& parents = |
99 i->worker_document_set()->documents(); | 102 i->worker_document_set()->documents(); |
100 for (WorkerDocumentSet::DocumentInfoSet::const_iterator parent_iter = | 103 for (WorkerDocumentSet::DocumentInfoSet::const_iterator parent_iter = |
101 parents.begin(); parent_iter != parents.end(); ++parent_iter) { | 104 parents.begin(); parent_iter != parents.end(); ++parent_iter) { |
102 BrowserThread::PostTask( | 105 BrowserThread::PostTask( |
103 BrowserThread::UI, FROM_HERE, | 106 BrowserThread::UI, FROM_HERE, |
104 base::Bind(&WorkerCrashCallback, parent_iter->render_process_id(), | 107 base::Bind(&WorkerCrashCallback, parent_iter->render_process_id(), |
105 parent_iter->render_view_id())); | 108 parent_iter->render_view_id())); |
106 } | 109 } |
107 WorkerServiceImpl::GetInstance()->NotifyWorkerDestroyed( | 110 WorkerServiceImpl::GetInstance()->NotifyWorkerDestroyed( |
108 this, i->worker_route_id()); | 111 this, i->worker_route_id()); |
109 } | 112 } |
110 | 113 |
111 ChildProcessSecurityPolicy::GetInstance()->Remove(data().id); | 114 ChildProcessSecurityPolicy::GetInstance()->Remove(process_->GetData().id); |
| 115 } |
| 116 |
| 117 bool WorkerProcessHost::Send(IPC::Message* message) { |
| 118 return process_->Send(message); |
112 } | 119 } |
113 | 120 |
114 bool WorkerProcessHost::Init(int render_process_id) { | 121 bool WorkerProcessHost::Init(int render_process_id) { |
115 std::string channel_id = child_process_host()->CreateChannel(); | 122 std::string channel_id = process_->GetHost()->CreateChannel(); |
116 if (channel_id.empty()) | 123 if (channel_id.empty()) |
117 return false; | 124 return false; |
118 | 125 |
119 #if defined(OS_LINUX) | 126 #if defined(OS_LINUX) |
120 int flags = ChildProcessHost::CHILD_ALLOW_SELF; | 127 int flags = ChildProcessHost::CHILD_ALLOW_SELF; |
121 #else | 128 #else |
122 int flags = ChildProcessHost::CHILD_NORMAL; | 129 int flags = ChildProcessHost::CHILD_NORMAL; |
123 #endif | 130 #endif |
124 | 131 |
125 FilePath exe_path = ChildProcessHost::GetChildPath(flags); | 132 FilePath exe_path = ChildProcessHost::GetChildPath(flags); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 switches::kDebugChildren); | 175 switches::kDebugChildren); |
169 if (value.empty() || value == switches::kWorkerProcess) { | 176 if (value.empty() || value == switches::kWorkerProcess) { |
170 // launches a new xterm, and runs the worker process in gdb, reading | 177 // launches a new xterm, and runs the worker process in gdb, reading |
171 // optional commands from gdb_chrome file in the working directory. | 178 // optional commands from gdb_chrome file in the working directory. |
172 cmd_line->PrependWrapper("xterm -e gdb -x gdb_chrome --args"); | 179 cmd_line->PrependWrapper("xterm -e gdb -x gdb_chrome --args"); |
173 use_zygote = false; | 180 use_zygote = false; |
174 } | 181 } |
175 } | 182 } |
176 #endif | 183 #endif |
177 | 184 |
178 Launch( | 185 process_->Launch( |
179 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
180 FilePath(), | 187 FilePath(), |
181 #elif defined(OS_POSIX) | 188 #elif defined(OS_POSIX) |
182 use_zygote, | 189 use_zygote, |
183 base::environment_vector(), | 190 base::environment_vector(), |
184 #endif | 191 #endif |
185 cmd_line); | 192 cmd_line); |
186 | 193 |
187 ChildProcessSecurityPolicy::GetInstance()->AddWorker( | 194 ChildProcessSecurityPolicy::GetInstance()->AddWorker( |
188 data().id, render_process_id); | 195 process_->GetData().id, render_process_id); |
189 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 196 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
190 switches::kDisableFileSystem)) { | 197 switches::kDisableFileSystem)) { |
191 // Grant most file permissions to this worker. | 198 // Grant most file permissions to this worker. |
192 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and | 199 // PLATFORM_FILE_TEMPORARY, PLATFORM_FILE_HIDDEN and |
193 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API | 200 // PLATFORM_FILE_DELETE_ON_CLOSE are not granted, because no existing API |
194 // requests them. | 201 // requests them. |
195 // This is for the filesystem sandbox. | 202 // This is for the filesystem sandbox. |
196 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 203 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
197 data().id, resource_context_->file_system_context()-> | 204 process_->GetData().id, resource_context_->file_system_context()-> |
198 sandbox_provider()->new_base_path(), | 205 sandbox_provider()->new_base_path(), |
199 base::PLATFORM_FILE_OPEN | | 206 base::PLATFORM_FILE_OPEN | |
200 base::PLATFORM_FILE_CREATE | | 207 base::PLATFORM_FILE_CREATE | |
201 base::PLATFORM_FILE_OPEN_ALWAYS | | 208 base::PLATFORM_FILE_OPEN_ALWAYS | |
202 base::PLATFORM_FILE_CREATE_ALWAYS | | 209 base::PLATFORM_FILE_CREATE_ALWAYS | |
203 base::PLATFORM_FILE_OPEN_TRUNCATED | | 210 base::PLATFORM_FILE_OPEN_TRUNCATED | |
204 base::PLATFORM_FILE_READ | | 211 base::PLATFORM_FILE_READ | |
205 base::PLATFORM_FILE_WRITE | | 212 base::PLATFORM_FILE_WRITE | |
206 base::PLATFORM_FILE_EXCLUSIVE_READ | | 213 base::PLATFORM_FILE_EXCLUSIVE_READ | |
207 base::PLATFORM_FILE_EXCLUSIVE_WRITE | | 214 base::PLATFORM_FILE_EXCLUSIVE_WRITE | |
208 base::PLATFORM_FILE_ASYNC | | 215 base::PLATFORM_FILE_ASYNC | |
209 base::PLATFORM_FILE_WRITE_ATTRIBUTES | | 216 base::PLATFORM_FILE_WRITE_ATTRIBUTES | |
210 base::PLATFORM_FILE_ENUMERATE); | 217 base::PLATFORM_FILE_ENUMERATE); |
211 // This is so that we can read and move stuff out of the old filesystem | 218 // This is so that we can read and move stuff out of the old filesystem |
212 // sandbox. | 219 // sandbox. |
213 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 220 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
214 data().id, resource_context_->file_system_context()-> | 221 process_->GetData().id, resource_context_->file_system_context()-> |
215 sandbox_provider()->old_base_path(), | 222 sandbox_provider()->old_base_path(), |
216 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | | 223 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_WRITE | |
217 base::PLATFORM_FILE_WRITE_ATTRIBUTES | | 224 base::PLATFORM_FILE_WRITE_ATTRIBUTES | |
218 base::PLATFORM_FILE_ENUMERATE); | 225 base::PLATFORM_FILE_ENUMERATE); |
219 // This is so that we can rename the old sandbox out of the way so that | 226 // This is so that we can rename the old sandbox out of the way so that |
220 // we know we've taken care of it. | 227 // we know we've taken care of it. |
221 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( | 228 ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile( |
222 data().id, resource_context_->file_system_context()-> | 229 process_->GetData().id, resource_context_->file_system_context()-> |
223 sandbox_provider()->renamed_old_base_path(), | 230 sandbox_provider()->renamed_old_base_path(), |
224 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | | 231 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_CREATE_ALWAYS | |
225 base::PLATFORM_FILE_WRITE); | 232 base::PLATFORM_FILE_WRITE); |
226 } | 233 } |
227 | 234 |
228 CreateMessageFilters(render_process_id); | 235 CreateMessageFilters(render_process_id); |
229 | 236 |
230 return true; | 237 return true; |
231 } | 238 } |
232 | 239 |
233 void WorkerProcessHost::CreateMessageFilters(int render_process_id) { | 240 void WorkerProcessHost::CreateMessageFilters(int render_process_id) { |
234 DCHECK(resource_context_); | 241 DCHECK(resource_context_); |
235 net::URLRequestContext* request_context = | 242 net::URLRequestContext* request_context = |
236 resource_context_->request_context(); | 243 resource_context_->request_context(); |
237 | 244 |
238 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( | 245 ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
239 data().id, content::PROCESS_TYPE_WORKER, resource_context_, | 246 process_->GetData().id, content::PROCESS_TYPE_WORKER, resource_context_, |
240 new URLRequestContextSelector(request_context)); | 247 new URLRequestContextSelector(request_context)); |
241 child_process_host()->AddFilter(resource_message_filter); | 248 process_->GetHost()->AddFilter(resource_message_filter); |
242 | 249 |
243 worker_message_filter_ = new WorkerMessageFilter( | 250 worker_message_filter_ = new WorkerMessageFilter( |
244 render_process_id, resource_context_, | 251 render_process_id, resource_context_, |
245 base::Bind(&WorkerServiceImpl::next_worker_route_id, | 252 base::Bind(&WorkerServiceImpl::next_worker_route_id, |
246 base::Unretained(WorkerServiceImpl::GetInstance()))); | 253 base::Unretained(WorkerServiceImpl::GetInstance()))); |
247 child_process_host()->AddFilter(worker_message_filter_); | 254 process_->GetHost()->AddFilter(worker_message_filter_); |
248 child_process_host()->AddFilter(new AppCacheDispatcherHost( | 255 process_->GetHost()->AddFilter(new AppCacheDispatcherHost( |
249 resource_context_->appcache_service(), data().id)); | 256 resource_context_->appcache_service(), process_->GetData().id)); |
250 child_process_host()->AddFilter(new FileSystemDispatcherHost( | 257 process_->GetHost()->AddFilter(new FileSystemDispatcherHost( |
251 request_context, resource_context_->file_system_context())); | 258 request_context, resource_context_->file_system_context())); |
252 child_process_host()->AddFilter(new FileUtilitiesMessageFilter(data().id)); | 259 process_->GetHost()->AddFilter(new FileUtilitiesMessageFilter( |
253 child_process_host()->AddFilter(new BlobMessageFilter( | 260 process_->GetData().id)); |
254 data().id, resource_context_->blob_storage_context())); | 261 process_->GetHost()->AddFilter(new BlobMessageFilter( |
255 child_process_host()->AddFilter(new MimeRegistryMessageFilter()); | 262 process_->GetData().id, resource_context_->blob_storage_context())); |
256 child_process_host()->AddFilter(new DatabaseMessageFilter( | 263 process_->GetHost()->AddFilter(new MimeRegistryMessageFilter()); |
| 264 process_->GetHost()->AddFilter(new DatabaseMessageFilter( |
257 resource_context_->database_tracker())); | 265 resource_context_->database_tracker())); |
258 | 266 |
259 SocketStreamDispatcherHost* socket_stream_dispatcher_host = | 267 SocketStreamDispatcherHost* socket_stream_dispatcher_host = |
260 new SocketStreamDispatcherHost( | 268 new SocketStreamDispatcherHost( |
261 new URLRequestContextSelector(request_context), resource_context_); | 269 new URLRequestContextSelector(request_context), resource_context_); |
262 child_process_host()->AddFilter(socket_stream_dispatcher_host); | 270 process_->GetHost()->AddFilter(socket_stream_dispatcher_host); |
263 child_process_host()->AddFilter( | 271 process_->GetHost()->AddFilter( |
264 new content::WorkerDevToolsMessageFilter(data().id)); | 272 new content::WorkerDevToolsMessageFilter(process_->GetData().id)); |
265 } | 273 } |
266 | 274 |
267 void WorkerProcessHost::CreateWorker(const WorkerInstance& instance) { | 275 void WorkerProcessHost::CreateWorker(const WorkerInstance& instance) { |
268 ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL( | 276 ChildProcessSecurityPolicy::GetInstance()->GrantRequestURL( |
269 data().id, instance.url()); | 277 process_->GetData().id, instance.url()); |
270 | 278 |
271 instances_.push_back(instance); | 279 instances_.push_back(instance); |
272 | 280 |
273 WorkerProcessMsg_CreateWorker_Params params; | 281 WorkerProcessMsg_CreateWorker_Params params; |
274 params.url = instance.url(); | 282 params.url = instance.url(); |
275 params.name = instance.name(); | 283 params.name = instance.name(); |
276 params.route_id = instance.worker_route_id(); | 284 params.route_id = instance.worker_route_id(); |
277 params.creator_process_id = instance.parent_process_id(); | 285 params.creator_process_id = instance.parent_process_id(); |
278 params.shared_worker_appcache_id = instance.main_resource_appcache_id(); | 286 params.shared_worker_appcache_id = instance.main_resource_appcache_id(); |
279 Send(new WorkerProcessMsg_CreateWorker(params)); | 287 Send(new WorkerProcessMsg_CreateWorker(params)); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 OnWorkerContextClosed) | 321 OnWorkerContextClosed) |
314 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) | 322 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) |
315 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) | 323 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) |
316 IPC_MESSAGE_UNHANDLED(handled = false) | 324 IPC_MESSAGE_UNHANDLED(handled = false) |
317 IPC_END_MESSAGE_MAP_EX() | 325 IPC_END_MESSAGE_MAP_EX() |
318 | 326 |
319 if (!msg_is_ok) { | 327 if (!msg_is_ok) { |
320 NOTREACHED(); | 328 NOTREACHED(); |
321 content::RecordAction(UserMetricsAction("BadMessageTerminate_WPH")); | 329 content::RecordAction(UserMetricsAction("BadMessageTerminate_WPH")); |
322 base::KillProcess( | 330 base::KillProcess( |
323 data().handle, content::RESULT_CODE_KILLED_BAD_MESSAGE, false); | 331 process_->GetData().handle, content::RESULT_CODE_KILLED_BAD_MESSAGE, |
| 332 false); |
324 } | 333 } |
325 | 334 |
326 if (handled) | 335 if (handled) |
327 return true; | 336 return true; |
328 | 337 |
329 if (message.type() == WorkerHostMsg_WorkerContextDestroyed::ID) { | 338 if (message.type() == WorkerHostMsg_WorkerContextDestroyed::ID) { |
330 WorkerServiceImpl::GetInstance()->NotifyWorkerDestroyed( | 339 WorkerServiceImpl::GetInstance()->NotifyWorkerDestroyed( |
331 this, message.routing_id()); | 340 this, message.routing_id()); |
332 } | 341 } |
333 | 342 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 } | 492 } |
484 | 493 |
485 std::string display_title; | 494 std::string display_title; |
486 for (std::set<std::string>::iterator i = titles.begin(); | 495 for (std::set<std::string>::iterator i = titles.begin(); |
487 i != titles.end(); ++i) { | 496 i != titles.end(); ++i) { |
488 if (!display_title.empty()) | 497 if (!display_title.empty()) |
489 display_title += ", "; | 498 display_title += ", "; |
490 display_title += *i; | 499 display_title += *i; |
491 } | 500 } |
492 | 501 |
493 SetName(ASCIIToUTF16(display_title)); | 502 process_->SetName(ASCIIToUTF16(display_title)); |
494 } | 503 } |
495 | 504 |
496 void WorkerProcessHost::DocumentDetached(WorkerMessageFilter* filter, | 505 void WorkerProcessHost::DocumentDetached(WorkerMessageFilter* filter, |
497 unsigned long long document_id) { | 506 unsigned long long document_id) { |
498 // Walk all instances and remove the document from their document set. | 507 // Walk all instances and remove the document from their document set. |
499 for (Instances::iterator i = instances_.begin(); i != instances_.end();) { | 508 for (Instances::iterator i = instances_.begin(); i != instances_.end();) { |
500 i->worker_document_set()->Remove(filter, document_id); | 509 i->worker_document_set()->Remove(filter, document_id); |
501 if (i->worker_document_set()->IsEmpty()) { | 510 if (i->worker_document_set()->IsEmpty()) { |
502 // This worker has no more associated documents - shut it down. | 511 // This worker has no more associated documents - shut it down. |
503 Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id())); | 512 Send(new WorkerMsg_TerminateWorkerContext(i->worker_route_id())); |
504 i = instances_.erase(i); | 513 i = instances_.erase(i); |
505 } else { | 514 } else { |
506 ++i; | 515 ++i; |
507 } | 516 } |
508 } | 517 } |
509 } | 518 } |
510 | 519 |
511 void WorkerProcessHost::TerminateWorker(int worker_route_id) { | 520 void WorkerProcessHost::TerminateWorker(int worker_route_id) { |
512 Send(new WorkerMsg_TerminateWorkerContext(worker_route_id)); | 521 Send(new WorkerMsg_TerminateWorkerContext(worker_route_id)); |
513 } | 522 } |
514 | 523 |
| 524 const ChildProcessData& WorkerProcessHost::GetData() { |
| 525 return process_->GetData(); |
| 526 } |
| 527 |
515 WorkerProcessHost::WorkerInstance::WorkerInstance( | 528 WorkerProcessHost::WorkerInstance::WorkerInstance( |
516 const GURL& url, | 529 const GURL& url, |
517 const string16& name, | 530 const string16& name, |
518 int worker_route_id, | 531 int worker_route_id, |
519 int parent_process_id, | 532 int parent_process_id, |
520 int64 main_resource_appcache_id, | 533 int64 main_resource_appcache_id, |
521 const content::ResourceContext* resource_context) | 534 const content::ResourceContext* resource_context) |
522 : url_(url), | 535 : url_(url), |
523 closed_(false), | 536 closed_(false), |
524 name_(name), | 537 name_(name), |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 } | 641 } |
629 } | 642 } |
630 return false; | 643 return false; |
631 } | 644 } |
632 | 645 |
633 WorkerProcessHost::WorkerInstance::FilterInfo | 646 WorkerProcessHost::WorkerInstance::FilterInfo |
634 WorkerProcessHost::WorkerInstance::GetFilter() const { | 647 WorkerProcessHost::WorkerInstance::GetFilter() const { |
635 DCHECK(NumFilters() == 1); | 648 DCHECK(NumFilters() == 1); |
636 return *filters_.begin(); | 649 return *filters_.begin(); |
637 } | 650 } |
OLD | NEW |