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

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: Remove Init call. Created 4 years, 11 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 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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 bool RenderFrameHostImpl::Send(IPC::Message* message) { 452 bool RenderFrameHostImpl::Send(IPC::Message* message) {
453 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { 453 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) {
454 return render_view_host_->GetWidget()->input_router()->SendInput( 454 return render_view_host_->GetWidget()->input_router()->SendInput(
455 make_scoped_ptr(message)); 455 make_scoped_ptr(message));
456 } 456 }
457 457
458 return GetProcess()->Send(message); 458 return GetProcess()->Send(message);
459 } 459 }
460 460
461 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { 461 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
462 // Only process messages if the RenderFrame is alive.
463 if (!render_frame_created_)
464 return false;
465
462 // Filter out most IPC messages if this frame is swapped out. 466 // Filter out most IPC messages if this frame is swapped out.
463 // We still want to handle certain ACKs to keep our state consistent. 467 // We still want to handle certain ACKs to keep our state consistent.
464 if (is_swapped_out()) { 468 if (is_swapped_out()) {
465 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { 469 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) {
466 // If this is a synchronous message and we decided not to handle it, 470 // If this is a synchronous message and we decided not to handle it,
467 // we must send an error reply, or else the renderer will be stuck 471 // we must send an error reply, or else the renderer will be stuck
468 // and won't respond to future requests. 472 // and won't respond to future requests.
469 if (msg.is_sync()) { 473 if (msg.is_sync()) {
470 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); 474 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
471 reply->set_reply_error(); 475 reply->set_reply_error();
(...skipping 2056 matching lines...) Expand 10 before | Expand all | Expand 10 after
2528 *dst = src; 2532 *dst = src;
2529 2533
2530 if (src.routing_id != -1) 2534 if (src.routing_id != -1)
2531 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); 2535 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2532 2536
2533 if (src.parent_routing_id != -1) 2537 if (src.parent_routing_id != -1)
2534 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); 2538 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2535 } 2539 }
2536 2540
2537 } // namespace content 2541 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698