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

Unified Diff: chrome/renderer/extensions/extension_dispatcher.cc

Issue 8463019: Convert render thread idle delays from seconds to milliseconds. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Address comments, fix compile error in test_support_content. Created 9 years, 1 month 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 | « no previous file | content/public/renderer/render_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/extension_dispatcher.cc
diff --git a/chrome/renderer/extensions/extension_dispatcher.cc b/chrome/renderer/extensions/extension_dispatcher.cc
index 9ed183928dfd4d046998e2a11da09f4c1641016d..5c94001752e3338d9a05e2b61a6a5b624eb9ee68 100644
--- a/chrome/renderer/extensions/extension_dispatcher.cc
+++ b/chrome/renderer/extensions/extension_dispatcher.cc
@@ -32,8 +32,8 @@
#include "v8/include/v8.h"
namespace {
-static const double kInitialExtensionIdleHandlerDelayS = 5.0 /* seconds */;
-static const int64 kMaxExtensionIdleHandlerDelayS = 5*60 /* seconds */;
+static const int64 kInitialExtensionIdleHandlerDelayMs = 5*1000;
+static const int64 kMaxExtensionIdleHandlerDelayMs = 5*60*1000;
}
using WebKit::WebDataSource;
@@ -53,8 +53,8 @@ ExtensionDispatcher::ExtensionDispatcher()
command_line.HasSwitch(switches::kSingleProcess);
if (is_extension_process_) {
- RenderThread::Get()->SetIdleNotificationDelayInS(
- kInitialExtensionIdleHandlerDelayS);
+ RenderThread::Get()->SetIdleNotificationDelayInMs(
+ kInitialExtensionIdleHandlerDelayMs);
}
user_script_slave_.reset(new UserScriptSlave(&extensions_));
@@ -90,7 +90,7 @@ void ExtensionDispatcher::WebKitInitialized() {
// even if the extension keeps up activity.
if (is_extension_process_) {
forced_idle_timer_.Start(FROM_HERE,
- base::TimeDelta::FromSeconds(kMaxExtensionIdleHandlerDelayS),
+ base::TimeDelta::FromMilliseconds(kMaxExtensionIdleHandlerDelayMs),
RenderThread::Get(), &RenderThread::IdleHandler);
}
@@ -123,12 +123,12 @@ void ExtensionDispatcher::IdleNotification() {
if (is_extension_process_) {
// Dampen the forced delay as well if the extension stays idle for long
// periods of time.
- int64 forced_delay_s = std::max(static_cast<int64>(
- RenderThread::Get()->GetIdleNotificationDelayInS()),
- kMaxExtensionIdleHandlerDelayS);
+ int64 forced_delay_ms = std::max(
+ RenderThread::Get()->GetIdleNotificationDelayInMs(),
+ kMaxExtensionIdleHandlerDelayMs);
forced_idle_timer_.Stop();
forced_idle_timer_.Start(FROM_HERE,
- base::TimeDelta::FromSeconds(forced_delay_s),
+ base::TimeDelta::FromMilliseconds(forced_delay_ms),
RenderThread::Get(), &RenderThread::IdleHandler);
}
}
@@ -151,7 +151,7 @@ void ExtensionDispatcher::OnMessageInvoke(const std::string& extension_id,
// dispatch, for which Invoke is the chokepoint.
if (is_extension_process_) {
RenderThread::Get()->ScheduleIdleHandler(
- kInitialExtensionIdleHandlerDelayS);
+ kInitialExtensionIdleHandlerDelayMs);
}
// Tell the browser process that the event is dispatched and we're idle.
@@ -299,7 +299,7 @@ void ExtensionDispatcher::OnActivateExtension(
// This is called when starting a new extension page, so start the idle
// handler ticking.
- RenderThread::Get()->ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayS);
+ RenderThread::Get()->ScheduleIdleHandler(kInitialExtensionIdleHandlerDelayMs);
UpdateActiveExtensions();
« no previous file with comments | « no previous file | content/public/renderer/render_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698