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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1534933002: Don't process messages sent to dead routing ids. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/browser/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/containers/hash_tables.h" 8 #include "base/containers/hash_tables.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 bool RenderFrameHostImpl::Send(IPC::Message* message) { 445 bool RenderFrameHostImpl::Send(IPC::Message* message) {
446 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { 446 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) {
447 return render_view_host_->GetWidget()->input_router()->SendInput( 447 return render_view_host_->GetWidget()->input_router()->SendInput(
448 make_scoped_ptr(message)); 448 make_scoped_ptr(message));
449 } 449 }
450 450
451 return GetProcess()->Send(message); 451 return GetProcess()->Send(message);
452 } 452 }
453 453
454 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { 454 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
455 // Only process messages if the RenderFrame is alive.
456 if (!render_frame_created_)
457 return false;
458
455 // Filter out most IPC messages if this frame is swapped out. 459 // Filter out most IPC messages if this frame is swapped out.
456 // We still want to handle certain ACKs to keep our state consistent. 460 // We still want to handle certain ACKs to keep our state consistent.
457 if (is_swapped_out()) { 461 if (is_swapped_out()) {
458 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { 462 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) {
459 // If this is a synchronous message and we decided not to handle it, 463 // If this is a synchronous message and we decided not to handle it,
460 // we must send an error reply, or else the renderer will be stuck 464 // we must send an error reply, or else the renderer will be stuck
461 // and won't respond to future requests. 465 // and won't respond to future requests.
462 if (msg.is_sync()) { 466 if (msg.is_sync()) {
463 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); 467 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
464 reply->set_reply_error(); 468 reply->set_reply_error();
(...skipping 2043 matching lines...) Expand 10 before | Expand all | Expand 10 after
2508 *dst = src; 2512 *dst = src;
2509 2513
2510 if (src.routing_id != -1) 2514 if (src.routing_id != -1)
2511 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); 2515 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2512 2516
2513 if (src.parent_routing_id != -1) 2517 if (src.parent_routing_id != -1)
2514 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); 2518 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2515 } 2519 }
2516 2520
2517 } // namespace content 2521 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698