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

Unified Diff: chrome/renderer/resources/extensions/tts_custom_bindings.js

Issue 9958147: Fix some uses of global variables in transient pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 9 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/renderer/resources/extensions/experimental.socket_custom_bindings.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extensions/tts_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/tts_custom_bindings.js b/chrome/renderer/resources/extensions/tts_custom_bindings.js
index 1ea4331ce81937da0b93e097b3cc2d101681e676..46b08873279585ab121f0a763c554df16b315479 100644
--- a/chrome/renderer/resources/extensions/tts_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/tts_custom_bindings.js
@@ -9,6 +9,7 @@ var GetNextTTSEventId = ttsNatives.GetNextTTSEventId;
var chromeHidden = requireNative('chrome_hidden').GetChromeHidden();
var sendRequest = require('sendRequest').sendRequest;
+var lazyBG = requireNative('lazy_background_page');
chromeHidden.registerCustomHook('tts', function(api) {
var apiFunctions = api.apiFunctions;
@@ -25,6 +26,8 @@ chromeHidden.registerCustomHook('tts', function(api) {
});
if (event.isFinalEvent) {
delete chromeHidden.tts.handlers[event.srcId];
+ // Balanced in 'speak' handler.
+ lazyBG.DecrementKeepaliveCount();
}
}
});
@@ -35,6 +38,9 @@ chromeHidden.registerCustomHook('tts', function(api) {
var id = GetNextTTSEventId();
args[1].srcId = id;
chromeHidden.tts.handlers[id] = args[1].onEvent;
+ // Keep the page alive until the event finishes.
+ // Balanced in eventHandler.
+ lazyBG.IncrementKeepaliveCount();
}
sendRequest(this.name, args, this.definition.parameters);
return id;
« no previous file with comments | « chrome/renderer/resources/extensions/experimental.socket_custom_bindings.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698