| 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 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "base/metrics/histogram.h" | 26 #include "base/metrics/histogram.h" |
| 27 #include "base/path_service.h" | 27 #include "base/path_service.h" |
| 28 #include "base/platform_file.h" | 28 #include "base/platform_file.h" |
| 29 #include "base/process_util.h" | 29 #include "base/process_util.h" |
| 30 #include "base/rand_util.h" | 30 #include "base/rand_util.h" |
| 31 #include "base/stl_util.h" | 31 #include "base/stl_util.h" |
| 32 #include "base/string_util.h" | 32 #include "base/string_util.h" |
| 33 #include "base/sys_info.h" | 33 #include "base/sys_info.h" |
| 34 #include "base/threading/thread.h" | 34 #include "base/threading/thread.h" |
| 35 #include "base/threading/thread_restrictions.h" | 35 #include "base/threading/thread_restrictions.h" |
| 36 #include "base/tracked_objects.h" |
| 36 #include "content/browser/appcache/appcache_dispatcher_host.h" | 37 #include "content/browser/appcache/appcache_dispatcher_host.h" |
| 37 #include "content/browser/browser_child_process_host.h" | 38 #include "content/browser/browser_child_process_host.h" |
| 38 #include "content/browser/browser_context.h" | 39 #include "content/browser/browser_context.h" |
| 39 #include "content/browser/browser_main.h" | 40 #include "content/browser/browser_main.h" |
| 40 #include "content/browser/child_process_security_policy.h" | 41 #include "content/browser/child_process_security_policy.h" |
| 41 #include "content/browser/device_orientation/message_filter.h" | 42 #include "content/browser/device_orientation/message_filter.h" |
| 42 #include "content/browser/download/mhtml_generation_manager.h" | 43 #include "content/browser/download/mhtml_generation_manager.h" |
| 43 #include "content/browser/file_system/file_system_dispatcher_host.h" | 44 #include "content/browser/file_system/file_system_dispatcher_host.h" |
| 44 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | 45 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
| 45 #include "content/browser/gpu/gpu_data_manager.h" | 46 #include "content/browser/gpu/gpu_data_manager.h" |
| 46 #include "content/browser/gpu/gpu_process_host.h" | 47 #include "content/browser/gpu/gpu_process_host.h" |
| 47 #include "content/browser/in_process_webkit/dom_storage_message_filter.h" | 48 #include "content/browser/in_process_webkit/dom_storage_message_filter.h" |
| 48 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" | 49 #include "content/browser/in_process_webkit/indexed_db_dispatcher_host.h" |
| 49 #include "content/browser/mime_registry_message_filter.h" | 50 #include "content/browser/mime_registry_message_filter.h" |
| 50 #include "content/browser/plugin_service.h" | 51 #include "content/browser/plugin_service.h" |
| 52 #include "content/browser/profiler_message_filter.h" |
| 51 #include "content/browser/renderer_host/blob_message_filter.h" | 53 #include "content/browser/renderer_host/blob_message_filter.h" |
| 52 #include "content/browser/renderer_host/clipboard_message_filter.h" | 54 #include "content/browser/renderer_host/clipboard_message_filter.h" |
| 53 #include "content/browser/renderer_host/database_message_filter.h" | 55 #include "content/browser/renderer_host/database_message_filter.h" |
| 54 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 56 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
| 55 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" | 57 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" |
| 56 #include "content/browser/renderer_host/gpu_message_filter.h" | 58 #include "content/browser/renderer_host/gpu_message_filter.h" |
| 57 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 59 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
| 58 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 60 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 59 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" | 61 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
| 60 #include "content/browser/renderer_host/media/video_capture_host.h" | 62 #include "content/browser/renderer_host/media/video_capture_host.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 &GetBrowserContext()->GetResourceContext())); | 528 &GetBrowserContext()->GetResourceContext())); |
| 527 #endif | 529 #endif |
| 528 | 530 |
| 529 channel_->AddFilter(new TraceMessageFilter()); | 531 channel_->AddFilter(new TraceMessageFilter()); |
| 530 channel_->AddFilter(new ResolveProxyMsgHelper( | 532 channel_->AddFilter(new ResolveProxyMsgHelper( |
| 531 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()))); | 533 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()))); |
| 532 channel_->AddFilter(new QuotaDispatcherHost( | 534 channel_->AddFilter(new QuotaDispatcherHost( |
| 533 GetID(), GetBrowserContext()->GetQuotaManager(), | 535 GetID(), GetBrowserContext()->GetQuotaManager(), |
| 534 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); | 536 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); |
| 535 channel_->AddFilter(new GamepadBrowserMessageFilter); | 537 channel_->AddFilter(new GamepadBrowserMessageFilter); |
| 538 channel_->AddFilter(new ProfilerMessageFilter()); |
| 536 } | 539 } |
| 537 | 540 |
| 538 int RenderProcessHostImpl::GetNextRoutingID() { | 541 int RenderProcessHostImpl::GetNextRoutingID() { |
| 539 return widget_helper_->GetNextRoutingID(); | 542 return widget_helper_->GetNextRoutingID(); |
| 540 } | 543 } |
| 541 | 544 |
| 542 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { | 545 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { |
| 543 if (page_id > max_page_id_) | 546 if (page_id > max_page_id_) |
| 544 Send(new ViewMsg_SetNextPageID(page_id + 1)); | 547 Send(new ViewMsg_SetNextPageID(page_id + 1)); |
| 545 UpdateMaxPageID(page_id); | 548 UpdateMaxPageID(page_id); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 } | 930 } |
| 928 return listener->OnMessageReceived(msg); | 931 return listener->OnMessageReceived(msg); |
| 929 } | 932 } |
| 930 | 933 |
| 931 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { | 934 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { |
| 932 #if defined(IPC_MESSAGE_LOG_ENABLED) | 935 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 933 Send(new ChildProcessMsg_SetIPCLoggingEnabled( | 936 Send(new ChildProcessMsg_SetIPCLoggingEnabled( |
| 934 IPC::Logging::GetInstance()->Enabled())); | 937 IPC::Logging::GetInstance()->Enabled())); |
| 935 #endif | 938 #endif |
| 936 | 939 |
| 940 bool enable = tracked_objects::ThreadData::tracking_status(); |
| 941 Send(new ChildProcessMsg_SetProfilerStatus(enable)); |
| 942 |
| 937 // Make sure the child checks with us before exiting, so that we do not try | 943 // Make sure the child checks with us before exiting, so that we do not try |
| 938 // to schedule a new navigation in a swapped out and exiting renderer. | 944 // to schedule a new navigation in a swapped out and exiting renderer. |
| 939 Send(new ChildProcessMsg_AskBeforeShutdown()); | 945 Send(new ChildProcessMsg_AskBeforeShutdown()); |
| 940 } | 946 } |
| 941 | 947 |
| 942 void RenderProcessHostImpl::OnChannelError() { | 948 void RenderProcessHostImpl::OnChannelError() { |
| 943 if (!channel_.get()) | 949 if (!channel_.get()) |
| 944 return; | 950 return; |
| 945 | 951 |
| 946 // Store the handle before it gets changed. | 952 // Store the handle before it gets changed. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1313 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1308 // Only honor the request if appropriate persmissions are granted. | 1314 // Only honor the request if appropriate persmissions are granted. |
| 1309 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1315 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1310 content::GetContentClient()->browser()->OpenItem(path); | 1316 content::GetContentClient()->browser()->OpenItem(path); |
| 1311 } | 1317 } |
| 1312 | 1318 |
| 1313 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1319 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1314 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1320 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1315 MHTMLGenerated(job_id, data_size); | 1321 MHTMLGenerated(job_id, data_size); |
| 1316 } | 1322 } |
| OLD | NEW |