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/gpu_message_filter.h" | 57 #include "content/browser/renderer_host/gpu_message_filter.h" |
56 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 58 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
57 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 59 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
58 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" | 60 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
59 #include "content/browser/renderer_host/media/video_capture_host.h" | 61 #include "content/browser/renderer_host/media/video_capture_host.h" |
60 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" | 62 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 channel_->AddFilter(new content::P2PSocketDispatcherHost( | 527 channel_->AddFilter(new content::P2PSocketDispatcherHost( |
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())); |
| 537 channel_->AddFilter(new ProfilerMessageFilter()); |
535 } | 538 } |
536 | 539 |
537 int RenderProcessHostImpl::GetNextRoutingID() { | 540 int RenderProcessHostImpl::GetNextRoutingID() { |
538 return widget_helper_->GetNextRoutingID(); | 541 return widget_helper_->GetNextRoutingID(); |
539 } | 542 } |
540 | 543 |
541 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { | 544 void RenderProcessHostImpl::UpdateAndSendMaxPageID(int32 page_id) { |
542 if (page_id > max_page_id_) | 545 if (page_id > max_page_id_) |
543 Send(new ViewMsg_SetNextPageID(page_id + 1)); | 546 Send(new ViewMsg_SetNextPageID(page_id + 1)); |
544 UpdateMaxPageID(page_id); | 547 UpdateMaxPageID(page_id); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
924 } | 927 } |
925 return listener->OnMessageReceived(msg); | 928 return listener->OnMessageReceived(msg); |
926 } | 929 } |
927 | 930 |
928 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { | 931 void RenderProcessHostImpl::OnChannelConnected(int32 peer_pid) { |
929 #if defined(IPC_MESSAGE_LOG_ENABLED) | 932 #if defined(IPC_MESSAGE_LOG_ENABLED) |
930 Send(new ChildProcessMsg_SetIPCLoggingEnabled( | 933 Send(new ChildProcessMsg_SetIPCLoggingEnabled( |
931 IPC::Logging::GetInstance()->Enabled())); | 934 IPC::Logging::GetInstance()->Enabled())); |
932 #endif | 935 #endif |
933 | 936 |
| 937 bool enable = tracked_objects::ThreadData::tracking_status(); |
| 938 Send(new ChildProcessMsg_SetProfilerStatus(enable)); |
| 939 |
934 // Make sure the child checks with us before exiting, so that we do not try | 940 // Make sure the child checks with us before exiting, so that we do not try |
935 // to schedule a new navigation in a swapped out and exiting renderer. | 941 // to schedule a new navigation in a swapped out and exiting renderer. |
936 Send(new ChildProcessMsg_AskBeforeShutdown()); | 942 Send(new ChildProcessMsg_AskBeforeShutdown()); |
937 } | 943 } |
938 | 944 |
939 void RenderProcessHostImpl::OnChannelError() { | 945 void RenderProcessHostImpl::OnChannelError() { |
940 if (!channel_.get()) | 946 if (!channel_.get()) |
941 return; | 947 return; |
942 | 948 |
943 // Store the handle before it gets changed. | 949 // Store the handle before it gets changed. |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { | 1310 void RenderProcessHostImpl::OnRevealFolderInOS(const FilePath& path) { |
1305 // Only honor the request if appropriate persmissions are granted. | 1311 // Only honor the request if appropriate persmissions are granted. |
1306 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) | 1312 if (ChildProcessSecurityPolicy::GetInstance()->CanReadFile(GetID(), path)) |
1307 content::GetContentClient()->browser()->OpenItem(path); | 1313 content::GetContentClient()->browser()->OpenItem(path); |
1308 } | 1314 } |
1309 | 1315 |
1310 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { | 1316 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { |
1311 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> | 1317 content::GetContentClient()->browser()->GetMHTMLGenerationManager()-> |
1312 MHTMLGenerated(job_id, data_size); | 1318 MHTMLGenerated(job_id, data_size); |
1313 } | 1319 } |
OLD | NEW |