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

Unified Diff: Source/bindings/core/v8/V8Initializer.cpp

Issue 1336923003: Revert of Remove IdleNotification call in the main thread of foreground tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/V8Initializer.cpp
diff --git a/Source/bindings/core/v8/V8Initializer.cpp b/Source/bindings/core/v8/V8Initializer.cpp
index 00bfc941a52ca6137a5a9ea499feab51478dfff2..4d16f8c387bb7bed4fbbc17bc501023d96e58470 100644
--- a/Source/bindings/core/v8/V8Initializer.cpp
+++ b/Source/bindings/core/v8/V8Initializer.cpp
@@ -330,6 +330,23 @@
return false;
}
+static void idleGCTaskInMainThread(double deadlineSeconds)
+{
+ ASSERT(isMainThread());
+ ASSERT(RuntimeEnabledFeatures::v8IdleTasksEnabled());
+ bool gcFinished = false;
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+
+ Platform* platform = Platform::current();
+ if (deadlineSeconds > platform->monotonicallyIncreasingTime())
+ gcFinished = isolate->IdleNotificationDeadline(deadlineSeconds);
+
+ if (gcFinished)
+ platform->currentThread()->scheduler()->postIdleTaskAfterWakeup(FROM_HERE, WTF::bind<double>(idleGCTaskInMainThread));
+ else
+ platform->currentThread()->scheduler()->postIdleTask(FROM_HERE, WTF::bind<double>(idleGCTaskInMainThread));
+}
+
static void timerTraceProfilerInMainThread(const char* name, int status)
{
if (!status) {
@@ -398,6 +415,8 @@
if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) {
WebScheduler* scheduler = Platform::current()->currentThread()->scheduler();
V8PerIsolateData::enableIdleTasks(isolate, adoptPtr(new V8IdleTaskRunner(scheduler)));
+ // FIXME: Remove idleGCTaskInMainThread once V8 starts posting idle task explicity.
+ scheduler->postIdleTask(FROM_HERE, WTF::bind<double>(idleGCTaskInMainThread));
}
isolate->SetEventLogger(timerTraceProfilerInMainThread);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698