Index: content/browser/site_instance_impl.cc |
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc |
index e5a275c57d84e052ed002759e8b2ea92bbaf6550..b387c45f0028cbb3150598e6f5ba7f595a33cb17 100644 |
--- a/content/browser/site_instance_impl.cc |
+++ b/content/browser/site_instance_impl.cc |
@@ -19,6 +19,18 @@ |
namespace content { |
+SiteInstanceKeepAlive::SiteInstanceKeepAlive( |
+ scoped_refptr<SiteInstanceImpl> instance) |
+ : instance_(instance) { |
+ instance_->increment_active_view_count(); |
+ instance_->GetProcess()->AddPendingView(); |
+} |
+ |
+SiteInstanceKeepAlive::~SiteInstanceKeepAlive() { |
+ instance_->GetProcess()->RemovePendingView(); |
+ instance_->decrement_active_view_count(); |
+} |
+ |
const RenderProcessHostFactory* |
SiteInstanceImpl::g_render_process_host_factory_ = NULL; |
int32 SiteInstanceImpl::next_site_instance_id_ = 1; |
@@ -215,6 +227,10 @@ BrowserContext* SiteInstanceImpl::GetBrowserContext() const { |
return browsing_instance_->browser_context(); |
} |
+scoped_ptr<SiteInstanceKeepAlive> SiteInstanceImpl::AcquireKeepAlive() { |
+ return make_scoped_ptr(new SiteInstanceKeepAlive(this)); |
+} |
+ |
/*static*/ |
SiteInstance* SiteInstance::Create(BrowserContext* browser_context) { |
return new SiteInstanceImpl(new BrowsingInstance(browser_context)); |