Chromium Code Reviews| Index: Source/bindings/core/v8/V8Initializer.cpp |
| diff --git a/Source/bindings/core/v8/V8Initializer.cpp b/Source/bindings/core/v8/V8Initializer.cpp |
| index e038279daa2b5c4da13b0e062ef12ca82cbe0a07..94622a732e04029a1058652733f4d0945f8a6f77 100644 |
| --- a/Source/bindings/core/v8/V8Initializer.cpp |
| +++ b/Source/bindings/core/v8/V8Initializer.cpp |
| @@ -52,8 +52,9 @@ |
| #include "platform/EventDispatchForbiddenScope.h" |
| #include "platform/RuntimeEnabledFeatures.h" |
| #include "platform/TraceEvent.h" |
| -#include "platform/scheduler/Scheduler.h" |
| #include "public/platform/Platform.h" |
| +#include "public/platform/WebScheduler.h" |
| +#include "public/platform/WebTraceLocation.h" |
| #include "wtf/RefPtr.h" |
| #include "wtf/text/WTFString.h" |
| #include <v8-debug.h> |
| @@ -294,29 +295,31 @@ static bool codeGenerationCheckCallbackInMainThread(v8::Local<v8::Context> conte |
| return false; |
| } |
| -static void idleGCTaskInMainThread(double deadlineSeconds); |
| +static void postIdleGCTaskMainThread(); |
| -static void postIdleGCTaskMainThread() |
| -{ |
| - if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) { |
| - Scheduler* scheduler = Scheduler::shared(); |
| - if (scheduler) |
| - scheduler->postIdleTask(FROM_HERE, WTF::bind<double>(idleGCTaskInMainThread)); |
| +class IdleGCTaskInMainThread : public WebScheduler::IdleTask { |
| +public: |
| + virtual void run(double deadlineSeconds) override |
| + { |
| + ASSERT(isMainThread()); |
| + ASSERT(RuntimeEnabledFeatures::v8IdleTasksEnabled()); |
| + v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| + // FIXME: Change V8's API to take a deadline - http://crbug.com/417668 |
| + double idleTimeInSeconds = deadlineSeconds - Platform::current()->monotonicallyIncreasingTime(); |
| + int idleTimeInMillis = static_cast<int>(idleTimeInSeconds * 1000); |
| + if (idleTimeInMillis > 0) |
| + isolate->IdleNotification(idleTimeInMillis); |
| + // FIXME: only repost if there is more work to do. |
| + postIdleGCTaskMainThread(); |
|
eseidel
2014/10/21 16:11:02
So we'll always have a GC task in the run loop? W
Sami
2014/10/21 18:49:34
The idle queue is disabled while the compositor is
|
| } |
| -} |
| +}; |
| -static void idleGCTaskInMainThread(double deadlineSeconds) |
| +static void postIdleGCTaskMainThread() |
| { |
| - ASSERT(isMainThread()); |
| - ASSERT(RuntimeEnabledFeatures::v8IdleTasksEnabled()); |
| - v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| - // FIXME: Change V8's API to take a deadline - http://crbug.com/417668 |
| - double idleTimeInSeconds = deadlineSeconds - Platform::current()->monotonicallyIncreasingTime(); |
| - int idleTimeInMillis = static_cast<int>(idleTimeInSeconds * 1000); |
| - if (idleTimeInMillis > 0) |
| - isolate->IdleNotification(idleTimeInMillis); |
| - // FIXME: only repost if there is more work to do. |
| - postIdleGCTaskMainThread(); |
| + if (!RuntimeEnabledFeatures::v8IdleTasksEnabled()) |
|
eseidel
2014/10/21 16:11:02
Previously this was an assert?
Sami
2014/10/21 18:49:34
Sorry, the diff is a little confusing since I move
|
| + return; |
| + if (WebScheduler* scheduler = Platform::current()->scheduler()) |
|
eseidel
2014/10/21 16:11:02
When do we ever have a platform but not have a sch
Sami
2014/10/21 18:49:34
Initially I thought we would need this for the boo
|
| + scheduler->postIdleTask(FROM_HERE.toWebTraceLocation(), new IdleGCTaskInMainThread()); |
|
eseidel
2014/10/21 16:11:02
We don't just have a shared task which we reuse?
Sami
2014/10/21 18:49:34
Yes, that's the best we can do with the current mo
|
| } |
| static void timerTraceProfilerInMainThread(const char* name, int status) |