summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-09 06:45:46 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-09 06:45:46 +0000
commit6f37144dd7bbeded7d56dc37952342fa09e5a7bc (patch)
tree313f077bdd22d3e361d066753f7672ec77006d0c /content
parent5790d92e12c225bfe1683c81cf223dcf64302d1d (diff)
downloadchromium_src-6f37144dd7bbeded7d56dc37952342fa09e5a7bc.zip
chromium_src-6f37144dd7bbeded7d56dc37952342fa09e5a7bc.tar.gz
chromium_src-6f37144dd7bbeded7d56dc37952342fa09e5a7bc.tar.bz2
Extract a ProcessMap class from ExtensionProcessManager. This is a dumb data class that can be used on both the IO and UI threads to test extension/process associations.
BUG=95111,102617 TEST=Already covered by tests Review URL: http://codereview.chromium.org/8387061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109194 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/mock_content_browser_client.cc8
-rw-r--r--content/browser/mock_content_browser_client.h2
-rw-r--r--content/browser/site_instance.cc7
-rw-r--r--content/public/browser/content_browser_client.h7
-rw-r--r--content/public/browser/notification_types.h4
-rw-r--r--content/shell/shell_content_browser_client.cc8
-rw-r--r--content/shell/shell_content_browser_client.h2
7 files changed, 30 insertions, 8 deletions
diff --git a/content/browser/mock_content_browser_client.cc b/content/browser/mock_content_browser_client.cc
index ed558df..98b8ecd 100644
--- a/content/browser/mock_content_browser_client.cc
+++ b/content/browser/mock_content_browser_client.cc
@@ -79,6 +79,14 @@ bool MockContentBrowserClient::IsSuitableHost(
return true;
}
+void MockContentBrowserClient::SiteInstanceGotProcess(
+ SiteInstance* site_instance) {
+}
+
+void MockContentBrowserClient::SiteInstanceDeleting(
+ SiteInstance* site_instance) {
+}
+
bool MockContentBrowserClient::ShouldSwapProcessesForNavigation(
const GURL& current_url,
const GURL& new_url) {
diff --git a/content/browser/mock_content_browser_client.h b/content/browser/mock_content_browser_client.h
index 79e700c..23d53b1 100644
--- a/content/browser/mock_content_browser_client.h
+++ b/content/browser/mock_content_browser_client.h
@@ -42,6 +42,8 @@ class MockContentBrowserClient : public ContentBrowserClient {
virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE;
virtual bool IsSuitableHost(RenderProcessHost* process_host,
const GURL& site_url) OVERRIDE;
+ virtual void SiteInstanceGotProcess(SiteInstance* site_instance) OVERRIDE;
+ virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE;
virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url,
const GURL& new_url) OVERRIDE;
virtual std::string GetCanonicalEncodingNameByAliasName(
diff --git a/content/browser/site_instance.cc b/content/browser/site_instance.cc
index ad79d74..d41f49b 100644
--- a/content/browser/site_instance.cc
+++ b/content/browser/site_instance.cc
@@ -42,10 +42,7 @@ SiteInstance::SiteInstance(BrowsingInstance* browsing_instance)
}
SiteInstance::~SiteInstance() {
- content::NotificationService::current()->Notify(
- content::NOTIFICATION_SITE_INSTANCE_DELETED,
- content::Source<SiteInstance>(this),
- content::NotificationService::NoDetails());
+ content::GetContentClient()->browser()->SiteInstanceDeleting(this);
// Now that no one is referencing us, we can safely remove ourselves from
// the BrowsingInstance. Any future visits to a page from this site
@@ -84,6 +81,8 @@ RenderProcessHost* SiteInstance::GetProcess() {
}
}
+ content::GetContentClient()->browser()->SiteInstanceGotProcess(this);
+
// Make sure the process starts at the right max_page_id
process_->UpdateMaxPageID(max_page_id_);
}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index a404112..727e6c9 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -29,6 +29,7 @@ class RenderViewHost;
class RenderWidgetHost;
class RenderWidgetHostView;
class ResourceDispatcherHost;
+class SiteInstance;
class SSLCertErrorHandler;
class SSLClientAuthHandler;
class SkBitmap;
@@ -145,6 +146,12 @@ class ContentBrowserClient {
virtual bool IsSuitableHost(RenderProcessHost* process_host,
const GURL& site_url) = 0;
+ // Called when a site instance is first associated with a process.
+ virtual void SiteInstanceGotProcess(SiteInstance* site_instance) = 0;
+
+ // Called from a site instance's destructor.
+ virtual void SiteInstanceDeleting(SiteInstance* site_instance) = 0;
+
// Returns true if for the navigation from |current_url| to |new_url|,
// processes should be swapped (even if we are in a process model that
// doesn't usually swap).
diff --git a/content/public/browser/notification_types.h b/content/public/browser/notification_types.h
index c0e465d..1d6e503 100644
--- a/content/public/browser/notification_types.h
+++ b/content/public/browser/notification_types.h
@@ -356,10 +356,6 @@ enum NotificationType {
// the new state is "visible."
NOTIFICATION_RENDER_WIDGET_VISIBILITY_CHANGED,
- // Sent from ~SiteInstance. The source is the SiteInstance, and the details
- // are unused.
- NOTIFICATION_SITE_INSTANCE_DELETED,
-
// The focused element inside a page has changed. The source is the
// TabContents containing the render view host for the page. The details is
// a Details<const bool> that indicates whether or not an editable node was
diff --git a/content/shell/shell_content_browser_client.cc b/content/shell/shell_content_browser_client.cc
index 1379e82..2a31c9a 100644
--- a/content/shell/shell_content_browser_client.cc
+++ b/content/shell/shell_content_browser_client.cc
@@ -93,6 +93,14 @@ bool ShellContentBrowserClient::IsSuitableHost(
return true;
}
+void ShellContentBrowserClient::SiteInstanceGotProcess(
+ SiteInstance* site_instance) {
+}
+
+void ShellContentBrowserClient::SiteInstanceDeleting(
+ SiteInstance* site_instance) {
+}
+
bool ShellContentBrowserClient::ShouldSwapProcessesForNavigation(
const GURL& current_url,
const GURL& new_url) {
diff --git a/content/shell/shell_content_browser_client.h b/content/shell/shell_content_browser_client.h
index 2e44aa9..e8aa52f 100644
--- a/content/shell/shell_content_browser_client.h
+++ b/content/shell/shell_content_browser_client.h
@@ -54,6 +54,8 @@ class ShellContentBrowserClient : public ContentBrowserClient
virtual bool IsURLSameAsAnySiteInstance(const GURL& url) OVERRIDE;
virtual bool IsSuitableHost(RenderProcessHost* process_host,
const GURL& site_url) OVERRIDE;
+ virtual void SiteInstanceGotProcess(SiteInstance* site_instance) OVERRIDE;
+ virtual void SiteInstanceDeleting(SiteInstance* site_instance) OVERRIDE;
virtual bool ShouldSwapProcessesForNavigation(const GURL& current_url,
const GURL& new_url) OVERRIDE;