| 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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 &GetBrowserContext()->GetResourceContext())); | 532 &GetBrowserContext()->GetResourceContext())); |
| 531 #endif | 533 #endif |
| 532 | 534 |
| 533 channel_->AddFilter(new TraceMessageFilter()); | 535 channel_->AddFilter(new TraceMessageFilter()); |
| 534 channel_->AddFilter(new ResolveProxyMsgHelper( | 536 channel_->AddFilter(new ResolveProxyMsgHelper( |
| 535 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()))); | 537 GetBrowserContext()->GetRequestContextForRenderProcess(GetID()))); |
| 536 channel_->AddFilter(new QuotaDispatcherHost( | 538 channel_->AddFilter(new QuotaDispatcherHost( |
| 537 GetID(), GetBrowserContext()->GetQuotaManager(), | 539 GetID(), GetBrowserContext()->GetQuotaManager(), |
| 538 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); | 540 content::GetContentClient()->browser()->CreateQuotaPermissionContext())); |
| 539 channel_->AddFilter(new GamepadBrowserMessageFilter); | 541 channel_->AddFilter(new GamepadBrowserMessageFilter); |
| 542 channel_->AddFilter(new ProfilerMessageFilter()); |
| 540 } | 543 } |
| 541 | 544 |
| 542 int RenderProcessHostImpl::GetNextRoutingID() { | 545 int RenderProcessHostImpl::GetNextRoutingID() { |
| 543 return widget_helper_->GetNextRoutingID(); | 546 return widget_helper_->GetNextRoutingID(); |
| 544 } | 547 } |
| 545 | 548 |
| 546 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { | 549 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { |
| 547 if (page_id > max_page_id_) | 550 if (page_id > max_page_id_) |
| 548 Send(new ViewMsg_SetNextPageID(page_id + 1)); | 551 Send(new ViewMsg_SetNextPageID(page_id + 1)); |
| 549 UpdateMaxPageID(page_id); | 552 UpdateMaxPageID(page_id); |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 } | 937 } |
| 935 return listener->OnMessageReceived(msg); | 938 return listener->OnMessageReceived(msg); |
| 936 } | 939 } |
| 937 | 940 |
| 938 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { | 941 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { |
| 939 #if defined(IPC_MESSAGE_LOG_ENABLED) | 942 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 940 Send(new ChildProcessMsg_SetIPCLoggingEnabled( | 943 Send(new ChildProcessMsg_SetIPCLoggingEnabled( |
| 941 IPC::Logging::GetInstance()->Enabled())); | 944 IPC::Logging::GetInstance()->Enabled())); |
| 942 #endif | 945 #endif |
| 943 | 946 |
| 947 bool enable = tracked_objects::ThreadData::tracking_status(); |
| 948 Send(new ChildProcessMsg_SetProfilerStatus(enable)); |
| 949 |
| 944 // Make sure the child checks with us before exiting, so that we do not try | 950 // Make sure the child checks with us before exiting, so that we do not try |
| 945 // to schedule a new navigation in a swapped out and exiting renderer. | 951 // to schedule a new navigation in a swapped out and exiting renderer. |
| 946 Send(new ChildProcessMsg_AskBeforeShutdown()); | 952 Send(new ChildProcessMsg_AskBeforeShutdown()); |
| 947 } | 953 } |
| 948 | 954 |
| 949 void RenderProcessHostImpl::OnChannelError() { | 955 void RenderProcessHostImpl::OnChannelError() { |
| 950 if (!channel_.get()) | 956 if (!channel_.get()) |
| 951 return; | 957 return; |
| 952 | 958 |
| 953 // Store the handle before it gets changed. | 959 // Store the handle before it gets changed. |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1320 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
| 1315 // Only honor the request if appropriate persmissions are granted. | 1321 // Only honor the request if appropriate persmissions are granted. |
| 1316 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1322 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
| 1317 content::GetContentClient()->browser()->OpenItem(path); | 1323 content::GetContentClient()->browser()->OpenItem(path); |
| 1318 } | 1324 } |
| 1319 | 1325 |
| 1320 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1326 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
| 1321 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1327 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
| 1322 MHTMLGenerated(job_id, data_size); | 1328 MHTMLGenerated(job_id, data_size); |
| 1323 } | 1329 } |
| OLD | NEW |