OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 Source<Profile>(profile_)); | 149 Source<Profile>(profile_)); |
150 } | 150 } |
151 | 151 |
152 ExtensionHost::~ExtensionHost() { | 152 ExtensionHost::~ExtensionHost() { |
153 NotificationService::current()->Notify( | 153 NotificationService::current()->Notify( |
154 NotificationType::EXTENSION_HOST_DESTROYED, | 154 NotificationType::EXTENSION_HOST_DESTROYED, |
155 Source<Profile>(profile_), | 155 Source<Profile>(profile_), |
156 Details<ExtensionHost>(this)); | 156 Details<ExtensionHost>(this)); |
157 ProcessCreationQueue::get()->Remove(this); | 157 ProcessCreationQueue::get()->Remove(this); |
158 render_view_host_->Shutdown(); // deletes render_view_host | 158 render_view_host_->Shutdown(); // deletes render_view_host |
| 159 |
| 160 if (recently_deleted()->size() >= 20) |
| 161 recently_deleted()->pop_front(); |
| 162 recently_deleted()->push_back(this); |
| 163 } |
| 164 |
| 165 ExtensionHost::HostPointerList* ExtensionHost::recently_deleted() { |
| 166 return Singleton<HostPointerList>::get(); |
159 } | 167 } |
160 | 168 |
161 void ExtensionHost::CreateView(Browser* browser) { | 169 void ExtensionHost::CreateView(Browser* browser) { |
162 #if defined(TOOLKIT_VIEWS) | 170 #if defined(TOOLKIT_VIEWS) |
163 view_.reset(new ExtensionView(this, browser)); | 171 view_.reset(new ExtensionView(this, browser)); |
164 // We own |view_|, so don't auto delete when it's removed from the view | 172 // We own |view_|, so don't auto delete when it's removed from the view |
165 // hierarchy. | 173 // hierarchy. |
166 view_->set_parent_owned(false); | 174 view_->set_parent_owned(false); |
167 #elif defined(OS_MACOSX) | 175 #elif defined(OS_MACOSX) |
168 view_.reset(new ExtensionViewMac(this, browser)); | 176 view_.reset(new ExtensionViewMac(this, browser)); |
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 // Extensions hosted in ExternalTabContainer objects may not have | 739 // Extensions hosted in ExternalTabContainer objects may not have |
732 // an associated browser. | 740 // an associated browser. |
733 Browser* browser = GetBrowser(); | 741 Browser* browser = GetBrowser(); |
734 if (browser) | 742 if (browser) |
735 window_id = ExtensionTabUtil::GetWindowId(browser); | 743 window_id = ExtensionTabUtil::GetWindowId(browser); |
736 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { | 744 } else if (extension_host_type_ != ViewType::EXTENSION_BACKGROUND_PAGE) { |
737 NOTREACHED(); | 745 NOTREACHED(); |
738 } | 746 } |
739 return window_id; | 747 return window_id; |
740 } | 748 } |
OLD | NEW |