summaryrefslogtreecommitdiffstats
path: root/content/browser
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser')
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc2
-rw-r--r--content/browser/renderer_host/render_process_host_impl.h6
-rw-r--r--content/browser/site_instance_impl.cc7
-rw-r--r--content/browser/web_contents/frame_tree_node.h15
-rw-r--r--content/browser/web_contents/render_view_host_manager.cc3
-rw-r--r--content/browser/web_contents/web_contents_impl.cc32
-rw-r--r--content/browser/web_contents/web_contents_impl.h1
7 files changed, 53 insertions, 13 deletions
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index d5d678e..6b679ca 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1523,7 +1523,7 @@ RenderProcessHost* RenderProcessHost::GetExistingProcessHost(
}
// static
-bool RenderProcessHostImpl::ShouldUseProcessPerSite(
+bool RenderProcessHost::ShouldUseProcessPerSite(
BrowserContext* browser_context,
const GURL& url) {
// Returns true if we should use the process-per-site model. This will be
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index 5f528b1..6951a1d 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -156,12 +156,6 @@ class CONTENT_EXPORT RenderProcessHostImpl
BrowserContext* browser_context,
const GURL& site_url);
- // Returns whether the process-per-site model is in use (globally or just for
- // the current site), in which case we should ensure there is only one
- // RenderProcessHost per site for the entire browser context.
- static bool ShouldUseProcessPerSite(BrowserContext* browser_context,
- const GURL& url);
-
// Returns an existing RenderProcessHost for |url| in |browser_context|,
// if one exists. Otherwise a new RenderProcessHost should be created and
// registered using RegisterProcessHostForSite().
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index 95015b0..0edd85b 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -74,7 +74,7 @@ bool SiteInstanceImpl::HasProcess() const {
BrowserContext* browser_context =
browsing_instance_->browser_context();
if (has_site_ &&
- RenderProcessHostImpl::ShouldUseProcessPerSite(browser_context, site_) &&
+ RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_) &&
RenderProcessHostImpl::GetProcessHostForSite(browser_context, site_)) {
return true;
}
@@ -97,7 +97,7 @@ RenderProcessHost* SiteInstanceImpl::GetProcess() {
// If we should use process-per-site mode (either in general or for the
// given site), then look for an existing RenderProcessHost for the site.
bool use_process_per_site = has_site_ &&
- RenderProcessHostImpl::ShouldUseProcessPerSite(browser_context, site_);
+ RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_);
if (use_process_per_site) {
process_ = RenderProcessHostImpl::GetProcessHostForSite(browser_context,
site_);
@@ -171,8 +171,7 @@ void SiteInstanceImpl::SetSite(const GURL& url) {
LockToOrigin();
// Ensure the process is registered for this site if necessary.
- if (RenderProcessHostImpl::ShouldUseProcessPerSite(browser_context,
- site_)) {
+ if (RenderProcessHost::ShouldUseProcessPerSite(browser_context, site_)) {
RenderProcessHostImpl::RegisterProcessHostForSite(
browser_context, process_, site_);
}
diff --git a/content/browser/web_contents/frame_tree_node.h b/content/browser/web_contents/frame_tree_node.h
index c35df02..5bd3f1b 100644
--- a/content/browser/web_contents/frame_tree_node.h
+++ b/content/browser/web_contents/frame_tree_node.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "content/common/content_export.h"
+#include "googleurl/src/gurl.h"
namespace content {
@@ -42,6 +43,14 @@ class CONTENT_EXPORT FrameTreeNode {
return children_[index];
}
+ const GURL& current_url() const {
+ return current_url_;
+ }
+
+ void set_current_url(const GURL& url) {
+ current_url_ = url;
+ }
+
private:
// The unique identifier for the frame in the page.
int64 frame_id_;
@@ -53,6 +62,12 @@ class CONTENT_EXPORT FrameTreeNode {
// The immediate children of this specific frame.
std::vector<FrameTreeNode*> children_;
+ // Track the current frame's last committed URL, so we can estimate the
+ // process impact of out-of-process iframes.
+ // TODO(creis): Remove this when we can store subframe URLs in the
+ // NavigationController.
+ GURL current_url_;
+
DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
};
diff --git a/content/browser/web_contents/render_view_host_manager.cc b/content/browser/web_contents/render_view_host_manager.cc
index 3fefe30..7a55584 100644
--- a/content/browser/web_contents/render_view_host_manager.cc
+++ b/content/browser/web_contents/render_view_host_manager.cc
@@ -502,8 +502,7 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry(
// GetRelatedSiteInstance() for this, which will eagerly set the site and
// thus use the correct process.
bool use_process_per_site =
- RenderProcessHostImpl::ShouldUseProcessPerSite(browser_context,
- dest_url) &&
+ RenderProcessHost::ShouldUseProcessPerSite(browser_context, dest_url) &&
RenderProcessHostImpl::GetProcessHostForSite(browser_context, dest_url);
if (curr_site_instance->HasRelatedSiteInstance(dest_url) ||
use_process_per_site) {
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index c9c8ddd..7ba6c58 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -1029,6 +1029,31 @@ uint64 WebContentsImpl::GetUploadPosition() const {
return upload_position_;
}
+std::set<GURL> WebContentsImpl::GetSitesInTab() const {
+ BrowserContext* browser_context = GetBrowserContext();
+ std::set<GURL> sites;
+ if (!frame_tree_root_.get())
+ return sites;
+
+ // Iterates over the FrameTreeNodes to find each unique site URL that is
+ // currently committed.
+ FrameTreeNode* node = NULL;
+ std::queue<FrameTreeNode*> queue;
+ queue.push(frame_tree_root_.get());
+
+ while (!queue.empty()) {
+ node = queue.front();
+ queue.pop();
+ sites.insert(SiteInstance::GetSiteForURL(browser_context,
+ node->current_url()));
+
+ for (size_t i = 0; i < node->child_count(); ++i)
+ queue.push(node->child_at(i));
+ }
+
+ return sites;
+}
+
const std::string& WebContentsImpl::GetEncoding() const {
return encoding_;
}
@@ -2940,6 +2965,13 @@ void WebContentsImpl::DidNavigate(
LoadCommittedDetails details;
bool did_navigate = controller_.RendererDidNavigate(params, &details);
+ // For now, keep track of each frame's URL in its FrameTreeNode. This lets
+ // us estimate our process count for implementing OOP iframes.
+ // TODO(creis): Remove this when we track which pages commit in each frame.
+ FrameTreeNode* node = FindFrameTreeNodeByID(params.frame_id);
+ if (node)
+ node->set_current_url(params.url);
+
// Send notification about committed provisional loads. This notification is
// different from the NAV_ENTRY_COMMITTED notification which doesn't include
// the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations.
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index bbc0a9b..e4667a7 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -228,6 +228,7 @@ class CONTENT_EXPORT WebContentsImpl
virtual const string16& GetLoadStateHost() const OVERRIDE;
virtual uint64 GetUploadSize() const OVERRIDE;
virtual uint64 GetUploadPosition() const OVERRIDE;
+ virtual std::set<GURL> GetSitesInTab() const OVERRIDE;
virtual const std::string& GetEncoding() const OVERRIDE;
virtual bool DisplayedInsecureContent() const OVERRIDE;
virtual void IncrementCapturerCount() OVERRIDE;