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

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

Issue 305103003: Fix for 'Simple Adblock' extension crashes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderProcessHost can be a mock in unittests Created 6 years, 6 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 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1308 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) 1308 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg)
1309 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 1309 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
1310 OnShutdownRequest) 1310 OnShutdownRequest)
1311 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone, 1311 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DumpHandlesDone,
1312 OnDumpHandlesDone) 1312 OnDumpHandlesDone)
1313 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged, 1313 IPC_MESSAGE_HANDLER(ViewHostMsg_SuddenTerminationChanged,
1314 SuddenTerminationChanged) 1314 SuddenTerminationChanged)
1315 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 1315 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
1316 OnUserMetricsRecordAction) 1316 OnUserMetricsRecordAction)
1317 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML) 1317 IPC_MESSAGE_HANDLER(ViewHostMsg_SavedPageAsMHTML, OnSavedPageAsMHTML)
1318 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK)
1318 // Adding single handlers for your service here is fine, but once your 1319 // Adding single handlers for your service here is fine, but once your
1319 // service needs more than one handler, please extract them into a new 1320 // service needs more than one handler, please extract them into a new
1320 // message filter and add that filter to CreateMessageFilters(). 1321 // message filter and add that filter to CreateMessageFilters().
1321 IPC_END_MESSAGE_MAP() 1322 IPC_END_MESSAGE_MAP()
1322 1323
1323 return true; 1324 return true;
1324 } 1325 }
1325 1326
1326 // Dispatch incoming messages to the appropriate IPC::Listener. 1327 // Dispatch incoming messages to the appropriate IPC::Listener.
1327 IPC::Listener* listener = listeners_.Lookup(msg.routing_id()); 1328 IPC::Listener* listener = listeners_.Lookup(msg.routing_id());
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 deleting_soon_ = true; 1440 deleting_soon_ = true;
1440 // It's important not to wait for the DeleteTask to delete the channel 1441 // It's important not to wait for the DeleteTask to delete the channel
1441 // proxy. Kill it off now. That way, in case the profile is going away, the 1442 // proxy. Kill it off now. That way, in case the profile is going away, the
1442 // rest of the objects attached to this RenderProcessHost start going 1443 // rest of the objects attached to this RenderProcessHost start going
1443 // away first, since deleting the channel proxy will post a 1444 // away first, since deleting the channel proxy will post a
1444 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread. 1445 // OnChannelClosed() to IPC::ChannelProxy::Context on the IO thread.
1445 channel_.reset(); 1446 channel_.reset();
1446 gpu_message_filter_ = NULL; 1447 gpu_message_filter_ = NULL;
1447 message_port_message_filter_ = NULL; 1448 message_port_message_filter_ = NULL;
1448 screen_orientation_dispatcher_host_ = NULL; 1449 screen_orientation_dispatcher_host_ = NULL;
1450 session_storage_namespaces_awaiting_close_.clear();
1449 1451
1450 // Remove ourself from the list of renderer processes so that we can't be 1452 // Remove ourself from the list of renderer processes so that we can't be
1451 // reused in between now and when the Delete task runs. 1453 // reused in between now and when the Delete task runs.
1452 UnregisterHost(GetID()); 1454 UnregisterHost(GetID());
1453 } 1455 }
1454 } 1456 }
1455 1457
1456 void RenderProcessHostImpl::AddPendingView() { 1458 void RenderProcessHostImpl::AddPendingView() {
1457 pending_views_++; 1459 pending_views_++;
1458 } 1460 }
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 FOR_EACH_OBSERVER(RenderProcessHostObserver, 1830 FOR_EACH_OBSERVER(RenderProcessHostObserver,
1829 observers_, 1831 observers_,
1830 RenderProcessExited(this, GetHandle(), status, exit_code)); 1832 RenderProcessExited(this, GetHandle(), status, exit_code));
1831 within_process_died_observer_ = false; 1833 within_process_died_observer_ = false;
1832 1834
1833 child_process_launcher_.reset(); 1835 child_process_launcher_.reset();
1834 channel_.reset(); 1836 channel_.reset();
1835 gpu_message_filter_ = NULL; 1837 gpu_message_filter_ = NULL;
1836 message_port_message_filter_ = NULL; 1838 message_port_message_filter_ = NULL;
1837 screen_orientation_dispatcher_host_ = NULL; 1839 screen_orientation_dispatcher_host_ = NULL;
1840 session_storage_namespaces_awaiting_close_.clear();
1838 1841
1839 IDMap<IPC::Listener>::iterator iter(&listeners_); 1842 IDMap<IPC::Listener>::iterator iter(&listeners_);
1840 while (!iter.IsAtEnd()) { 1843 while (!iter.IsAtEnd()) {
1841 iter.GetCurrentValue()->OnMessageReceived( 1844 iter.GetCurrentValue()->OnMessageReceived(
1842 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(), 1845 ViewHostMsg_RenderProcessGone(iter.GetCurrentKey(),
1843 static_cast<int>(status), 1846 static_cast<int>(status),
1844 exit_code)); 1847 exit_code));
1845 iter.Advance(); 1848 iter.Advance();
1846 } 1849 }
1847 1850
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 if (!webrtc_log_message_callback_.is_null()) 1899 if (!webrtc_log_message_callback_.is_null())
1897 webrtc_log_message_callback_.Run(message); 1900 webrtc_log_message_callback_.Run(message);
1898 } 1901 }
1899 #endif 1902 #endif
1900 1903
1901 scoped_refptr<ScreenOrientationDispatcherHost> 1904 scoped_refptr<ScreenOrientationDispatcherHost>
1902 RenderProcessHostImpl::screen_orientation_dispatcher_host() const { 1905 RenderProcessHostImpl::screen_orientation_dispatcher_host() const {
1903 return make_scoped_refptr(screen_orientation_dispatcher_host_); 1906 return make_scoped_refptr(screen_orientation_dispatcher_host_);
1904 } 1907 }
1905 1908
1909 void RenderProcessHostImpl::ReleaseOnCloseAck(
1910 const SessionStorageNamespaceMap& sessions,
1911 int view_route_id) {
1912 session_storage_namespaces_awaiting_close_[view_route_id] = sessions;
1913 }
1914
1906 void RenderProcessHostImpl::OnShutdownRequest() { 1915 void RenderProcessHostImpl::OnShutdownRequest() {
1907 // Don't shut down if there are active RenderViews, or if there are pending 1916 // Don't shut down if there are active RenderViews, or if there are pending
1908 // RenderViews being swapped back in. 1917 // RenderViews being swapped back in.
1909 // In single process mode, we never shutdown the renderer. 1918 // In single process mode, we never shutdown the renderer.
1910 int num_active_views = GetActiveViewCount(); 1919 int num_active_views = GetActiveViewCount();
1911 if (pending_views_ || num_active_views > 0 || run_renderer_in_process()) 1920 if (pending_views_ || num_active_views > 0 || run_renderer_in_process())
1912 return; 1921 return;
1913 1922
1914 // Notify any contents that might have swapped out renderers from this 1923 // Notify any contents that might have swapped out renderers from this
1915 // process. They should not attempt to swap them back in. 1924 // process. They should not attempt to swap them back in.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 scoped_refptr<AudioRendererHost> 2008 scoped_refptr<AudioRendererHost>
2000 RenderProcessHostImpl::audio_renderer_host() const { 2009 RenderProcessHostImpl::audio_renderer_host() const {
2001 return audio_renderer_host_; 2010 return audio_renderer_host_;
2002 } 2011 }
2003 2012
2004 void RenderProcessHostImpl::OnUserMetricsRecordAction( 2013 void RenderProcessHostImpl::OnUserMetricsRecordAction(
2005 const std::string& action) { 2014 const std::string& action) {
2006 RecordComputedAction(action); 2015 RecordComputedAction(action);
2007 } 2016 }
2008 2017
2018 void RenderProcessHostImpl::OnCloseACK(int old_route_id) {
2019 session_storage_namespaces_awaiting_close_.erase(old_route_id);
2020 }
2021
2009 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) { 2022 void RenderProcessHostImpl::OnSavedPageAsMHTML(int job_id, int64 data_size) {
2010 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size); 2023 MHTMLGenerationManager::GetInstance()->MHTMLGenerated(job_id, data_size);
2011 } 2024 }
2012 2025
2013 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost( 2026 void RenderProcessHostImpl::OnCompositorSurfaceBuffersSwappedNoHost(
2014 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) { 2027 const ViewHostMsg_CompositorSurfaceBuffersSwapped_Params& params) {
2015 TRACE_EVENT0("renderer_host", 2028 TRACE_EVENT0("renderer_host",
2016 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost"); 2029 "RenderWidgetHostImpl::OnCompositorSurfaceBuffersSwappedNoHost");
2017 if (!ui::LatencyInfo::Verify(params.latency_info, 2030 if (!ui::LatencyInfo::Verify(params.latency_info,
2018 "ViewHostMsg_CompositorSurfaceBuffersSwapped")) 2031 "ViewHostMsg_CompositorSurfaceBuffersSwapped"))
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 mojo::ScopedMessagePipeHandle handle) { 2085 mojo::ScopedMessagePipeHandle handle) {
2073 mojo_activation_required_ = true; 2086 mojo_activation_required_ = true;
2074 MaybeActivateMojo(); 2087 MaybeActivateMojo();
2075 2088
2076 mojo::AllocationScope scope; 2089 mojo::AllocationScope scope;
2077 mojo_application_host_->service_provider()->ConnectToService(service_name, 2090 mojo_application_host_->service_provider()->ConnectToService(service_name,
2078 handle.Pass()); 2091 handle.Pass());
2079 } 2092 }
2080 2093
2081 } // namespace content 2094 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698