| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
| 6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 9 | 9 |
| 10 #if defined(OS_WIN) | 10 #if defined(OS_WIN) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 #include "content/browser/renderer_host/render_view_host_delegate.h" | 73 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 74 #include "content/browser/renderer_host/render_widget_helper.h" | 74 #include "content/browser/renderer_host/render_widget_helper.h" |
| 75 #include "content/browser/renderer_host/render_widget_host.h" | 75 #include "content/browser/renderer_host/render_widget_host.h" |
| 76 #include "content/browser/renderer_host/resource_message_filter.h" | 76 #include "content/browser/renderer_host/resource_message_filter.h" |
| 77 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" | 77 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" |
| 78 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 78 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 79 #include "content/browser/resolve_proxy_msg_helper.h" | 79 #include "content/browser/resolve_proxy_msg_helper.h" |
| 80 #include "content/browser/resource_context.h" | 80 #include "content/browser/resource_context.h" |
| 81 #include "content/browser/speech/speech_input_dispatcher_host.h" | 81 #include "content/browser/speech/speech_input_dispatcher_host.h" |
| 82 #include "content/browser/trace_message_filter.h" | 82 #include "content/browser/trace_message_filter.h" |
| 83 #include "content/browser/user_metrics.h" | |
| 84 #include "content/browser/webui/web_ui_factory.h" | 83 #include "content/browser/webui/web_ui_factory.h" |
| 85 #include "content/browser/worker_host/worker_message_filter.h" | 84 #include "content/browser/worker_host/worker_message_filter.h" |
| 86 #include "content/common/child_process_host_impl.h" | 85 #include "content/common/child_process_host_impl.h" |
| 87 #include "content/common/child_process_messages.h" | 86 #include "content/common/child_process_messages.h" |
| 88 #include "content/common/gpu/gpu_messages.h" | 87 #include "content/common/gpu/gpu_messages.h" |
| 89 #include "content/public/browser/notification_service.h" | 88 #include "content/public/browser/notification_service.h" |
| 89 #include "content/public/browser/user_metrics.h" |
| 90 #include "content/common/resource_messages.h" | 90 #include "content/common/resource_messages.h" |
| 91 #include "content/common/view_messages.h" | 91 #include "content/common/view_messages.h" |
| 92 #include "content/public/browser/content_browser_client.h" | 92 #include "content/public/browser/content_browser_client.h" |
| 93 #include "content/public/common/content_constants.h" | 93 #include "content/public/common/content_constants.h" |
| 94 #include "content/public/common/content_switches.h" | 94 #include "content/public/common/content_switches.h" |
| 95 #include "content/public/common/process_type.h" | 95 #include "content/public/common/process_type.h" |
| 96 #include "content/public/common/result_codes.h" | 96 #include "content/public/common/result_codes.h" |
| 97 #include "content/renderer/render_process_impl.h" | 97 #include "content/renderer/render_process_impl.h" |
| 98 #include "content/renderer/render_thread_impl.h" | 98 #include "content/renderer/render_thread_impl.h" |
| 99 #include "ipc/ipc_logging.h" | 99 #include "ipc/ipc_logging.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 111 #if defined(OS_WIN) | 111 #if defined(OS_WIN) |
| 112 #include "base/synchronization/waitable_event.h" | 112 #include "base/synchronization/waitable_event.h" |
| 113 #include "content/common/font_cache_dispatcher_win.h" | 113 #include "content/common/font_cache_dispatcher_win.h" |
| 114 #endif | 114 #endif |
| 115 | 115 |
| 116 #include "third_party/skia/include/core/SkBitmap.h" | 116 #include "third_party/skia/include/core/SkBitmap.h" |
| 117 | 117 |
| 118 using content::BrowserThread; | 118 using content::BrowserThread; |
| 119 using content::ChildProcessHost; | 119 using content::ChildProcessHost; |
| 120 using content::ChildProcessHostImpl; | 120 using content::ChildProcessHostImpl; |
| 121 using content::UserMetricsAction; |
| 121 | 122 |
| 122 // This class creates the IO thread for the renderer when running in | 123 // This class creates the IO thread for the renderer when running in |
| 123 // single-process mode. It's not used in multi-process mode. | 124 // single-process mode. It's not used in multi-process mode. |
| 124 class RendererMainThread : public base::Thread { | 125 class RendererMainThread : public base::Thread { |
| 125 public: | 126 public: |
| 126 explicit RendererMainThread(const std::string& channel_id) | 127 explicit RendererMainThread(const std::string& channel_id) |
| 127 : base::Thread("Chrome_InProcRendererThread"), | 128 : base::Thread("Chrome_InProcRendererThread"), |
| 128 channel_id_(channel_id), | 129 channel_id_(channel_id), |
| 129 render_process_(NULL) { | 130 render_process_(NULL) { |
| 130 } | 131 } |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 OnUserMetricsRecordAction) | 905 OnUserMetricsRecordAction) |
| 905 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) | 906 IPC_MESSAGE_HANDLER(ViewHostMsg_RevealFolderInOS, OnRevealFolderInOS) |
| 906 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) | 907 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) |
| 907 IPC_MESSAGE_UNHANDLED_ERROR() | 908 IPC_MESSAGE_UNHANDLED_ERROR() |
| 908 IPC_END_MESSAGE_MAP_EX() | 909 IPC_END_MESSAGE_MAP_EX() |
| 909 | 910 |
| 910 if (!msg_is_ok) { | 911 if (!msg_is_ok) { |
| 911 // The message had a handler, but its de-serialization failed. | 912 // The message had a handler, but its de-serialization failed. |
| 912 // We consider this a capital crime. Kill the renderer if we have one. | 913 // We consider this a capital crime. Kill the renderer if we have one. |
| 913 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; | 914 LOG(ERROR) << "bad message " << msg.type() << " terminating renderer."; |
| 914 UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); | 915 content::RecordAction(UserMetricsAction("BadMessageTerminate_BRPH")); |
| 915 ReceivedBadMessage(); | 916 ReceivedBadMessage(); |
| 916 } | 917 } |
| 917 return true; | 918 return true; |
| 918 } | 919 } |
| 919 | 920 |
| 920 // Dispatch incoming messages to the appropriate RenderView/WidgetHost. | 921 // Dispatch incoming messages to the appropriate RenderView/WidgetHost. |
| 921 IPC::Channel::Listener* listener = GetListenerByID(msg.routing_id()); | 922 IPC::Channel::Listener* listener = GetListenerByID(msg.routing_id()); |
| 922 if (!listener) { | 923 if (!listener) { |
| 923 if (msg.is_sync()) { | 924 if (msg.is_sync()) { |
| 924 // The listener has gone away, so we must respond or else the caller will | 925 // The listener has gone away, so we must respond or else the caller will |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1301 content::NotificationService::NoDetails()); | 1302 content::NotificationService::NoDetails()); |
| 1302 | 1303 |
| 1303 while (!queued_messages_.empty()) { | 1304 while (!queued_messages_.empty()) { |
| 1304 Send(queued_messages_.front()); | 1305 Send(queued_messages_.front()); |
| 1305 queued_messages_.pop(); | 1306 queued_messages_.pop(); |
| 1306 } | 1307 } |
| 1307 } | 1308 } |
| 1308 | 1309 |
| 1309 void RenderProcessHostImpl::OnUserMetricsRecordAction( | 1310 void RenderProcessHostImpl::OnUserMetricsRecordAction( |
| 1310 const std::string& action) { | 1311 const std::string& action) { |
| 1311 UserMetrics::RecordComputedAction(action); | 1312 content::RecordComputedAction(action); |
| 1312 } | 1313 } |
| 1313 | 1314 |
| 1314 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1315 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1315 // Only honor the request if appropriate persmissions are granted. | 1316 // Only honor the request if appropriate persmissions are granted. |
| 1316 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1317 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1317 content::GetContentClient()->browser()->OpenItem(path); | 1318 content::GetContentClient()->browser()->OpenItem(path); |
| 1318 } | 1319 } |
| 1319 | 1320 |
| 1320 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1321 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1321 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1322 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1322 MHTMLGenerated(job_id, data_size); | 1323 MHTMLGenerated(job_id, data_size); |
| 1323 } | 1324 } |
| OLD | NEW |