Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(924)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 273523007: Dispatch geolocation IPCs on the UI thread. Aside from simplifying the code to avoid a lot of threa… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix android Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()), 401 id_(ChildProcessHostImpl::GenerateChildProcessUniqueId()),
402 browser_context_(browser_context), 402 browser_context_(browser_context),
403 storage_partition_impl_(storage_partition_impl), 403 storage_partition_impl_(storage_partition_impl),
404 sudden_termination_allowed_(true), 404 sudden_termination_allowed_(true),
405 ignore_input_events_(false), 405 ignore_input_events_(false),
406 is_guest_(is_guest), 406 is_guest_(is_guest),
407 gpu_observer_registered_(false), 407 gpu_observer_registered_(false),
408 delayed_cleanup_needed_(false), 408 delayed_cleanup_needed_(false),
409 within_process_died_observer_(false), 409 within_process_died_observer_(false),
410 power_monitor_broadcaster_(this), 410 power_monitor_broadcaster_(this),
411 geolocation_dispatcher_host_(NULL),
412 screen_orientation_dispatcher_host_(NULL), 411 screen_orientation_dispatcher_host_(NULL),
413 worker_ref_count_(0), 412 worker_ref_count_(0),
414 weak_factory_(this) { 413 weak_factory_(this) {
415 widget_helper_ = new RenderWidgetHelper(); 414 widget_helper_ = new RenderWidgetHelper();
416 415
417 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID()); 416 ChildProcessSecurityPolicyImpl::GetInstance()->Add(GetID());
418 417
419 CHECK(!g_exited_main_message_loop); 418 CHECK(!g_exited_main_message_loop);
420 RegisterHost(GetID(), this); 419 RegisterHost(GetID(), this);
421 g_all_hosts.Get().set_check_on_null_data(true); 420 g_all_hosts.Get().set_check_on_null_data(true);
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 AddFilter(new ClipboardMessageFilter); 694 AddFilter(new ClipboardMessageFilter);
696 AddFilter(new DOMStorageMessageFilter( 695 AddFilter(new DOMStorageMessageFilter(
697 GetID(), 696 GetID(),
698 storage_partition_impl_->GetDOMStorageContext())); 697 storage_partition_impl_->GetDOMStorageContext()));
699 AddFilter(new IndexedDBDispatcherHost( 698 AddFilter(new IndexedDBDispatcherHost(
700 GetID(), 699 GetID(),
701 storage_partition_impl_->GetURLRequestContext(), 700 storage_partition_impl_->GetURLRequestContext(),
702 storage_partition_impl_->GetIndexedDBContext(), 701 storage_partition_impl_->GetIndexedDBContext(),
703 ChromeBlobStorageContext::GetFor(browser_context))); 702 ChromeBlobStorageContext::GetFor(browser_context)));
704 703
705 geolocation_dispatcher_host_ = new GeolocationDispatcherHost(
706 GetID(), browser_context->GetGeolocationPermissionContext());
707 AddFilter(geolocation_dispatcher_host_);
708 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get()); 704 gpu_message_filter_ = new GpuMessageFilter(GetID(), widget_helper_.get());
709 AddFilter(gpu_message_filter_); 705 AddFilter(gpu_message_filter_);
710 #if defined(ENABLE_WEBRTC) 706 #if defined(ENABLE_WEBRTC)
711 AddFilter(new WebRTCIdentityServiceHost( 707 AddFilter(new WebRTCIdentityServiceHost(
712 GetID(), storage_partition_impl_->GetWebRTCIdentityStore())); 708 GetID(), storage_partition_impl_->GetWebRTCIdentityStore()));
713 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); 709 peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID());
714 AddFilter(peer_connection_tracker_host_.get()); 710 AddFilter(peer_connection_tracker_host_.get());
715 AddFilter(new MediaStreamDispatcherHost( 711 AddFilter(new MediaStreamDispatcherHost(
716 GetID(), 712 GetID(),
717 browser_context->GetResourceContext()->GetMediaDeviceIDSalt(), 713 browser_context->GetResourceContext()->GetMediaDeviceIDSalt(),
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1438 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1443 deleting_soon_ = true; 1439 deleting_soon_ = true;
1444 // It's important not to wait for the DeleteTask to delete the channel 1440 // It's important not to wait for the DeleteTask to delete the channel
1445 // proxy. Kill it off now. That way, in case the profile is going away, the 1441 // proxy. Kill it off now. That way, in case the profile is going away, the
1446 // rest of the objects attached to this RenderProcessHost start going 1442 // rest of the objects attached to this RenderProcessHost start going
1447 // away first, since deleting the channel proxy will post a 1443 // away first, since deleting the channel proxy will post a
1448 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1444 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1449 channel_.reset(); 1445 channel_.reset();
1450 gpu_message_filter_ = NULL; 1446 gpu_message_filter_ = NULL;
1451 message_port_message_filter_ = NULL; 1447 message_port_message_filter_ = NULL;
1452 geolocation_dispatcher_host_ = NULL;
1453 screen_orientation_dispatcher_host_ = NULL; 1448 screen_orientation_dispatcher_host_ = NULL;
1454 1449
1455 // Remove ourself from the list of renderer processes so that we can't be 1450 // Remove ourself from the list of renderer processes so that we can't be
1456 // reused in between now and when the Delete task runs. 1451 // reused in between now and when the Delete task runs.
1457 UnregisterHost(GetID()); 1452 UnregisterHost(GetID());
1458 } 1453 }
1459 } 1454 }
1460 1455
1461 void RenderProcessHostImpl::AddPendingView() { 1456 void RenderProcessHostImpl::AddPendingView() {
1462 pending_views_++; 1457 pending_views_++;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 Details<RendererClosedDetails>(&details)); 1825 Details<RendererClosedDetails>(&details));
1831 FOR_EACH_OBSERVER(RenderProcessHostObserver, 1826 FOR_EACH_OBSERVER(RenderProcessHostObserver,
1832 observers_, 1827 observers_,
1833 RenderProcessExited(this, GetHandle(), status, exit_code)); 1828 RenderProcessExited(this, GetHandle(), status, exit_code));
1834 within_process_died_observer_ = false; 1829 within_process_died_observer_ = false;
1835 1830
1836 child_process_launcher_.reset(); 1831 child_process_launcher_.reset();
1837 channel_.reset(); 1832 channel_.reset();
1838 gpu_message_filter_ = NULL; 1833 gpu_message_filter_ = NULL;
1839 message_port_message_filter_ = NULL; 1834 message_port_message_filter_ = NULL;
1840 geolocation_dispatcher_host_ = NULL;
1841 screen_orientation_dispatcher_host_ = NULL; 1835 screen_orientation_dispatcher_host_ = NULL;
1842 1836
1843 IDMap<IPC::Listener>::iterator iter(&listeners_); 1837 IDMap<IPC::Listener>::iterator iter(&listeners_);
1844 while (!iter.IsAtEnd()) { 1838 while (!iter.IsAtEnd()) {
1845 iter.GetCurrentValue()->OnMessageReceived( 1839 iter.GetCurrentValue()->OnMessageReceived(
1846 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1840 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1847 static_cast<int>(status), 1841 static_cast<int>(status),
1848 exit_code)); 1842 exit_code));
1849 iter.Advance(); 1843 iter.Advance();
1850 } 1844 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 mojo::ScopedMessagePipeHandle handle) { 2070 mojo::ScopedMessagePipeHandle handle) {
2077 mojo_activation_required_ = true; 2071 mojo_activation_required_ = true;
2078 MaybeActivateMojo(); 2072 MaybeActivateMojo();
2079 2073
2080 mojo::AllocationScope scope; 2074 mojo::AllocationScope scope;
2081 mojo_application_host_->shell_client()->AcceptConnection(service_name, 2075 mojo_application_host_->shell_client()->AcceptConnection(service_name,
2082 handle.Pass()); 2076 handle.Pass());
2083 } 2077 }
2084 2078
2085 } // namespace content 2079 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698