OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" | 44 #include "content/browser/browser_plugin/browser_plugin_message_filter.h" |
45 #include "content/browser/child_process_security_policy_impl.h" | 45 #include "content/browser/child_process_security_policy_impl.h" |
46 #include "content/browser/device_orientation/device_motion_message_filter.h" | 46 #include "content/browser/device_orientation/device_motion_message_filter.h" |
47 #include "content/browser/device_orientation/device_orientation_message_filter.h
" | 47 #include "content/browser/device_orientation/device_orientation_message_filter.h
" |
48 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" | 48 #include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
49 #include "content/browser/dom_storage/dom_storage_message_filter.h" | 49 #include "content/browser/dom_storage/dom_storage_message_filter.h" |
50 #include "content/browser/download/mhtml_generation_manager.h" | 50 #include "content/browser/download/mhtml_generation_manager.h" |
51 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 51 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
52 #include "content/browser/fileapi/fileapi_message_filter.h" | 52 #include "content/browser/fileapi/fileapi_message_filter.h" |
53 #include "content/browser/frame_host/render_frame_message_filter.h" | 53 #include "content/browser/frame_host/render_frame_message_filter.h" |
54 #include "content/browser/geolocation/geolocation_dispatcher_host.h" | |
55 #include "content/browser/gpu/compositor_util.h" | 54 #include "content/browser/gpu/compositor_util.h" |
56 #include "content/browser/gpu/gpu_data_manager_impl.h" | 55 #include "content/browser/gpu/gpu_data_manager_impl.h" |
57 #include "content/browser/gpu/gpu_process_host.h" | 56 #include "content/browser/gpu/gpu_process_host.h" |
58 #include "content/browser/gpu/shader_disk_cache.h" | 57 #include "content/browser/gpu/shader_disk_cache.h" |
59 #include "content/browser/histogram_message_filter.h" | 58 #include "content/browser/histogram_message_filter.h" |
60 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 59 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
61 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" | 60 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
62 #include "content/browser/loader/resource_message_filter.h" | 61 #include "content/browser/loader/resource_message_filter.h" |
63 #include "content/browser/loader/resource_scheduler_filter.h" | 62 #include "content/browser/loader/resource_scheduler_filter.h" |
64 #include "content/browser/media/android/browser_demuxer_android.h" | 63 #include "content/browser/media/android/browser_demuxer_android.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 this, &RenderProcessHostImpl::ClearTransportDIBCache), | 366 this, &RenderProcessHostImpl::ClearTransportDIBCache), |
368 is_initialized_(false), | 367 is_initialized_(false), |
369 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 368 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
370 browser_context_(browser_context), | 369 browser_context_(browser_context), |
371 storage_partition_impl_(storage_partition_impl), | 370 storage_partition_impl_(storage_partition_impl), |
372 sudden_termination_allowed_(true), | 371 sudden_termination_allowed_(true), |
373 ignore_input_events_(false), | 372 ignore_input_events_(false), |
374 supports_browser_plugin_(supports_browser_plugin), | 373 supports_browser_plugin_(supports_browser_plugin), |
375 is_guest_(is_guest), | 374 is_guest_(is_guest), |
376 gpu_observer_registered_(false), | 375 gpu_observer_registered_(false), |
377 power_monitor_broadcaster_(this) { | 376 power_monitor_broadcaster_(this), |
| 377 geolocation_dispatcher_host_(NULL) { |
378 widget_helper_ = new RenderWidgetHelper(); | 378 widget_helper_ = new RenderWidgetHelper(); |
379 | 379 |
380 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 380 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
381 | 381 |
382 CHECK(!g_exited_main_message_loop); | 382 CHECK(!g_exited_main_message_loop); |
383 RegisterHost(GetID(), this); | 383 RegisterHost(GetID(), this); |
384 g_all_hosts.Get().set_check_on_null_data(true); | 384 g_all_hosts.Get().set_check_on_null_data(true); |
385 // Initialize |child_process_activity_time_| to a reasonable value. | 385 // Initialize |child_process_activity_time_| to a reasonable value. |
386 mark_child_process_activity_time(); | 386 mark_child_process_activity_time(); |
387 | 387 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 new ServiceWorkerDispatcherHost(GetID()); | 647 new ServiceWorkerDispatcherHost(GetID()); |
648 service_worker_filter->Init( | 648 service_worker_filter->Init( |
649 storage_partition_impl_->GetServiceWorkerContext()); | 649 storage_partition_impl_->GetServiceWorkerContext()); |
650 AddFilter(service_worker_filter); | 650 AddFilter(service_worker_filter); |
651 | 651 |
652 if (IsGuest()) { | 652 if (IsGuest()) { |
653 if (!g_browser_plugin_geolocation_context.Get().get()) { | 653 if (!g_browser_plugin_geolocation_context.Get().get()) { |
654 g_browser_plugin_geolocation_context.Get() = | 654 g_browser_plugin_geolocation_context.Get() = |
655 new BrowserPluginGeolocationPermissionContext(); | 655 new BrowserPluginGeolocationPermissionContext(); |
656 } | 656 } |
657 AddFilter(GeolocationDispatcherHost::New( | 657 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( |
658 GetID(), g_browser_plugin_geolocation_context.Get().get())); | 658 GetID(), g_browser_plugin_geolocation_context.Get().get()); |
659 } else { | 659 } else { |
660 AddFilter(GeolocationDispatcherHost::New( | 660 geolocation_dispatcher_host_ = GeolocationDispatcherHost::New( |
661 GetID(), browser_context->GetGeolocationPermissionContext())); | 661 GetID(), browser_context->GetGeolocationPermissionContext()); |
662 } | 662 } |
| 663 AddFilter(geolocation_dispatcher_host_); |
663 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 664 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
664 AddFilter(gpu_message_filter_); | 665 AddFilter(gpu_message_filter_); |
665 #if defined(ENABLE_WEBRTC) | 666 #if defined(ENABLE_WEBRTC) |
666 AddFilter(new WebRTCIdentityServiceHost( | 667 AddFilter(new WebRTCIdentityServiceHost( |
667 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); | 668 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); |
668 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); | 669 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); |
669 AddFilter(peer_connection_tracker_host_.get()); | 670 AddFilter(peer_connection_tracker_host_.get()); |
670 AddFilter(new MediaStreamDispatcherHost( | 671 AddFilter(new MediaStreamDispatcherHost( |
671 GetID(), browser_context->GetResourceContext(), media_stream_manager)); | 672 GetID(), browser_context->GetResourceContext(), media_stream_manager)); |
672 AddFilter( | 673 AddFilter( |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1432 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1433 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
1433 deleting_soon_ = true; | 1434 deleting_soon_ = true; |
1434 // It's important not to wait for the DeleteTask to delete the channel | 1435 // It's important not to wait for the DeleteTask to delete the channel |
1435 // proxy. Kill it off now. That way, in case the profile is going away, the | 1436 // proxy. Kill it off now. That way, in case the profile is going away, the |
1436 // rest of the objects attached to this RenderProcessHost start going | 1437 // rest of the objects attached to this RenderProcessHost start going |
1437 // away first, since deleting the channel proxy will post a | 1438 // away first, since deleting the channel proxy will post a |
1438 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. | 1439 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. |
1439 channel_.reset(); | 1440 channel_.reset(); |
1440 gpu_message_filter_ = NULL; | 1441 gpu_message_filter_ = NULL; |
1441 message_port_message_filter_ = NULL; | 1442 message_port_message_filter_ = NULL; |
| 1443 geolocation_dispatcher_host_ = NULL; |
1442 | 1444 |
1443 // Remove ourself from the list of renderer processes so that we can't be | 1445 // Remove ourself from the list of renderer processes so that we can't be |
1444 // reused in between now and when the Delete task runs. | 1446 // reused in between now and when the Delete task runs. |
1445 UnregisterHost(GetID()); | 1447 UnregisterHost(GetID()); |
1446 } | 1448 } |
1447 } | 1449 } |
1448 | 1450 |
1449 void RenderProcessHostImpl::AddPendingView() { | 1451 void RenderProcessHostImpl::AddPendingView() { |
1450 pending_views_++; | 1452 pending_views_++; |
1451 } | 1453 } |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1732 RendererClosedDetails details(GetHandle(), status, exit_code); | 1734 RendererClosedDetails details(GetHandle(), status, exit_code); |
1733 NotificationService::current()->Notify( | 1735 NotificationService::current()->Notify( |
1734 NOTIFICATION_RENDERER_PROCESS_CLOSED, | 1736 NOTIFICATION_RENDERER_PROCESS_CLOSED, |
1735 Source<RenderProcessHost>(this), | 1737 Source<RenderProcessHost>(this), |
1736 Details<RendererClosedDetails>(&details)); | 1738 Details<RendererClosedDetails>(&details)); |
1737 | 1739 |
1738 child_process_launcher_.reset(); | 1740 child_process_launcher_.reset(); |
1739 channel_.reset(); | 1741 channel_.reset(); |
1740 gpu_message_filter_ = NULL; | 1742 gpu_message_filter_ = NULL; |
1741 message_port_message_filter_ = NULL; | 1743 message_port_message_filter_ = NULL; |
| 1744 geolocation_dispatcher_host_ = NULL; |
1742 | 1745 |
1743 IDMap<IPC::Listener>::iterator iter(&listeners_); | 1746 IDMap<IPC::Listener>::iterator iter(&listeners_); |
1744 while (!iter.IsAtEnd()) { | 1747 while (!iter.IsAtEnd()) { |
1745 iter.GetCurrentValue()->OnMessageReceived( | 1748 iter.GetCurrentValue()->OnMessageReceived( |
1746 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), | 1749 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), |
1747 static_cast<int>(status), | 1750 static_cast<int>(status), |
1748 exit_code)); | 1751 exit_code)); |
1749 iter.Advance(); | 1752 iter.Advance(); |
1750 } | 1753 } |
1751 | 1754 |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1908 // Skip widgets in other processes. | 1911 // Skip widgets in other processes. |
1909 if (widget->GetProcess()->GetID() != GetID()) | 1912 if (widget->GetProcess()->GetID() != GetID()) |
1910 continue; | 1913 continue; |
1911 | 1914 |
1912 RenderViewHost* rvh = RenderViewHost::From(widget); | 1915 RenderViewHost* rvh = RenderViewHost::From(widget); |
1913 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); | 1916 rvh->UpdateWebkitPreferences(rvh->GetWebkitPreferences()); |
1914 } | 1917 } |
1915 } | 1918 } |
1916 | 1919 |
1917 } // namespace content | 1920 } // namespace content |
OLD | NEW |