Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: extensions/browser/extension_web_contents_observer.cc

Issue 1117023002: Keep event page alive when there's some Pepper plugin on it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/extension_web_contents_observer.cc
diff --git a/extensions/browser/extension_web_contents_observer.cc b/extensions/browser/extension_web_contents_observer.cc
index 5ba2ebb5fcf81f9d3306e921877d52012bb3d44c..5f6861423787a1c7a284b36713ae13ca731c8233 100644
--- a/extensions/browser/extension_web_contents_observer.cc
+++ b/extensions/browser/extension_web_contents_observer.cc
@@ -19,6 +19,7 @@
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_messages.h"
+#include "extensions/common/view_type.h"
namespace extensions {
namespace {
@@ -156,6 +157,26 @@ void ExtensionWebContentsObserver::NotifyRenderViewType(
}
}
+void ExtensionWebContentsObserver::PepperInstanceCreated() {
+ if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
not at google - send to devlin 2015/05/11 17:53:48 I'm not sure I'd bother with this extra "is backgr
bartfab (slow) 2015/05/18 09:57:41 If we leave out this check, we will be keeping bac
emaxx 2015/05/18 15:06:30 I've already talked to Ben about that. The point i
emaxx 2015/05/18 15:06:30 OK, removed this check as it didn't make much diff
+ ProcessManager* process_manager = ProcessManager::Get(browser_context_);
bartfab (slow) 2015/05/18 09:57:41 Nit 1: const pointer. Nit 2: If you move this insi
emaxx 2015/05/18 15:06:30 1: Done. 2: Didn't get your point: the ProcessMana
bartfab (slow) 2015/05/19 10:34:58 Nevermind :).
+ const Extension* extension =
bartfab (slow) 2015/05/18 09:57:41 Nit 1: const pointer. Nit 2: #include "extensions/
emaxx 2015/05/18 15:06:30 Done.
+ process_manager->GetExtensionForWebContents(web_contents());
+ if (extension)
+ process_manager->IncrementLazyKeepaliveCount(extension);
+ }
+}
+
+void ExtensionWebContentsObserver::PepperInstanceDeleted() {
+ if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
+ ProcessManager* process_manager = ProcessManager::Get(browser_context_);
bartfab (slow) 2015/05/18 09:57:41 Nit 1: const pointer. Nit 2: As above, better move
+ const Extension* extension =
bartfab (slow) 2015/05/18 09:57:41 Nit: const pointer.
+ process_manager->GetExtensionForWebContents(web_contents());
+ if (extension)
+ process_manager->DecrementLazyKeepaliveCount(extension);
+ }
+}
+
const Extension* ExtensionWebContentsObserver::GetExtension(
content::RenderViewHost* render_view_host) {
std::string extension_id = GetExtensionId(render_view_host);

Powered by Google App Engine
This is Rietveld 408576698