| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 #include "content/browser/notifications/notification_message_filter.h" | 85 #include "content/browser/notifications/notification_message_filter.h" |
| 86 #include "content/browser/permissions/permission_service_context.h" | 86 #include "content/browser/permissions/permission_service_context.h" |
| 87 #include "content/browser/permissions/permission_service_impl.h" | 87 #include "content/browser/permissions/permission_service_impl.h" |
| 88 #include "content/browser/profiler_message_filter.h" | 88 #include "content/browser/profiler_message_filter.h" |
| 89 #include "content/browser/push_messaging/push_messaging_message_filter.h" | 89 #include "content/browser/push_messaging/push_messaging_message_filter.h" |
| 90 #include "content/browser/quota_dispatcher_host.h" | 90 #include "content/browser/quota_dispatcher_host.h" |
| 91 #include "content/browser/renderer_host/clipboard_message_filter.h" | 91 #include "content/browser/renderer_host/clipboard_message_filter.h" |
| 92 #include "content/browser/renderer_host/database_message_filter.h" | 92 #include "content/browser/renderer_host/database_message_filter.h" |
| 93 #include "content/browser/renderer_host/file_utilities_message_filter.h" | 93 #include "content/browser/renderer_host/file_utilities_message_filter.h" |
| 94 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" | 94 #include "content/browser/renderer_host/gamepad_browser_message_filter.h" |
| 95 #include "content/browser/renderer_host/gpu_message_filter.h" | |
| 96 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" | 95 #include "content/browser/renderer_host/media/audio_input_renderer_host.h" |
| 97 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 96 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 98 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" | 97 #include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" |
| 99 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" | 98 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" |
| 100 #include "content/browser/renderer_host/media/video_capture_host.h" | 99 #include "content/browser/renderer_host/media/video_capture_host.h" |
| 101 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" | 100 #include "content/browser/renderer_host/pepper/pepper_message_filter.h" |
| 102 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" | 101 #include "content/browser/renderer_host/pepper/pepper_renderer_connection.h" |
| 103 #include "content/browser/renderer_host/render_message_filter.h" | 102 #include "content/browser/renderer_host/render_message_filter.h" |
| 104 #include "content/browser/renderer_host/render_view_host_delegate.h" | 103 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 105 #include "content/browser/renderer_host/render_view_host_impl.h" | 104 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 106 #include "content/browser/renderer_host/render_widget_helper.h" | 105 #include "content/browser/renderer_host/render_widget_helper.h" |
| 107 #include "content/browser/renderer_host/render_widget_host_impl.h" | 106 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 108 #include "content/browser/renderer_host/text_input_client_message_filter.h" | 107 #include "content/browser/renderer_host/text_input_client_message_filter.h" |
| 109 #include "content/browser/renderer_host/websocket_dispatcher_host.h" | 108 #include "content/browser/renderer_host/websocket_dispatcher_host.h" |
| 110 #include "content/browser/resolve_proxy_msg_helper.h" | 109 #include "content/browser/resolve_proxy_msg_helper.h" |
| 111 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 110 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
| 112 #include "content/browser/service_worker/service_worker_dispatcher_host.h" | 111 #include "content/browser/service_worker/service_worker_dispatcher_host.h" |
| 113 #include "content/browser/shared_worker/shared_worker_message_filter.h" | 112 #include "content/browser/shared_worker/shared_worker_message_filter.h" |
| 114 #include "content/browser/shared_worker/worker_storage_partition.h" | 113 #include "content/browser/shared_worker/worker_storage_partition.h" |
| 115 #include "content/browser/speech/speech_recognition_dispatcher_host.h" | 114 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
| 116 #include "content/browser/storage_partition_impl.h" | 115 #include "content/browser/storage_partition_impl.h" |
| 117 #include "content/browser/streams/stream_context.h" | 116 #include "content/browser/streams/stream_context.h" |
| 118 #include "content/browser/tracing/trace_message_filter.h" | 117 #include "content/browser/tracing/trace_message_filter.h" |
| 119 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 118 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 120 #include "content/common/child_process_host_impl.h" | 119 #include "content/common/child_process_host_impl.h" |
| 121 #include "content/common/child_process_messages.h" | 120 #include "content/common/child_process_messages.h" |
| 122 #include "content/common/content_switches_internal.h" | 121 #include "content/common/content_switches_internal.h" |
| 123 #include "content/common/frame_messages.h" | 122 #include "content/common/frame_messages.h" |
| 124 #include "content/common/gpu/gpu_host_messages.h" | |
| 125 #include "content/common/in_process_child_thread_params.h" | 123 #include "content/common/in_process_child_thread_params.h" |
| 126 #include "content/common/mojo/channel_init.h" | 124 #include "content/common/mojo/channel_init.h" |
| 127 #include "content/common/mojo/mojo_messages.h" | 125 #include "content/common/mojo/mojo_messages.h" |
| 128 #include "content/common/mojo/mojo_shell_connection_impl.h" | 126 #include "content/common/mojo/mojo_shell_connection_impl.h" |
| 129 #include "content/common/render_process_messages.h" | 127 #include "content/common/render_process_messages.h" |
| 130 #include "content/common/resource_messages.h" | 128 #include "content/common/resource_messages.h" |
| 131 #include "content/common/site_isolation_policy.h" | 129 #include "content/common/site_isolation_policy.h" |
| 132 #include "content/common/view_messages.h" | 130 #include "content/common/view_messages.h" |
| 131 #include "content/gpu/gpu_host_messages.h" |
| 133 #include "content/public/browser/browser_context.h" | 132 #include "content/public/browser/browser_context.h" |
| 134 #include "content/public/browser/content_browser_client.h" | 133 #include "content/public/browser/content_browser_client.h" |
| 135 #include "content/public/browser/navigator_connect_context.h" | 134 #include "content/public/browser/navigator_connect_context.h" |
| 136 #include "content/public/browser/notification_service.h" | 135 #include "content/public/browser/notification_service.h" |
| 137 #include "content/public/browser/notification_types.h" | 136 #include "content/public/browser/notification_types.h" |
| 138 #include "content/public/browser/render_process_host_factory.h" | 137 #include "content/public/browser/render_process_host_factory.h" |
| 139 #include "content/public/browser/render_process_host_observer.h" | 138 #include "content/public/browser/render_process_host_observer.h" |
| 140 #include "content/public/browser/render_widget_host.h" | 139 #include "content/public/browser/render_widget_host.h" |
| 141 #include "content/public/browser/render_widget_host_iterator.h" | 140 #include "content/public/browser/render_widget_host_iterator.h" |
| 142 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 141 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 AddFilter(new AppCacheDispatcherHost( | 934 AddFilter(new AppCacheDispatcherHost( |
| 936 storage_partition_impl_->GetAppCacheService(), GetID())); | 935 storage_partition_impl_->GetAppCacheService(), GetID())); |
| 937 AddFilter(new ClipboardMessageFilter); | 936 AddFilter(new ClipboardMessageFilter); |
| 938 AddFilter(new DOMStorageMessageFilter( | 937 AddFilter(new DOMStorageMessageFilter( |
| 939 storage_partition_impl_->GetDOMStorageContext())); | 938 storage_partition_impl_->GetDOMStorageContext())); |
| 940 AddFilter(new IndexedDBDispatcherHost( | 939 AddFilter(new IndexedDBDispatcherHost( |
| 941 GetID(), storage_partition_impl_->GetURLRequestContext(), | 940 GetID(), storage_partition_impl_->GetURLRequestContext(), |
| 942 storage_partition_impl_->GetIndexedDBContext(), | 941 storage_partition_impl_->GetIndexedDBContext(), |
| 943 blob_storage_context.get())); | 942 blob_storage_context.get())); |
| 944 | 943 |
| 945 gpu_message_filter_ = new GpuMessageFilter(GetID()); | |
| 946 AddFilter(gpu_message_filter_); | |
| 947 #if defined(ENABLE_WEBRTC) | 944 #if defined(ENABLE_WEBRTC) |
| 948 AddFilter(new WebRTCIdentityServiceHost( | 945 AddFilter(new WebRTCIdentityServiceHost( |
| 949 GetID(), storage_partition_impl_->GetWebRTCIdentityStore(), | 946 GetID(), storage_partition_impl_->GetWebRTCIdentityStore(), |
| 950 resource_context)); | 947 resource_context)); |
| 951 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); | 948 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); |
| 952 AddFilter(peer_connection_tracker_host_.get()); | 949 AddFilter(peer_connection_tracker_host_.get()); |
| 953 AddFilter(new MediaStreamDispatcherHost( | 950 AddFilter(new MediaStreamDispatcherHost( |
| 954 GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), | 951 GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), |
| 955 media_stream_manager)); | 952 media_stream_manager)); |
| 956 AddFilter(new MediaStreamTrackMetricsHost()); | 953 AddFilter(new MediaStreamTrackMetricsHost()); |
| (...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1956 #endif | 1953 #endif |
| 1957 | 1954 |
| 1958 // It's important not to wait for the DeleteTask to delete the channel | 1955 // It's important not to wait for the DeleteTask to delete the channel |
| 1959 // proxy. Kill it off now. That way, in case the profile is going away, the | 1956 // proxy. Kill it off now. That way, in case the profile is going away, the |
| 1960 // rest of the objects attached to this RenderProcessHost start going | 1957 // rest of the objects attached to this RenderProcessHost start going |
| 1961 // away first, since deleting the channel proxy will post a | 1958 // away first, since deleting the channel proxy will post a |
| 1962 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. | 1959 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. |
| 1963 channel_.reset(); | 1960 channel_.reset(); |
| 1964 | 1961 |
| 1965 // The following members should be cleared in ProcessDied() as well! | 1962 // The following members should be cleared in ProcessDied() as well! |
| 1966 gpu_message_filter_ = NULL; | |
| 1967 message_port_message_filter_ = NULL; | 1963 message_port_message_filter_ = NULL; |
| 1968 | 1964 |
| 1969 RemoveUserData(kSessionStorageHolderKey); | 1965 RemoveUserData(kSessionStorageHolderKey); |
| 1970 | 1966 |
| 1971 // On shutdown, |this| may not be deleted because the deleter is posted to | 1967 // On shutdown, |this| may not be deleted because the deleter is posted to |
| 1972 // the current MessageLoop, but MessageLoop deletes all its pending | 1968 // the current MessageLoop, but MessageLoop deletes all its pending |
| 1973 // callbacks on shutdown. Since the deleter takes |this| as a raw pointer, | 1969 // callbacks on shutdown. Since the deleter takes |this| as a raw pointer, |
| 1974 // deleting the callback doesn't delete |this| resulting in a memory leak. | 1970 // deleting the callback doesn't delete |this| resulting in a memory leak. |
| 1975 // Valgrind complains, so delete |mojo_application_host_| explicitly here to | 1971 // Valgrind complains, so delete |mojo_application_host_| explicitly here to |
| 1976 // stop valgrind from complaining. | 1972 // stop valgrind from complaining. |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2443 mojo_application_host_.reset(new MojoApplicationHost); | 2439 mojo_application_host_.reset(new MojoApplicationHost); |
| 2444 | 2440 |
| 2445 within_process_died_observer_ = true; | 2441 within_process_died_observer_ = true; |
| 2446 NotificationService::current()->Notify( | 2442 NotificationService::current()->Notify( |
| 2447 NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this), | 2443 NOTIFICATION_RENDERER_PROCESS_CLOSED, Source<RenderProcessHost>(this), |
| 2448 Details<RendererClosedDetails>(&details)); | 2444 Details<RendererClosedDetails>(&details)); |
| 2449 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, | 2445 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_, |
| 2450 RenderProcessExited(this, status, exit_code)); | 2446 RenderProcessExited(this, status, exit_code)); |
| 2451 within_process_died_observer_ = false; | 2447 within_process_died_observer_ = false; |
| 2452 | 2448 |
| 2453 gpu_message_filter_ = NULL; | |
| 2454 message_port_message_filter_ = NULL; | 2449 message_port_message_filter_ = NULL; |
| 2455 RemoveUserData(kSessionStorageHolderKey); | 2450 RemoveUserData(kSessionStorageHolderKey); |
| 2456 | 2451 |
| 2457 IDMap<IPC::Listener>::iterator iter(&listeners_); | 2452 IDMap<IPC::Listener>::iterator iter(&listeners_); |
| 2458 while (!iter.IsAtEnd()) { | 2453 while (!iter.IsAtEnd()) { |
| 2459 iter.GetCurrentValue()->OnMessageReceived(FrameHostMsg_RenderProcessGone( | 2454 iter.GetCurrentValue()->OnMessageReceived(FrameHostMsg_RenderProcessGone( |
| 2460 iter.GetCurrentKey(), static_cast<int>(status), exit_code)); | 2455 iter.GetCurrentKey(), static_cast<int>(status), exit_code)); |
| 2461 iter.Advance(); | 2456 iter.Advance(); |
| 2462 } | 2457 } |
| 2463 | 2458 |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2818 | 2813 |
| 2819 // Skip widgets in other processes. | 2814 // Skip widgets in other processes. |
| 2820 if (rvh->GetProcess()->GetID() != GetID()) | 2815 if (rvh->GetProcess()->GetID() != GetID()) |
| 2821 continue; | 2816 continue; |
| 2822 | 2817 |
| 2823 rvh->OnWebkitPreferencesChanged(); | 2818 rvh->OnWebkitPreferencesChanged(); |
| 2824 } | 2819 } |
| 2825 } | 2820 } |
| 2826 | 2821 |
| 2827 } // namespace content | 2822 } // namespace content |
| OLD | NEW |