| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/site_instance.h" | 5 #include "content/browser/site_instance.h" |
| 6 | 6 |
| 7 #include "content/browser/browsing_instance.h" | 7 #include "content/browser/browsing_instance.h" |
| 8 #include "content/browser/content_browser_client.h" | 8 #include "content/browser/content_browser_client.h" |
| 9 #include "content/browser/renderer_host/browser_render_process_host.h" | 9 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 10 #include "content/browser/webui/web_ui_factory.h" | 10 #include "content/browser/webui/web_ui_factory.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 process_(NULL), | 35 process_(NULL), |
| 36 max_page_id_(-1), | 36 max_page_id_(-1), |
| 37 has_site_(false) { | 37 has_site_(false) { |
| 38 DCHECK(browsing_instance); | 38 DCHECK(browsing_instance); |
| 39 | 39 |
| 40 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 40 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 41 NotificationService::AllSources()); | 41 NotificationService::AllSources()); |
| 42 } | 42 } |
| 43 | 43 |
| 44 SiteInstance::~SiteInstance() { | 44 SiteInstance::~SiteInstance() { |
| 45 NotificationService::current()->Notify( |
| 46 content::NOTIFICATION_SITE_INSTANCE_DELETED, |
| 47 Source<SiteInstance>(this), |
| 48 NotificationService::NoDetails()); |
| 49 |
| 45 // Now that no one is referencing us, we can safely remove ourselves from | 50 // Now that no one is referencing us, we can safely remove ourselves from |
| 46 // the BrowsingInstance. Any future visits to a page from this site | 51 // the BrowsingInstance. Any future visits to a page from this site |
| 47 // (within the same BrowsingInstance) can safely create a new SiteInstance. | 52 // (within the same BrowsingInstance) can safely create a new SiteInstance. |
| 48 if (has_site_) | 53 if (has_site_) |
| 49 browsing_instance_->UnregisterSiteInstance(this); | 54 browsing_instance_->UnregisterSiteInstance(this); |
| 50 } | 55 } |
| 51 | 56 |
| 52 bool SiteInstance::HasProcess() const { | 57 bool SiteInstance::HasProcess() const { |
| 53 return (process_ != NULL); | 58 return (process_ != NULL); |
| 54 } | 59 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 } | 238 } |
| 234 | 239 |
| 235 void SiteInstance::Observe(int type, | 240 void SiteInstance::Observe(int type, |
| 236 const NotificationSource& source, | 241 const NotificationSource& source, |
| 237 const NotificationDetails& details) { | 242 const NotificationDetails& details) { |
| 238 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); | 243 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); |
| 239 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); | 244 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); |
| 240 if (rph == process_) | 245 if (rph == process_) |
| 241 process_ = NULL; | 246 process_ = NULL; |
| 242 } | 247 } |
| OLD | NEW |