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 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), | 404 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), |
405 browser_context_(browser_context), | 405 browser_context_(browser_context), |
406 storage_partition_impl_(storage_partition_impl), | 406 storage_partition_impl_(storage_partition_impl), |
407 sudden_termination_allowed_(true), | 407 sudden_termination_allowed_(true), |
408 ignore_input_events_(false), | 408 ignore_input_events_(false), |
409 is_guest_(is_guest), | 409 is_guest_(is_guest), |
410 gpu_observer_registered_(false), | 410 gpu_observer_registered_(false), |
411 delayed_cleanup_needed_(false), | 411 delayed_cleanup_needed_(false), |
412 within_process_died_observer_(false), | 412 within_process_died_observer_(false), |
413 power_monitor_broadcaster_(this), | 413 power_monitor_broadcaster_(this), |
414 geolocation_dispatcher_host_(NULL), | |
415 screen_orientation_dispatcher_host_(NULL), | 414 screen_orientation_dispatcher_host_(NULL), |
416 worker_ref_count_(0), | 415 worker_ref_count_(0), |
417 weak_factory_(this) { | 416 weak_factory_(this) { |
418 widget_helper_ = new RenderWidgetHelper(); | 417 widget_helper_ = new RenderWidgetHelper(); |
419 | 418 |
420 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); | 419 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); |
421 | 420 |
422 CHECK(!g_exited_main_message_loop); | 421 CHECK(!g_exited_main_message_loop); |
423 RegisterHost(GetID(), this); | 422 RegisterHost(GetID(), this); |
424 g_all_hosts.Get().set_check_on_null_data(true); | 423 g_all_hosts.Get().set_check_on_null_data(true); |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 AddFilter(new ClipboardMessageFilter); | 697 AddFilter(new ClipboardMessageFilter); |
699 AddFilter(new DOMStorageMessageFilter( | 698 AddFilter(new DOMStorageMessageFilter( |
700 GetID(), | 699 GetID(), |
701 storage_partition_impl_->GetDOMStorageContext())); | 700 storage_partition_impl_->GetDOMStorageContext())); |
702 AddFilter(new IndexedDBDispatcherHost( | 701 AddFilter(new IndexedDBDispatcherHost( |
703 GetID(), | 702 GetID(), |
704 storage_partition_impl_->GetURLRequestContext(), | 703 storage_partition_impl_->GetURLRequestContext(), |
705 storage_partition_impl_->GetIndexedDBContext(), | 704 storage_partition_impl_->GetIndexedDBContext(), |
706 ChromeBlobStorageContext::GetFor(browser_context))); | 705 ChromeBlobStorageContext::GetFor(browser_context))); |
707 | 706 |
708 geolocation_dispatcher_host_ = new GeolocationDispatcherHost( | |
709 GetID(), browser_context->GetGeolocationPermissionContext()); | |
710 AddFilter(geolocation_dispatcher_host_); | |
711 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); | 707 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); |
712 AddFilter(gpu_message_filter_); | 708 AddFilter(gpu_message_filter_); |
713 #if defined(ENABLE_WEBRTC) | 709 #if defined(ENABLE_WEBRTC) |
714 AddFilter(new WebRTCIdentityServiceHost( | 710 AddFilter(new WebRTCIdentityServiceHost( |
715 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); | 711 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); |
716 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); | 712 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); |
717 AddFilter(peer_connection_tracker_host_.get()); | 713 AddFilter(peer_connection_tracker_host_.get()); |
718 AddFilter(new MediaStreamDispatcherHost( | 714 AddFilter(new MediaStreamDispatcherHost( |
719 GetID(), | 715 GetID(), |
720 browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), | 716 browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1445 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1441 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
1446 deleting_soon_ = true; | 1442 deleting_soon_ = true; |
1447 // It's important not to wait for the DeleteTask to delete the channel | 1443 // It's important not to wait for the DeleteTask to delete the channel |
1448 // proxy. Kill it off now. That way, in case the profile is going away, the | 1444 // proxy. Kill it off now. That way, in case the profile is going away, the |
1449 // rest of the objects attached to this RenderProcessHost start going | 1445 // rest of the objects attached to this RenderProcessHost start going |
1450 // away first, since deleting the channel proxy will post a | 1446 // away first, since deleting the channel proxy will post a |
1451 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. | 1447 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. |
1452 channel_.reset(); | 1448 channel_.reset(); |
1453 gpu_message_filter_ = NULL; | 1449 gpu_message_filter_ = NULL; |
1454 message_port_message_filter_ = NULL; | 1450 message_port_message_filter_ = NULL; |
1455 geolocation_dispatcher_host_ = NULL; | |
1456 screen_orientation_dispatcher_host_ = NULL; | 1451 screen_orientation_dispatcher_host_ = NULL; |
1457 | 1452 |
1458 // Remove ourself from the list of renderer processes so that we can't be | 1453 // Remove ourself from the list of renderer processes so that we can't be |
1459 // reused in between now and when the Delete task runs. | 1454 // reused in between now and when the Delete task runs. |
1460 UnregisterHost(GetID()); | 1455 UnregisterHost(GetID()); |
1461 } | 1456 } |
1462 } | 1457 } |
1463 | 1458 |
1464 void RenderProcessHostImpl::AddPendingView() { | 1459 void RenderProcessHostImpl::AddPendingView() { |
1465 pending_views_++; | 1460 pending_views_++; |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1833 Details<RendererClosedDetails>(&details)); | 1828 Details<RendererClosedDetails>(&details)); |
1834 FOR_EACH_OBSERVER(RenderProcessHostObserver, | 1829 FOR_EACH_OBSERVER(RenderProcessHostObserver, |
1835 observers_, | 1830 observers_, |
1836 RenderProcessExited(this, GetHandle(), status, exit_code)); | 1831 RenderProcessExited(this, GetHandle(), status, exit_code)); |
1837 within_process_died_observer_ = false; | 1832 within_process_died_observer_ = false; |
1838 | 1833 |
1839 child_process_launcher_.reset(); | 1834 child_process_launcher_.reset(); |
1840 channel_.reset(); | 1835 channel_.reset(); |
1841 gpu_message_filter_ = NULL; | 1836 gpu_message_filter_ = NULL; |
1842 message_port_message_filter_ = NULL; | 1837 message_port_message_filter_ = NULL; |
1843 geolocation_dispatcher_host_ = NULL; | |
1844 screen_orientation_dispatcher_host_ = NULL; | 1838 screen_orientation_dispatcher_host_ = NULL; |
1845 | 1839 |
1846 IDMap<IPC::Listener>::iterator iter(&listeners_); | 1840 IDMap<IPC::Listener>::iterator iter(&listeners_); |
1847 while (!iter.IsAtEnd()) { | 1841 while (!iter.IsAtEnd()) { |
1848 iter.GetCurrentValue()->OnMessageReceived( | 1842 iter.GetCurrentValue()->OnMessageReceived( |
1849 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), | 1843 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), |
1850 static_cast<int>(status), | 1844 static_cast<int>(status), |
1851 exit_code)); | 1845 exit_code)); |
1852 iter.Advance(); | 1846 iter.Advance(); |
1853 } | 1847 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2079 mojo::ScopedMessagePipeHandle handle) { | 2073 mojo::ScopedMessagePipeHandle handle) { |
2080 mojo_activation_required_ = true; | 2074 mojo_activation_required_ = true; |
2081 MaybeActivateMojo(); | 2075 MaybeActivateMojo(); |
2082 | 2076 |
2083 mojo::AllocationScope scope; | 2077 mojo::AllocationScope scope; |
2084 mojo_application_host_->shell_client()->AcceptConnection(service_name, | 2078 mojo_application_host_->shell_client()->AcceptConnection(service_name, |
2085 handle.Pass()); | 2079 handle.Pass()); |
2086 } | 2080 } |
2087 | 2081 |
2088 } // namespace content | 2082 } // namespace content |
OLD | NEW |