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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1685213002: Propagate window coordinates to out-of-process iframes renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sendscreenrects
Patch Set: rebase 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 03212114c51a63ca4597387490b5dba014a6e5fe..4bb099ce7d02be6c4082f7074f7b2ecab7e95e70 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -748,7 +748,7 @@ bool RenderFrameHostManager::DeleteFromPendingList(
}
void RenderFrameHostManager::ResetProxyHosts() {
- for (auto& pair : proxy_hosts_) {
+ for (const auto& pair : proxy_hosts_) {
static_cast<SiteInstanceImpl*>(pair.second->GetSiteInstance())
->RemoveObserver(this);
}
@@ -1011,12 +1011,14 @@ void RenderFrameHostManager::ActiveFrameCountIsZero(
RenderFrameProxyHost* RenderFrameHostManager::CreateRenderFrameProxyHost(
SiteInstance* site_instance,
RenderViewHostImpl* rvh) {
- auto result = proxy_hosts_.add(site_instance->GetId(),
- make_scoped_ptr(new RenderFrameProxyHost(
- site_instance, rvh, frame_tree_node_)));
- CHECK(result.second) << "A proxy already existed for this SiteInstance.";
+ int site_instance_id = site_instance->GetId();
+ CHECK(proxy_hosts_.find(site_instance_id) == proxy_hosts_.end())
+ << "A proxy already existed for this SiteInstance.";
+ RenderFrameProxyHost* proxy_host =
+ new RenderFrameProxyHost(site_instance, rvh, frame_tree_node_);
+ proxy_hosts_[site_instance_id] = make_scoped_ptr(proxy_host);
nasko 2016/02/12 18:14:08 Why was this rewrite necessary?
lfg 2016/03/02 18:29:08 Moved to another CL.
static_cast<SiteInstanceImpl*>(site_instance)->AddObserver(this);
- return result.first->second;
+ return proxy_host;
}
void RenderFrameHostManager::DeleteRenderFrameProxyHost(
@@ -1756,7 +1758,7 @@ void RenderFrameHostManager::CreateProxiesForChildFrame(FrameTreeNode* child) {
for (const auto& pair : proxy_hosts_) {
// Do not create proxies for subframes in the outer delegate's process,
// since the outer delegate does not need to interact with them.
- if (pair.second == outer_delegate_proxy)
+ if (pair.second.get() == outer_delegate_proxy)
continue;
child->render_manager()->CreateRenderFrameProxy(
@@ -2332,7 +2334,7 @@ RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost(
SiteInstance* instance) const {
auto it = proxy_hosts_.find(instance->GetId());
if (it != proxy_hosts_.end())
- return it->second;
+ return it->second.get();
return nullptr;
}
@@ -2340,14 +2342,6 @@ int RenderFrameHostManager::GetProxyCount() {
return proxy_hosts_.size();
}
-std::map<int, RenderFrameProxyHost*>
-RenderFrameHostManager::GetAllProxyHostsForTesting() {
- std::map<int, RenderFrameProxyHost*> result;
- for (const auto& pair : proxy_hosts_)
- result[pair.first] = pair.second;
- return result;
-}
-
void RenderFrameHostManager::CollectOpenerFrameTrees(
std::vector<FrameTree*>* opener_frame_trees,
base::hash_set<FrameTreeNode*>* nodes_with_back_links) {
@@ -2490,4 +2484,34 @@ int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
->GetRoutingIdForSiteInstance(instance);
}
+void RenderFrameHostManager::SendPageMsg(IPC::Message* msg) {
+ DCHECK(IPC_MESSAGE_CLASS(*msg) == PageMsgStart);
nasko 2016/02/12 18:14:08 Should this method return if the IPC is not a Page
lfg 2016/03/02 18:29:08 Done.
+
+ // We should always deliver page messages through the main frame.
+ DCHECK(!frame_tree_node_->parent());
nasko 2016/02/12 18:14:08 Same as above. What happens when the DCHECK is vio
lfg 2016/03/02 18:29:08 We shouldn't write code to violate the DCHECK ;)
+
+ for (const auto& pair : proxy_hosts_) {
+ RenderFrameProxyHost* proxy = pair.second.get();
+
+ IPC::Message* copy = new IPC::Message(*msg);
+ copy->set_routing_id(proxy->GetRoutingID());
+ proxy->Send(copy);
+ }
+
+ if (speculative_render_frame_host_) {
+ IPC::Message* copy = new IPC::Message(*msg);
+ copy->set_routing_id(speculative_render_frame_host_->GetRoutingID());
+ speculative_render_frame_host_->Send(copy);
+ }
+
+ if (pending_render_frame_host_) {
nasko 2016/02/12 18:14:08 Speculative and pending cannot exist at the same t
lfg 2016/03/02 18:29:08 Done.
+ IPC::Message* copy = new IPC::Message(*msg);
+ copy->set_routing_id(pending_render_frame_host_->GetRoutingID());
+ pending_render_frame_host_->Send(copy);
+ }
+
+ msg->set_routing_id(render_frame_host_->GetRoutingID());
+ render_frame_host_->Send(msg);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698