OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 20 matching lines...) Expand all Loading... | |
31 #include "bindings/core/v8/ScriptSourceCode.h" | 31 #include "bindings/core/v8/ScriptSourceCode.h" |
32 #include "bindings/core/v8/V8GCController.h" | 32 #include "bindings/core/v8/V8GCController.h" |
33 #include "bindings/core/v8/V8Initializer.h" | 33 #include "bindings/core/v8/V8Initializer.h" |
34 #include "core/dom/Microtask.h" | 34 #include "core/dom/Microtask.h" |
35 #include "core/inspector/InspectorInstrumentation.h" | 35 #include "core/inspector/InspectorInstrumentation.h" |
36 #include "core/inspector/WorkerInspectorController.h" | 36 #include "core/inspector/WorkerInspectorController.h" |
37 #include "core/workers/DedicatedWorkerGlobalScope.h" | 37 #include "core/workers/DedicatedWorkerGlobalScope.h" |
38 #include "core/workers/WorkerClients.h" | 38 #include "core/workers/WorkerClients.h" |
39 #include "core/workers/WorkerReportingProxy.h" | 39 #include "core/workers/WorkerReportingProxy.h" |
40 #include "core/workers/WorkerThreadStartupData.h" | 40 #include "core/workers/WorkerThreadStartupData.h" |
41 #include "platform/PlatformThreadData.h" | |
42 #include "platform/Task.h" | 41 #include "platform/Task.h" |
43 #include "platform/ThreadTimers.h" | |
44 #include "platform/heap/SafePoint.h" | 42 #include "platform/heap/SafePoint.h" |
45 #include "platform/heap/ThreadState.h" | 43 #include "platform/heap/ThreadState.h" |
46 #include "platform/weborigin/KURL.h" | 44 #include "platform/weborigin/KURL.h" |
47 #include "public/platform/Platform.h" | 45 #include "public/platform/Platform.h" |
46 #include "public/platform/WebScheduler.h" | |
48 #include "public/platform/WebThread.h" | 47 #include "public/platform/WebThread.h" |
49 #include "public/platform/WebWaitableEvent.h" | 48 #include "public/platform/WebWaitableEvent.h" |
50 #include "wtf/Noncopyable.h" | 49 #include "wtf/Noncopyable.h" |
51 #include "wtf/WeakPtr.h" | 50 #include "wtf/WeakPtr.h" |
52 #include "wtf/text/WTFString.h" | 51 #include "wtf/text/WTFString.h" |
53 | 52 |
54 namespace blink { | 53 namespace blink { |
55 | 54 |
56 namespace { | 55 namespace { |
57 const int64_t kShortIdleHandlerDelayMs = 1000; | 56 const double kLongIdleHandlerDelaySecs = 1.0; |
58 const int64_t kLongIdleHandlerDelayMs = 10*1000; | |
59 | 57 |
60 class MicrotaskRunner : public WebThread::TaskObserver { | 58 class MicrotaskRunner : public WebThread::TaskObserver { |
61 public: | 59 public: |
62 explicit MicrotaskRunner(WorkerThread* workerThread) | 60 explicit MicrotaskRunner(WorkerThread* workerThread) |
63 : m_workerThread(workerThread) | 61 : m_workerThread(workerThread) |
64 { | 62 { |
65 } | 63 } |
66 | 64 |
67 virtual void willProcessTask() override { } | 65 virtual void willProcessTask() override { } |
68 virtual void didProcessTask() override | 66 virtual void didProcessTask() override |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 : m_closure(closure) | 122 : m_closure(closure) |
125 , m_weakFactory(this) | 123 , m_weakFactory(this) |
126 , m_taskCanceled(false) | 124 , m_taskCanceled(false) |
127 { } | 125 { } |
128 | 126 |
129 OwnPtr<Closure> m_closure; | 127 OwnPtr<Closure> m_closure; |
130 WeakPtrFactory<WorkerThreadCancelableTask> m_weakFactory; | 128 WeakPtrFactory<WorkerThreadCancelableTask> m_weakFactory; |
131 bool m_taskCanceled; | 129 bool m_taskCanceled; |
132 }; | 130 }; |
133 | 131 |
134 class WorkerSharedTimer : public SharedTimer { | |
135 public: | |
136 explicit WorkerSharedTimer(WorkerThread* workerThread) | |
137 : m_workerThread(workerThread) | |
138 , m_running(false) | |
139 { } | |
140 | |
141 typedef void (*SharedTimerFunction)(); | |
142 virtual void setFiredFunction(SharedTimerFunction func) | |
143 { | |
144 m_sharedTimerFunction = func; | |
145 } | |
146 | |
147 virtual void setFireInterval(double interval) | |
148 { | |
149 ASSERT(m_sharedTimerFunction); | |
150 | |
151 // See BlinkPlatformImpl::setSharedTimerFireInterval for explanation of | |
152 // why ceil is used in the interval calculation. | |
153 int64_t delay = static_cast<int64_t>(ceil(interval * 1000)); | |
154 | |
155 if (delay < 0) { | |
156 delay = 0; | |
157 } | |
158 | |
159 m_running = true; | |
160 | |
161 if (m_lastQueuedTask.get()) | |
162 m_lastQueuedTask->cancelTask(); | |
163 | |
164 // Now queue the task as a cancellable one. | |
165 OwnPtr<WorkerThreadCancelableTask> task = WorkerThreadCancelableTask::cr eate(bind(&WorkerSharedTimer::OnTimeout, this)); | |
166 m_lastQueuedTask = task->createWeakPtr(); | |
167 m_workerThread->postDelayedTask(FROM_HERE, task.release(), delay); | |
168 } | |
169 | |
170 virtual void stop() | |
171 { | |
172 m_running = false; | |
173 m_lastQueuedTask = nullptr; | |
174 } | |
175 | |
176 private: | |
177 void OnTimeout() | |
178 { | |
179 ASSERT(m_workerThread->workerGlobalScope()); | |
180 | |
181 m_lastQueuedTask = nullptr; | |
182 | |
183 if (m_sharedTimerFunction && m_running && !m_workerThread->workerGlobalS cope()->isClosing()) | |
184 m_sharedTimerFunction(); | |
185 } | |
186 | |
187 WorkerThread* m_workerThread; | |
188 SharedTimerFunction m_sharedTimerFunction; | |
189 bool m_running; | |
190 | |
191 // The task to run OnTimeout, if any. While OnTimeout resets | |
192 // m_lastQueuedTask, this must be a weak pointer because the | |
193 // worker runloop may delete the task as it is shutting down. | |
194 WeakPtr<WorkerThreadCancelableTask> m_lastQueuedTask; | |
195 }; | |
196 | |
197 class WorkerThreadTask : public blink::WebThread::Task { | 132 class WorkerThreadTask : public blink::WebThread::Task { |
198 WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED(WorkerThread Task); | 133 WTF_MAKE_NONCOPYABLE(WorkerThreadTask); WTF_MAKE_FAST_ALLOCATED(WorkerThread Task); |
199 public: | 134 public: |
200 static PassOwnPtr<WorkerThreadTask> create(WorkerThread& workerThread, PassO wnPtr<ExecutionContextTask> task, bool isInstrumented) | 135 static PassOwnPtr<WorkerThreadTask> create(WorkerThread& workerThread, PassO wnPtr<ExecutionContextTask> task, bool isInstrumented) |
201 { | 136 { |
202 return adoptPtr(new WorkerThreadTask(workerThread, task, isInstrumented) ); | 137 return adoptPtr(new WorkerThreadTask(workerThread, task, isInstrumented) ); |
203 } | 138 } |
204 | 139 |
205 virtual ~WorkerThreadTask() { } | 140 virtual ~WorkerThreadTask() { } |
206 | 141 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
257 | 192 |
258 WorkerThread::WorkerThread(const char* threadName, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, PassOwnPtr<Worke rThreadStartupData> startupData) | 193 WorkerThread::WorkerThread(const char* threadName, PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, PassOwnPtr<Worke rThreadStartupData> startupData) |
259 : m_threadName(threadName) | 194 : m_threadName(threadName) |
260 , m_terminated(false) | 195 , m_terminated(false) |
261 , m_workerLoaderProxy(workerLoaderProxy) | 196 , m_workerLoaderProxy(workerLoaderProxy) |
262 , m_workerReportingProxy(workerReportingProxy) | 197 , m_workerReportingProxy(workerReportingProxy) |
263 , m_startupData(startupData) | 198 , m_startupData(startupData) |
264 , m_isolate(nullptr) | 199 , m_isolate(nullptr) |
265 , m_shutdownEvent(adoptPtr(blink::Platform::current()->createWaitableEvent() )) | 200 , m_shutdownEvent(adoptPtr(blink::Platform::current()->createWaitableEvent() )) |
266 , m_terminationEvent(adoptPtr(blink::Platform::current()->createWaitableEven t())) | 201 , m_terminationEvent(adoptPtr(blink::Platform::current()->createWaitableEven t())) |
202 , m_webScheduler(nullptr) | |
267 { | 203 { |
268 MutexLocker lock(threadSetMutex()); | 204 MutexLocker lock(threadSetMutex()); |
269 workerThreads().add(this); | 205 workerThreads().add(this); |
270 } | 206 } |
271 | 207 |
272 WorkerThread::~WorkerThread() | 208 WorkerThread::~WorkerThread() |
273 { | 209 { |
274 MutexLocker lock(threadSetMutex()); | 210 MutexLocker lock(threadSetMutex()); |
275 ASSERT(workerThreads().contains(this)); | 211 ASSERT(workerThreads().contains(this)); |
276 workerThreads().remove(this); | 212 workerThreads().remove(this); |
(...skipping 15 matching lines...) Expand all Loading... | |
292 m_workerInspectorController->interruptAndDispatchInspectorCommands(); | 228 m_workerInspectorController->interruptAndDispatchInspectorCommands(); |
293 } | 229 } |
294 | 230 |
295 PlatformThreadId WorkerThread::platformThreadId() const | 231 PlatformThreadId WorkerThread::platformThreadId() const |
296 { | 232 { |
297 if (!m_thread) | 233 if (!m_thread) |
298 return 0; | 234 return 0; |
299 return m_thread->platformThread().threadId(); | 235 return m_thread->platformThread().threadId(); |
300 } | 236 } |
301 | 237 |
238 // TODO(alexclarke): Use base::Bind instead of this class when the repo's merge. Unfortunately we | |
239 // can't use WTF::bind because the type-erasure for member function pointers wit h parameters is broken. | |
240 class WorkerThreadIdleTask : public WebThread::IdleTask { | |
241 public: | |
242 explicit WorkerThreadIdleTask(WorkerThread* thread) | |
243 : m_thread(thread) { } | |
244 | |
245 ~WorkerThreadIdleTask() override { } | |
246 | |
247 void run(double deadlineSeconds) override | |
248 { | |
249 m_thread->idleTask(deadlineSeconds); | |
250 } | |
251 | |
252 private: | |
253 RawPtr<WorkerThread> m_thread; | |
Sami
2015/04/17 15:34:31
// Not owned?
alex clarke (OOO till 29th)
2015/04/20 10:06:53
Done.
| |
254 }; | |
255 | |
302 void WorkerThread::initialize() | 256 void WorkerThread::initialize() |
303 { | 257 { |
304 KURL scriptURL = m_startupData->m_scriptURL; | 258 KURL scriptURL = m_startupData->m_scriptURL; |
305 String sourceCode = m_startupData->m_sourceCode; | 259 String sourceCode = m_startupData->m_sourceCode; |
306 WorkerThreadStartMode startMode = m_startupData->m_startMode; | 260 WorkerThreadStartMode startMode = m_startupData->m_startMode; |
307 OwnPtr<Vector<char>> cachedMetaData = m_startupData->m_cachedMetaData.releas e(); | 261 OwnPtr<Vector<char>> cachedMetaData = m_startupData->m_cachedMetaData.releas e(); |
308 V8CacheOptions v8CacheOptions = m_startupData->m_v8CacheOptions; | 262 V8CacheOptions v8CacheOptions = m_startupData->m_v8CacheOptions; |
309 | 263 |
310 { | 264 { |
311 MutexLocker lock(m_threadCreationMutex); | 265 MutexLocker lock(m_threadCreationMutex); |
312 | 266 |
313 // The worker was terminated before the thread had a chance to run. | 267 // The worker was terminated before the thread had a chance to run. |
314 if (m_terminated) { | 268 if (m_terminated) { |
315 // Notify the proxy that the WorkerGlobalScope has been disposed of. | 269 // Notify the proxy that the WorkerGlobalScope has been disposed of. |
316 // This can free this thread object, hence it must not be touched af terwards. | 270 // This can free this thread object, hence it must not be touched af terwards. |
317 m_workerReportingProxy.workerThreadTerminated(); | 271 m_workerReportingProxy.workerThreadTerminated(); |
318 return; | 272 return; |
319 } | 273 } |
320 | 274 |
321 m_microtaskRunner = adoptPtr(new MicrotaskRunner(this)); | 275 m_microtaskRunner = adoptPtr(new MicrotaskRunner(this)); |
322 m_thread->addTaskObserver(m_microtaskRunner.get()); | 276 m_thread->addTaskObserver(m_microtaskRunner.get()); |
323 m_thread->attachGC(); | 277 m_thread->attachGC(); |
324 | 278 |
325 m_isolate = initializeIsolate(); | 279 m_isolate = initializeIsolate(); |
326 m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); | 280 m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); |
327 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge t() ? cachedMetaData->size() : 0); | 281 m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.ge t() ? cachedMetaData->size() : 0); |
328 | |
329 PlatformThreadData::current().threadTimers().setSharedTimer(adoptPtr(new WorkerSharedTimer(this))); | |
330 } | 282 } |
331 | 283 |
332 // The corresponding call to stopRunLoop() is in ~WorkerScriptController(). | 284 // The corresponding call to stopRunLoop() is in ~WorkerScriptController(). |
333 didStartRunLoop(); | 285 didStartRunLoop(); |
334 | 286 |
335 // Notify proxy that a new WorkerGlobalScope has been created and started. | 287 // Notify proxy that a new WorkerGlobalScope has been created and started. |
336 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get()); | 288 m_workerReportingProxy.workerGlobalScopeStarted(m_workerGlobalScope.get()); |
337 | 289 |
338 WorkerScriptController* script = m_workerGlobalScope->script(); | 290 WorkerScriptController* script = m_workerGlobalScope->script(); |
339 if (!script->isExecutionForbidden()) | 291 if (!script->isExecutionForbidden()) |
340 script->initializeContextIfNeeded(); | 292 script->initializeContextIfNeeded(); |
341 if (startMode == PauseWorkerGlobalScopeOnStart) | 293 if (startMode == PauseWorkerGlobalScopeOnStart) |
342 m_workerGlobalScope->workerInspectorController()->pauseOnStart(); | 294 m_workerGlobalScope->workerInspectorController()->pauseOnStart(); |
343 | 295 |
344 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip tCachedMetadataHandler(scriptURL, cachedMetaData.get())); | 296 OwnPtr<CachedMetadataHandler> handler(workerGlobalScope()->createWorkerScrip tCachedMetadataHandler(scriptURL, cachedMetaData.get())); |
345 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul lptr, handler.get(), v8CacheOptions); | 297 bool success = script->evaluate(ScriptSourceCode(sourceCode, scriptURL), nul lptr, handler.get(), v8CacheOptions); |
346 m_workerGlobalScope->didEvaluateWorkerScript(); | 298 m_workerGlobalScope->didEvaluateWorkerScript(); |
347 m_workerReportingProxy.didEvaluateWorkerScript(success); | 299 m_workerReportingProxy.didEvaluateWorkerScript(success); |
348 | 300 |
349 postInitialize(); | 301 postInitialize(); |
350 | 302 |
351 postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler, this), kShortIdleHandlerDelayMs); | 303 m_webScheduler = m_thread->platformThread().scheduler(); |
304 m_webScheduler->postIdleTaskAfterWakeup(FROM_HERE, new WorkerThreadIdleTask( this)); | |
352 } | 305 } |
353 | 306 |
354 PassOwnPtr<WebThreadSupportingGC> WorkerThread::createWebThreadSupportingGC() | 307 PassOwnPtr<WebThreadSupportingGC> WorkerThread::createWebThreadSupportingGC() |
355 { | 308 { |
356 return WebThreadSupportingGC::create(m_threadName); | 309 return WebThreadSupportingGC::create(m_threadName); |
357 } | 310 } |
358 | 311 |
359 void WorkerThread::cleanup() | 312 void WorkerThread::cleanup() |
360 { | 313 { |
361 // This should be called before we start the shutdown procedure. | 314 // This should be called before we start the shutdown procedure. |
(...skipping 12 matching lines...) Expand all Loading... | |
374 destroyIsolate(); | 327 destroyIsolate(); |
375 | 328 |
376 m_thread->removeTaskObserver(m_microtaskRunner.get()); | 329 m_thread->removeTaskObserver(m_microtaskRunner.get()); |
377 m_microtaskRunner = nullptr; | 330 m_microtaskRunner = nullptr; |
378 | 331 |
379 // Notify the proxy that the WorkerGlobalScope has been disposed of. | 332 // Notify the proxy that the WorkerGlobalScope has been disposed of. |
380 // This can free this thread object, hence it must not be touched afterwards . | 333 // This can free this thread object, hence it must not be touched afterwards . |
381 workerReportingProxy().workerThreadTerminated(); | 334 workerReportingProxy().workerThreadTerminated(); |
382 | 335 |
383 m_terminationEvent->signal(); | 336 m_terminationEvent->signal(); |
384 | |
385 // Clean up PlatformThreadData before WTF::WTFThreadData goes away! | |
386 PlatformThreadData::current().destroy(); | |
387 } | 337 } |
388 | 338 |
389 class WorkerThreadShutdownFinishTask : public ExecutionContextTask { | 339 class WorkerThreadShutdownFinishTask : public ExecutionContextTask { |
390 public: | 340 public: |
391 static PassOwnPtr<WorkerThreadShutdownFinishTask> create() | 341 static PassOwnPtr<WorkerThreadShutdownFinishTask> create() |
392 { | 342 { |
393 return adoptPtr(new WorkerThreadShutdownFinishTask()); | 343 return adoptPtr(new WorkerThreadShutdownFinishTask()); |
394 } | 344 } |
395 | 345 |
396 virtual void performTask(ExecutionContext *context) | 346 virtual void performTask(ExecutionContext *context) |
(...skipping 13 matching lines...) Expand all Loading... | |
410 public: | 360 public: |
411 static PassOwnPtr<WorkerThreadShutdownStartTask> create() | 361 static PassOwnPtr<WorkerThreadShutdownStartTask> create() |
412 { | 362 { |
413 return adoptPtr(new WorkerThreadShutdownStartTask()); | 363 return adoptPtr(new WorkerThreadShutdownStartTask()); |
414 } | 364 } |
415 | 365 |
416 virtual void performTask(ExecutionContext *context) | 366 virtual void performTask(ExecutionContext *context) |
417 { | 367 { |
418 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 368 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
419 workerGlobalScope->stopActiveDOMObjects(); | 369 workerGlobalScope->stopActiveDOMObjects(); |
420 PlatformThreadData::current().threadTimers().setSharedTimer(nullptr); | |
421 | 370 |
422 // Event listeners would keep DOMWrapperWorld objects alive for too long . Also, they have references to JS objects, | 371 // Event listeners would keep DOMWrapperWorld objects alive for too long . Also, they have references to JS objects, |
423 // which become dangling once Heap is destroyed. | 372 // which become dangling once Heap is destroyed. |
424 workerGlobalScope->removeAllEventListeners(); | 373 workerGlobalScope->removeAllEventListeners(); |
425 | 374 |
426 // Stick a shutdown command at the end of the queue, so that we deal | 375 // Stick a shutdown command at the end of the queue, so that we deal |
427 // with all the cleanup tasks the databases post first. | 376 // with all the cleanup tasks the databases post first. |
428 workerGlobalScope->postTask(FROM_HERE, WorkerThreadShutdownFinishTask::c reate()); | 377 workerGlobalScope->postTask(FROM_HERE, WorkerThreadShutdownFinishTask::c reate()); |
429 } | 378 } |
430 | 379 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
502 | 451 |
503 for (WorkerThread* thread : threads) | 452 for (WorkerThread* thread : threads) |
504 thread->terminationEvent()->wait(); | 453 thread->terminationEvent()->wait(); |
505 } | 454 } |
506 | 455 |
507 bool WorkerThread::isCurrentThread() const | 456 bool WorkerThread::isCurrentThread() const |
508 { | 457 { |
509 return m_thread && m_thread->isCurrentThread(); | 458 return m_thread && m_thread->isCurrentThread(); |
510 } | 459 } |
511 | 460 |
512 void WorkerThread::idleHandler() | 461 void WorkerThread::idleTask(double deadlineSeconds) |
513 { | 462 { |
514 ASSERT(m_workerGlobalScope.get()); | 463 double gcDeadlineSeconds = deadlineSeconds; |
515 int64_t delay = kLongIdleHandlerDelayMs; | |
516 | 464 |
517 // Do a script engine idle notification if the next event is distant enough. | 465 // The V8 GC does some GC steps (e.g. compaction) only when the idle notific ation is ~1s. |
518 const double kMinIdleTimespan = 0.3; | 466 // TODO(rmcilroy): Refactor so extending the deadline like this this isn't n eeded. |
519 const double nextFireTime = PlatformThreadData::current().threadTimers().nex tFireTime(); | 467 if (m_webScheduler->canExceedIdleDeadlineIfRequired()) |
520 if (nextFireTime == 0.0 || nextFireTime > currentTime() + kMinIdleTimespan) { | 468 gcDeadlineSeconds = Platform::current()->monotonicallyIncreasingTime() + kLongIdleHandlerDelaySecs; |
521 bool hasMoreWork = !isolate()->IdleNotificationDeadline(Platform::curren t()->monotonicallyIncreasingTime() + 1.0); | 469 |
522 if (hasMoreWork) | 470 if (doIdleGc(gcDeadlineSeconds)) |
523 delay = kShortIdleHandlerDelayMs; | 471 m_webScheduler->postIdleTaskAfterWakeup(FROM_HERE, new WorkerThreadIdleT ask(this)); |
472 else | |
473 m_webScheduler->postIdleTask(FROM_HERE, new WorkerThreadIdleTask(this)); | |
474 } | |
475 | |
476 bool WorkerThread::doIdleGc(double deadlineSeconds) | |
477 { | |
478 if (deadlineSeconds > Platform::current()->monotonicallyIncreasingTime()) { | |
479 return isolate()->IdleNotificationDeadline(deadlineSeconds); | |
524 } | 480 } |
525 | 481 |
526 postDelayedTask(FROM_HERE, createSameThreadTask(&WorkerThread::idleHandler, this), delay); | 482 return false; |
527 } | 483 } |
528 | 484 |
529 void WorkerThread::postTask(const WebTraceLocation& location, PassOwnPtr<Executi onContextTask> task) | 485 void WorkerThread::postTask(const WebTraceLocation& location, PassOwnPtr<Executi onContextTask> task) |
530 { | 486 { |
531 m_thread->postTask(location, WorkerThreadTask::create(*this, task, true).lea kPtr()); | 487 m_thread->postTask(location, WorkerThreadTask::create(*this, task, true).lea kPtr()); |
532 } | 488 } |
533 | 489 |
534 void WorkerThread::postDelayedTask(const WebTraceLocation& location, PassOwnPtr< ExecutionContextTask> task, long long delayMs) | 490 void WorkerThread::postDelayedTask(const WebTraceLocation& location, PassOwnPtr< ExecutionContextTask> task, long long delayMs) |
535 { | 491 { |
536 m_thread->postDelayedTask(location, WorkerThreadTask::create(*this, task, tr ue).leakPtr(), delayMs); | 492 m_thread->postDelayedTask(location, WorkerThreadTask::create(*this, task, tr ue).leakPtr(), delayMs); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 566 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
611 } | 567 } |
612 | 568 |
613 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) | 569 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) |
614 { | 570 { |
615 MutexLocker locker(m_workerInspectorControllerMutex); | 571 MutexLocker locker(m_workerInspectorControllerMutex); |
616 m_workerInspectorController = workerInspectorController; | 572 m_workerInspectorController = workerInspectorController; |
617 } | 573 } |
618 | 574 |
619 } // namespace blink | 575 } // namespace blink |
OLD | NEW |