| 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();
|
| }
|
| -}
|
| +};
|
|
|
| -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())
|
| + return;
|
| + if (WebScheduler* scheduler = Platform::current()->scheduler())
|
| + scheduler->postIdleTask(FROM_HERE.toWebTraceLocation(), new IdleGCTaskInMainThread());
|
| }
|
|
|
| static void timerTraceProfilerInMainThread(const char* name, int status)
|
|
|