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

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: More unittest fixes. Created 4 years, 10 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 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 bool RenderFrameHostImpl::Send(IPC::Message* message) { 453 bool RenderFrameHostImpl::Send(IPC::Message* message) {
454 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { 454 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) {
455 return render_view_host_->GetWidget()->input_router()->SendInput( 455 return render_view_host_->GetWidget()->input_router()->SendInput(
456 make_scoped_ptr(message)); 456 make_scoped_ptr(message));
457 } 457 }
458 458
459 return GetProcess()->Send(message); 459 return GetProcess()->Send(message);
460 } 460 }
461 461
462 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { 462 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
463 // Only process messages if the RenderFrame is alive.
464 if (!render_frame_created_)
465 return false;
466
463 // Filter out most IPC messages if this frame is swapped out. 467 // Filter out most IPC messages if this frame is swapped out.
464 // We still want to handle certain ACKs to keep our state consistent. 468 // We still want to handle certain ACKs to keep our state consistent.
465 if (is_swapped_out()) { 469 if (is_swapped_out()) {
466 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { 470 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) {
467 // If this is a synchronous message and we decided not to handle it, 471 // If this is a synchronous message and we decided not to handle it,
468 // we must send an error reply, or else the renderer will be stuck 472 // we must send an error reply, or else the renderer will be stuck
469 // and won't respond to future requests. 473 // and won't respond to future requests.
470 if (msg.is_sync()) { 474 if (msg.is_sync()) {
471 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); 475 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg);
472 reply->set_reply_error(); 476 reply->set_reply_error();
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 *dst = src; 2563 *dst = src;
2560 2564
2561 if (src.routing_id != -1) 2565 if (src.routing_id != -1)
2562 dst->tree_id = RoutingIDToAXTreeID(src.routing_id); 2566 dst->tree_id = RoutingIDToAXTreeID(src.routing_id);
2563 2567
2564 if (src.parent_routing_id != -1) 2568 if (src.parent_routing_id != -1)
2565 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id); 2569 dst->parent_tree_id = RoutingIDToAXTreeID(src.parent_routing_id);
2566 } 2570 }
2567 2571
2568 } // namespace content 2572 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_unittest.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698