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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
311 | 311 |
312 bool WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { | 312 bool WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { |
313 bool msg_is_ok = true; | 313 bool msg_is_ok = true; |
314 bool handled = true; | 314 bool handled = true; |
315 IPC_BEGIN_MESSAGE_MAP_EX(WorkerProcessHost, message, msg_is_ok) | 315 IPC_BEGIN_MESSAGE_MAP_EX(WorkerProcessHost, message, msg_is_ok) |
316 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed, | 316 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed, |
317 OnWorkerContextClosed) | 317 OnWorkerContextClosed) |
318 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) | 318 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) |
319 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) | 319 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) |
320 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) | 320 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
321 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_ForceKillWorker, | |
322 OnForceKillWorkerProcess) | |
321 IPC_MESSAGE_UNHANDLED(handled = false) | 323 IPC_MESSAGE_UNHANDLED(handled = false) |
322 IPC_END_MESSAGE_MAP_EX() | 324 IPC_END_MESSAGE_MAP_EX() |
323 | 325 |
324 if (!msg_is_ok) { | 326 if (!msg_is_ok) { |
325 NOTREACHED(); | 327 NOTREACHED(); |
326 RecordAction(UserMetricsAction("BadMessageTerminate_WPH")); | 328 RecordAction(UserMetricsAction("BadMessageTerminate_WPH")); |
327 base::KillProcess( | 329 base::KillProcess( |
328 process_->GetData().handle, RESULT_CODE_KILLED_BAD_MESSAGE, false); | 330 process_->GetData().handle, RESULT_CODE_KILLED_BAD_MESSAGE, false); |
329 } | 331 } |
330 | 332 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 } | 383 } |
382 | 384 |
383 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id, | 385 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id, |
384 const GURL& url, | 386 const GURL& url, |
385 const string16& name, | 387 const string16& name, |
386 bool* result) { | 388 bool* result) { |
387 *result = GetContentClient()->browser()->AllowWorkerIndexedDB( | 389 *result = GetContentClient()->browser()->AllowWorkerIndexedDB( |
388 url, name, resource_context_, GetRenderViewIDsForWorker(worker_route_id)); | 390 url, name, resource_context_, GetRenderViewIDsForWorker(worker_route_id)); |
389 } | 391 } |
390 | 392 |
393 void WorkerProcessHost::OnForceKillWorkerProcess() { | |
394 base::KillProcess( | |
michaeln
2013/09/17 20:30:37
Is this the same low level api we use elsewhere to
| |
395 process_->GetData().handle, RESULT_CODE_NORMAL_EXIT, false); | |
Cris Neckar
2013/11/01 23:26:34
nit: may want to check process_launched_ == true b
meacer
2013/11/04 18:38:10
Done.
| |
396 } | |
397 | |
391 void WorkerProcessHost::RelayMessage( | 398 void WorkerProcessHost::RelayMessage( |
392 const IPC::Message& message, | 399 const IPC::Message& message, |
393 WorkerMessageFilter* filter, | 400 WorkerMessageFilter* filter, |
394 int route_id) { | 401 int route_id) { |
395 if (message.type() == WorkerMsg_PostMessage::ID) { | 402 if (message.type() == WorkerMsg_PostMessage::ID) { |
396 // We want to send the receiver a routing id for the new channel, so | 403 // We want to send the receiver a routing id for the new channel, so |
397 // crack the message first. | 404 // crack the message first. |
398 string16 msg; | 405 string16 msg; |
399 std::vector<int> sent_message_port_ids; | 406 std::vector<int> sent_message_port_ids; |
400 std::vector<int> new_routing_ids; | 407 std::vector<int> new_routing_ids; |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
711 return false; | 718 return false; |
712 } | 719 } |
713 | 720 |
714 WorkerProcessHost::WorkerInstance::FilterInfo | 721 WorkerProcessHost::WorkerInstance::FilterInfo |
715 WorkerProcessHost::WorkerInstance::GetFilter() const { | 722 WorkerProcessHost::WorkerInstance::GetFilter() const { |
716 DCHECK(NumFilters() == 1); | 723 DCHECK(NumFilters() == 1); |
717 return *filters_.begin(); | 724 return *filters_.begin(); |
718 } | 725 } |
719 | 726 |
720 } // namespace content | 727 } // namespace content |
OLD | NEW |