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

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

Issue 2411863002: [NoStatePrefetch] Kill renderer after preload scanning (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1989 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 1989 if (msg.routing_id() == MSG_ROUTING_CONTROL) {
1990 // Dispatch control messages. 1990 // Dispatch control messages.
1991 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg) 1991 IPC_BEGIN_MESSAGE_MAP(RenderProcessHostImpl, msg)
1992 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest, 1992 IPC_MESSAGE_HANDLER(ChildProcessHostMsg_ShutdownRequest,
1993 OnShutdownRequest) 1993 OnShutdownRequest)
1994 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_SuddenTerminationChanged, 1994 IPC_MESSAGE_HANDLER(RenderProcessHostMsg_SuddenTerminationChanged,
1995 SuddenTerminationChanged) 1995 SuddenTerminationChanged)
1996 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction, 1996 IPC_MESSAGE_HANDLER(ViewHostMsg_UserMetricsRecordAction,
1997 OnUserMetricsRecordAction) 1997 OnUserMetricsRecordAction)
1998 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK) 1998 IPC_MESSAGE_HANDLER(ViewHostMsg_Close_ACK, OnCloseACK)
1999 IPC_MESSAGE_HANDLER(ViewHostMsg_PrefetchFinished, OnPrefetchFinished)
1999 #if defined(ENABLE_WEBRTC) 2000 #if defined(ENABLE_WEBRTC)
2000 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer, 2001 IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer,
2001 OnRegisterAecDumpConsumer) 2002 OnRegisterAecDumpConsumer)
2002 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer, 2003 IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer,
2003 OnUnregisterAecDumpConsumer) 2004 OnUnregisterAecDumpConsumer)
2004 #endif 2005 #endif
2005 // Adding single handlers for your service here is fine, but once your 2006 // Adding single handlers for your service here is fine, but once your
2006 // service needs more than one handler, please extract them into a new 2007 // service needs more than one handler, please extract them into a new
2007 // message filter and add that filter to CreateMessageFilters(). 2008 // message filter and add that filter to CreateMessageFilters().
2008 IPC_END_MESSAGE_MAP() 2009 IPC_END_MESSAGE_MAP()
2009 2010
2010 return true; 2011 return true;
2011 } 2012 }
2012 2013
2013 // Dispatch incoming messages to the appropriate IPC::Listener. 2014 // Dispatch incoming messages to the appropriate IPC::Listener.
2014 IPC::Listener* listener = listeners_.Lookup(msg.routing_id()); 2015 IPC::Listener* listener = listeners_.Lookup(msg.routing_id());
2015 if (!listener) { 2016 if (!listener) {
2016 if (msg.is_sync()) { 2017 if (msg.is_sync()) {
2017 // The listener has gone away, so we must respond or else the caller will 2018 // The listener has gone away, so we must respond or else the caller will
2018 // hang waiting for a reply. 2019 // hang waiting for a reply.
2019 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); 2020 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
2020 reply->set_reply_error(); 2021 reply->set_reply_error();
2021 Send(reply); 2022 Send(reply);
2022 } 2023 }
2023 return true; 2024 return true;
2024 } 2025 }
2025 return listener->OnMessageReceived(msg); 2026 return listener->OnMessageReceived(msg);
2026 } 2027 }
2027 2028
2029 void RenderProcessHostImpl::OnPrefetchFinished() {
2030 FOR_EACH_OBSERVER(RenderProcessHostObserver, observers_,
2031 RenderProcessHostPrefetchFinished(this));
2032 }
2033
2028 void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) { 2034 void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) {
2029 channel_connected_ = true; 2035 channel_connected_ = true;
2030 if (IsReady()) { 2036 if (IsReady()) {
2031 DCHECK(!sent_render_process_ready_); 2037 DCHECK(!sent_render_process_ready_);
2032 sent_render_process_ready_ = true; 2038 sent_render_process_ready_ = true;
2033 // Send RenderProcessReady only if we already received the process handle. 2039 // Send RenderProcessReady only if we already received the process handle.
2034 FOR_EACH_OBSERVER(RenderProcessHostObserver, 2040 FOR_EACH_OBSERVER(RenderProcessHostObserver,
2035 observers_, 2041 observers_,
2036 RenderProcessReady(this)); 2042 RenderProcessReady(this));
2037 } 2043 }
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
3031 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3037 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3032 3038
3033 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 3039 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
3034 // enough information here so that we can determine what the bad message was. 3040 // enough information here so that we can determine what the bad message was.
3035 base::debug::Alias(&error); 3041 base::debug::Alias(&error);
3036 bad_message::ReceivedBadMessage(render_process_id, 3042 bad_message::ReceivedBadMessage(render_process_id,
3037 bad_message::RPH_MOJO_PROCESS_ERROR); 3043 bad_message::RPH_MOJO_PROCESS_ERROR);
3038 } 3044 }
3039 3045
3040 } // namespace content 3046 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698