Index: content/renderer/render_view_impl.cc |
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc |
index 3c1526682498c7356cdf5601f31cba94d9534be8..2a61a12671cabda22cd7ad0fa7290b766253c43e 100644 |
--- a/content/renderer/render_view_impl.cc |
+++ b/content/renderer/render_view_impl.cc |
@@ -3171,6 +3171,21 @@ void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, |
// Check whether we have new encoding name. |
UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
+ |
+ if (!frame->parent()) { // Only for top frames. |
+ // Check if all RenderViewImpls are displaying a page from the same host, |
+ // and update RenderThreadImpl's view on that. If this is the only |
+ // RenderViewImpl, the common host is this view's host. If there are many, |
+ // check if this one shares the common host of the other |
+ // RenderViewImpls. It's ok to not detect some cases where the |
+ // RenderViewImpls share a common host. |
+ std::string host = GURL(frame->document().url()).host(); |
+ RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
+ if (g_view_map.Get().size() == 1) |
+ render_thread_impl->SetCommonHost(host); |
+ else if (host != render_thread_impl->CommonHost()) |
+ render_thread_impl->SetCommonHost(std::string()); |
+ } |
} |
void RenderViewImpl::didClearWindowObject(WebFrame* frame) { |