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

Unified Diff: extensions/browser/extension_web_contents_observer.cc

Issue 1414783002: Don't keep the lazy background page alive after a view with a Pepper plugin is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ppapi/tests/extensions/extensions.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fbfb5a5c5ab1daa06ba98dffd5ddb8f44c47a05e..665fc0809cca1b3ebcfa428ae79d762d9c8c5caa 100644
--- a/extensions/browser/extension_web_contents_observer.cc
+++ b/extensions/browser/extension_web_contents_observer.cc
@@ -20,6 +20,7 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_messages.h"
+#include "extensions/common/view_type.h"
namespace extensions {
@@ -122,19 +123,25 @@ bool ExtensionWebContentsObserver::OnMessageReceived(
}
void ExtensionWebContentsObserver::PepperInstanceCreated() {
- ProcessManager* const process_manager = ProcessManager::Get(browser_context_);
- const Extension* const extension =
- process_manager->GetExtensionForWebContents(web_contents());
- if (extension)
- process_manager->IncrementLazyKeepaliveCount(extension);
+ if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
+ ProcessManager* const process_manager =
+ ProcessManager::Get(browser_context_);
+ const Extension* const extension =
+ process_manager->GetExtensionForWebContents(web_contents());
+ if (extension)
+ process_manager->IncrementLazyKeepaliveCount(extension);
+ }
}
void ExtensionWebContentsObserver::PepperInstanceDeleted() {
- ProcessManager* const process_manager = ProcessManager::Get(browser_context_);
- const Extension* const extension =
- process_manager->GetExtensionForWebContents(web_contents());
- if (extension)
- process_manager->DecrementLazyKeepaliveCount(extension);
+ if (GetViewType(web_contents()) == VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
+ ProcessManager* const process_manager =
+ ProcessManager::Get(browser_context_);
+ const Extension* const extension =
+ process_manager->GetExtensionForWebContents(web_contents());
+ if (extension)
+ process_manager->DecrementLazyKeepaliveCount(extension);
+ }
}
std::string ExtensionWebContentsObserver::GetExtensionIdFromFrame(
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | ppapi/tests/extensions/extensions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698