| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { | 329 bool WorkerProcessHost::OnMessageReceived(const IPC::Message& message) { |
| 330 bool msg_is_ok = true; | 330 bool msg_is_ok = true; |
| 331 bool handled = true; | 331 bool handled = true; |
| 332 IPC_BEGIN_MESSAGE_MAP_EX(WorkerProcessHost, message, msg_is_ok) | 332 IPC_BEGIN_MESSAGE_MAP_EX(WorkerProcessHost, message, msg_is_ok) |
| 333 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed, | 333 IPC_MESSAGE_HANDLER(WorkerHostMsg_WorkerContextClosed, |
| 334 OnWorkerContextClosed) | 334 OnWorkerContextClosed) |
| 335 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) | 335 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowDatabase, OnAllowDatabase) |
| 336 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) | 336 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowFileSystem, OnAllowFileSystem) |
| 337 IPC_MESSAGE_HANDLER(WorkerProcessHostMsg_AllowIndexedDB, OnAllowIndexedDB) |
| 337 IPC_MESSAGE_UNHANDLED(handled = false) | 338 IPC_MESSAGE_UNHANDLED(handled = false) |
| 338 IPC_END_MESSAGE_MAP_EX() | 339 IPC_END_MESSAGE_MAP_EX() |
| 339 | 340 |
| 340 if (!msg_is_ok) { | 341 if (!msg_is_ok) { |
| 341 NOTREACHED(); | 342 NOTREACHED(); |
| 342 content::RecordAction(UserMetricsAction("BadMessageTerminate_WPH")); | 343 content::RecordAction(UserMetricsAction("BadMessageTerminate_WPH")); |
| 343 base::KillProcess( | 344 base::KillProcess( |
| 344 process_->GetData().handle, content::RESULT_CODE_KILLED_BAD_MESSAGE, | 345 process_->GetData().handle, content::RESULT_CODE_KILLED_BAD_MESSAGE, |
| 345 false); | 346 false); |
| 346 } | 347 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 GetRenderViewIDsForWorker(worker_route_id)); | 391 GetRenderViewIDsForWorker(worker_route_id)); |
| 391 } | 392 } |
| 392 | 393 |
| 393 void WorkerProcessHost::OnAllowFileSystem(int worker_route_id, | 394 void WorkerProcessHost::OnAllowFileSystem(int worker_route_id, |
| 394 const GURL& url, | 395 const GURL& url, |
| 395 bool* result) { | 396 bool* result) { |
| 396 *result = content::GetContentClient()->browser()->AllowWorkerFileSystem( | 397 *result = content::GetContentClient()->browser()->AllowWorkerFileSystem( |
| 397 url, resource_context_, GetRenderViewIDsForWorker(worker_route_id)); | 398 url, resource_context_, GetRenderViewIDsForWorker(worker_route_id)); |
| 398 } | 399 } |
| 399 | 400 |
| 401 void WorkerProcessHost::OnAllowIndexedDB(int worker_route_id, |
| 402 const GURL& url, |
| 403 const string16& name, |
| 404 bool* result) { |
| 405 *result = content::GetContentClient()->browser()->AllowWorkerIndexedDB( |
| 406 url, name, resource_context_, GetRenderViewIDsForWorker(worker_route_id)); |
| 407 } |
| 408 |
| 400 void WorkerProcessHost::RelayMessage( | 409 void WorkerProcessHost::RelayMessage( |
| 401 const IPC::Message& message, | 410 const IPC::Message& message, |
| 402 WorkerMessageFilter* filter, | 411 WorkerMessageFilter* filter, |
| 403 int route_id) { | 412 int route_id) { |
| 404 if (message.type() == WorkerMsg_PostMessage::ID) { | 413 if (message.type() == WorkerMsg_PostMessage::ID) { |
| 405 // We want to send the receiver a routing id for the new channel, so | 414 // We want to send the receiver a routing id for the new channel, so |
| 406 // crack the message first. | 415 // crack the message first. |
| 407 string16 msg; | 416 string16 msg; |
| 408 std::vector<int> sent_message_port_ids; | 417 std::vector<int> sent_message_port_ids; |
| 409 std::vector<int> new_routing_ids; | 418 std::vector<int> new_routing_ids; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 686 } |
| 678 } | 687 } |
| 679 return false; | 688 return false; |
| 680 } | 689 } |
| 681 | 690 |
| 682 WorkerProcessHost::WorkerInstance::FilterInfo | 691 WorkerProcessHost::WorkerInstance::FilterInfo |
| 683 WorkerProcessHost::WorkerInstance::GetFilter() const { | 692 WorkerProcessHost::WorkerInstance::GetFilter() const { |
| 684 DCHECK(NumFilters() == 1); | 693 DCHECK(NumFilters() == 1); |
| 685 return *filters_.begin(); | 694 return *filters_.begin(); |
| 686 } | 695 } |
| OLD | NEW |