| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/worker_host/worker_process_host.h" | 5 #include "chrome/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/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
| 14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 15 #include "chrome/browser/appcache/appcache_dispatcher_host.h" | 15 #include "chrome/browser/appcache/appcache_dispatcher_host.h" |
| 16 #include "chrome/browser/browser_thread.h" | 16 #include "chrome/browser/browser_thread.h" |
| 17 #include "chrome/browser/child_process_security_policy.h" | 17 #include "chrome/browser/child_process_security_policy.h" |
| 18 #include "chrome/browser/content_settings/host_content_settings_map.h" | 18 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 19 #include "chrome/browser/file_system/file_system_dispatcher_host.h" | 19 #include "chrome/browser/file_system/file_system_dispatcher_host.h" |
| 20 #include "chrome/browser/mime_registry_message_filter.h" | 20 #include "chrome/browser/mime_registry_message_filter.h" |
| 21 #include "chrome/browser/net/chrome_url_request_context.h" | 21 #include "chrome/browser/net/chrome_url_request_context.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/renderer_host/blob_message_filter.h" | 23 #include "chrome/browser/renderer_host/blob_message_filter.h" |
| 24 #include "chrome/browser/renderer_host/database_message_filter.h" | 24 #include "chrome/browser/renderer_host/database_message_filter.h" |
| 25 #include "chrome/browser/renderer_host/file_utilities_message_filter.h" | 25 #include "chrome/browser/renderer_host/file_utilities_message_filter.h" |
| 26 #include "chrome/browser/renderer_host/render_message_filter.h" |
| 26 #include "chrome/browser/renderer_host/render_view_host.h" | 27 #include "chrome/browser/renderer_host/render_view_host.h" |
| 27 #include "chrome/browser/renderer_host/render_view_host_delegate.h" | 28 #include "chrome/browser/renderer_host/render_view_host_delegate.h" |
| 28 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" | 29 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" |
| 29 #include "chrome/browser/renderer_host/resource_message_filter.h" | |
| 30 #include "chrome/browser/worker_host/message_port_dispatcher.h" | 30 #include "chrome/browser/worker_host/message_port_dispatcher.h" |
| 31 #include "chrome/browser/worker_host/worker_service.h" | 31 #include "chrome/browser/worker_host/worker_service.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "chrome/common/debug_flags.h" | 33 #include "chrome/common/debug_flags.h" |
| 34 #include "chrome/common/notification_service.h" | 34 #include "chrome/common/notification_service.h" |
| 35 #include "chrome/common/render_messages.h" | 35 #include "chrome/common/render_messages.h" |
| 36 #include "chrome/common/render_messages_params.h" | 36 #include "chrome/common/render_messages_params.h" |
| 37 #include "chrome/common/result_codes.h" | 37 #include "chrome/common/result_codes.h" |
| 38 #include "chrome/common/worker_messages.h" | 38 #include "chrome/common/worker_messages.h" |
| 39 #include "net/base/mime_util.h" | 39 #include "net/base/mime_util.h" |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 // We don't keep callbacks for senders associated with workers, so figure out | 345 // We don't keep callbacks for senders associated with workers, so figure out |
| 346 // what kind of sender this is, and cast it to the correct class to get the | 346 // what kind of sender this is, and cast it to the correct class to get the |
| 347 // callback. | 347 // callback. |
| 348 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); | 348 for (BrowserChildProcessHost::Iterator iter(ChildProcessInfo::WORKER_PROCESS); |
| 349 !iter.Done(); ++iter) { | 349 !iter.Done(); ++iter) { |
| 350 WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); | 350 WorkerProcessHost* worker = static_cast<WorkerProcessHost*>(*iter); |
| 351 if (static_cast<IPC::Message::Sender*>(worker) == sender) | 351 if (static_cast<IPC::Message::Sender*>(worker) == sender) |
| 352 return worker->next_route_id_callback_.get(); | 352 return worker->next_route_id_callback_.get(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 // Must be a ResourceMessageFilter. | 355 // Must be a RenderMessageFilter. |
| 356 return static_cast<ResourceMessageFilter*>(sender)->next_route_id_callback(); | 356 return static_cast<RenderMessageFilter*>(sender)->next_route_id_callback(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 void WorkerProcessHost::RelayMessage( | 359 void WorkerProcessHost::RelayMessage( |
| 360 const IPC::Message& message, | 360 const IPC::Message& message, |
| 361 IPC::Message::Sender* sender, | 361 IPC::Message::Sender* sender, |
| 362 int route_id, | 362 int route_id, |
| 363 CallbackWithReturnValue<int>::Type* next_route_id) { | 363 CallbackWithReturnValue<int>::Type* next_route_id) { |
| 364 | 364 |
| 365 if (message.type() == WorkerMsg_PostMessage::ID) { | 365 if (message.type() == WorkerMsg_PostMessage::ID) { |
| 366 // We want to send the receiver a routing id for the new channel, so | 366 // We want to send the receiver a routing id for the new channel, so |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 } | 684 } |
| 685 } | 685 } |
| 686 return false; | 686 return false; |
| 687 } | 687 } |
| 688 | 688 |
| 689 WorkerProcessHost::WorkerInstance::SenderInfo | 689 WorkerProcessHost::WorkerInstance::SenderInfo |
| 690 WorkerProcessHost::WorkerInstance::GetSender() const { | 690 WorkerProcessHost::WorkerInstance::GetSender() const { |
| 691 DCHECK(NumSenders() == 1); | 691 DCHECK(NumSenders() == 1); |
| 692 return *senders_.begin(); | 692 return *senders_.begin(); |
| 693 } | 693 } |
| OLD | NEW |