Index: Source/core/workers/WorkerThread.cpp |
diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp |
index 09d550a06c513833df9a7d744dca706abfe30713..b41ce4aa3380f7890c9394f40edb1eb1b2189d40 100644 |
--- a/Source/core/workers/WorkerThread.cpp |
+++ b/Source/core/workers/WorkerThread.cpp |
@@ -38,9 +38,7 @@ |
#include "core/workers/WorkerClients.h" |
#include "core/workers/WorkerReportingProxy.h" |
#include "core/workers/WorkerThreadStartupData.h" |
-#include "platform/PlatformThreadData.h" |
#include "platform/Task.h" |
-#include "platform/ThreadTimers.h" |
#include "platform/heap/ThreadState.h" |
#include "platform/weborigin/KURL.h" |
#include "public/platform/Platform.h" |
@@ -156,77 +154,6 @@ private: |
bool m_taskCanceled; |
}; |
-class WorkerSharedTimer : public SharedTimer { |
-public: |
- explicit WorkerSharedTimer(WorkerThread* workerThread) |
- : m_workerThread(workerThread) |
- , m_nextFireTime(0.0) |
- , m_running(false) |
- { } |
- |
- typedef void (*SharedTimerFunction)(); |
- virtual void setFiredFunction(SharedTimerFunction func) |
- { |
- m_sharedTimerFunction = func; |
- if (!m_sharedTimerFunction) |
- m_nextFireTime = 0.0; |
- } |
- |
- virtual void setFireInterval(double interval) |
- { |
- ASSERT(m_sharedTimerFunction); |
- |
- // See BlinkPlatformImpl::setSharedTimerFireInterval for explanation of |
- // why ceil is used in the interval calculation. |
- int64_t delay = static_cast<int64_t>(ceil(interval * 1000)); |
- |
- if (delay < 0) { |
- delay = 0; |
- m_nextFireTime = 0.0; |
- } |
- |
- m_running = true; |
- m_nextFireTime = currentTime() + interval; |
- |
- if (m_lastQueuedTask.get()) |
- m_lastQueuedTask->cancelTask(); |
- |
- // Now queue the task as a cancellable one. |
- OwnPtr<WorkerThreadCancelableTask> task = WorkerThreadCancelableTask::create(bind(&WorkerSharedTimer::OnTimeout, this)); |
- m_lastQueuedTask = task->createWeakPtr(); |
- m_workerThread->postDelayedTask(FROM_HERE, task.release(), delay); |
- } |
- |
- virtual void stop() |
- { |
- m_running = false; |
- m_lastQueuedTask = nullptr; |
- } |
- |
- double nextFireTime() { return m_nextFireTime; } |
- |
-private: |
- void OnTimeout() |
- { |
- ASSERT(m_workerThread->workerGlobalScope()); |
- |
- m_lastQueuedTask = nullptr; |
- |
- if (m_sharedTimerFunction && m_running && !m_workerThread->workerGlobalScope()->isClosing()) |
- m_sharedTimerFunction(); |
- } |
- |
- WorkerThread* m_workerThread; |
- SharedTimerFunction m_sharedTimerFunction; |
- double m_nextFireTime; |
- bool m_running; |
- |
- // The task to run OnTimeout, if any. While OnTimeout resets |
- // m_lastQueuedTask, this must be a weak pointer because the |
- // worker runloop may delete the task as it is shutting down. |
- WeakPtr<WorkerThreadCancelableTask> m_lastQueuedTask; |
-}; |
- |
class WorkerThreadTask : public blink::WebThread::Task { |
WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED; |
public: |
@@ -356,9 +283,6 @@ void WorkerThread::initialize() |
m_isolate = initializeIsolate(); |
m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); |
- |
- m_sharedTimer = adoptPtr(new WorkerSharedTimer(this)); |
- PlatformThreadData::current().threadTimers().setSharedTimer(m_sharedTimer.get()); |
} |
// The corresponding call to stopRunLoop() is in ~WorkerScriptController(). |
@@ -406,9 +330,6 @@ void WorkerThread::cleanup() |
workerReportingProxy().workerThreadTerminated(); |
m_terminationEvent->signal(); |
- |
- // Clean up PlatformThreadData before WTF::WTFThreadData goes away! |
- PlatformThreadData::current().destroy(); |
} |
class WorkerThreadShutdownFinishTask : public ExecutionContextTask { |
@@ -443,7 +364,6 @@ public: |
{ |
WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
workerGlobalScope->stopActiveDOMObjects(); |
- PlatformThreadData::current().threadTimers().setSharedTimer(nullptr); |
// Event listeners would keep DOMWrapperWorld objects alive for too long. Also, they have references to JS objects, |
// which become dangling once Heap is destroyed. |
@@ -551,12 +471,12 @@ void WorkerThread::idleHandler() |
int64_t delay = kLongIdleHandlerDelayMs; |
// Do a script engine idle notification if the next event is distant enough. |
- const double kMinIdleTimespan = 0.3; |
+ /* const double kMinIdleTimespan = 0.3; |
if (m_sharedTimer->nextFireTime() == 0.0 || m_sharedTimer->nextFireTime() > currentTime() + kMinIdleTimespan) { |
bool hasMoreWork = !m_workerGlobalScope->idleNotification(); |
if (hasMoreWork) |
delay = kShortIdleHandlerDelayMs; |
- } |
+ }*/ |
postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler, this), delay); |
} |