OLD | NEW |
---|---|
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_manager.h" | 5 #include "content/browser/frame_host/render_frame_host_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <utility> | 10 #include <utility> |
(...skipping 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2507 | 2507 |
2508 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { | 2508 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { |
2509 if (!frame_tree_node_->opener()) | 2509 if (!frame_tree_node_->opener()) |
2510 return MSG_ROUTING_NONE; | 2510 return MSG_ROUTING_NONE; |
2511 | 2511 |
2512 return frame_tree_node_->opener() | 2512 return frame_tree_node_->opener() |
2513 ->render_manager() | 2513 ->render_manager() |
2514 ->GetRoutingIdForSiteInstance(instance); | 2514 ->GetRoutingIdForSiteInstance(instance); |
2515 } | 2515 } |
2516 | 2516 |
2517 void RenderFrameHostManager::SendPageMessage(IPC::Message* msg) { | |
2518 DCHECK(IPC_MESSAGE_CLASS(*msg) == PageMsgStart); | |
2519 | |
2520 // We should always deliver page messages through the main frame. | |
2521 DCHECK(!frame_tree_node_->parent()); | |
2522 | |
2523 if ((IPC_MESSAGE_CLASS(*msg) != PageMsgStart) || frame_tree_node_->parent()) | |
2524 return; | |
2525 | |
2526 for (const auto& pair : proxy_hosts_) { | |
2527 RenderFrameProxyHost* proxy = pair.second.get(); | |
2528 | |
2529 IPC::Message* copy = new IPC::Message(*msg); | |
2530 copy->set_routing_id(proxy->GetRoutingID()); | |
2531 proxy->Send(copy); | |
2532 } | |
2533 | |
2534 if (speculative_render_frame_host_) { | |
2535 IPC::Message* copy = new IPC::Message(*msg); | |
2536 copy->set_routing_id(speculative_render_frame_host_->GetRoutingID()); | |
2537 speculative_render_frame_host_->Send(copy); | |
2538 } else if (pending_render_frame_host_) { | |
2539 IPC::Message* copy = new IPC::Message(*msg); | |
2540 copy->set_routing_id(pending_render_frame_host_->GetRoutingID()); | |
2541 pending_render_frame_host_->Send(copy); | |
nasko
2016/03/03 18:28:57
These 3 lines are repeating 3 times in this method
lfg
2016/03/03 22:09:37
I've switched to use a lambda, let me know what yo
| |
2542 } | |
2543 | |
2544 msg->set_routing_id(render_frame_host_->GetRoutingID()); | |
2545 render_frame_host_->Send(msg); | |
2546 } | |
2547 | |
2517 } // namespace content | 2548 } // namespace content |
OLD | NEW |