 Chromium Code Reviews
 Chromium Code Reviews Issue 956333002:
  Refactor TimeBase to post tasks.  Workers to use real Idle tasks.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master
    
  
    Issue 956333002:
  Refactor TimeBase to post tasks.  Workers to use real Idle tasks.  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/blink.git@master| Index: Source/core/workers/WorkerThread.h | 
| diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h | 
| index 4a66960a7817ce0179f3d486e3edebeab2ac84a6..9adf5bee89a42a3a2382540f75c108d5aafc618e 100644 | 
| --- a/Source/core/workers/WorkerThread.h | 
| +++ b/Source/core/workers/WorkerThread.h | 
| @@ -47,7 +47,6 @@ class WebWaitableEvent; | 
| class WorkerGlobalScope; | 
| class WorkerInspectorController; | 
| class WorkerReportingProxy; | 
| -class WorkerSharedTimer; | 
| class WorkerThreadShutdownFinishTask; | 
| class WorkerThreadStartupData; | 
| class WorkerThreadTask; | 
| @@ -122,16 +121,33 @@ protected: | 
| virtual void destroyIsolate(); | 
| virtual void terminateV8Execution(); | 
| + // This is protected virtual for testing. | 
| + virtual bool doIdleGc(double deadlineSeconds); | 
| + | 
| + WebThreadSupportingGC* threadForTesting() const | 
| + { | 
| + return m_thread.get(); | 
| + } | 
| + | 
| + void setMinQuietPeriodBeforeDoingIdleGcForTesting(long long minQuietPeriodBeforeDoingIdleGc) | 
| 
Sami
2015/04/09 10:52:29
For better or worse, "double seconds" is the prefe
 
alex clarke (OOO till 29th)
2015/04/10 15:29:38
Acknowledged.
 | 
| + { | 
| + m_minQuietPeriodMsBeforeDoingIdleGc = minQuietPeriodBeforeDoingIdleGc; | 
| + } | 
| + | 
| private: | 
| - friend class WorkerSharedTimer; | 
| + friend class WorkerThreadIdleTask; | 
| friend class WorkerThreadShutdownFinishTask; | 
| + friend class WorkerThreadWaitUntilIdleTask; | 
| + friend class WorkerThreadWakeupIdleTask; | 
| void stopInShutdownSequence(); | 
| void stopInternal(); | 
| void initialize(); | 
| void cleanup(); | 
| - void idleHandler(); | 
| + void dontStartIdleTaskYet(); | 
| 
Sami
2015/04/09 10:52:29
Okay, I think I agree that it's probably better no
 
alex clarke (OOO till 29th)
2015/04/10 15:29:37
Acknowledged.
 | 
| + void maybeStartIdleTask(); | 
| + void idleTask(double deadlineSeconds); | 
| void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); | 
| void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTask>, long long delayMs); | 
| @@ -158,6 +174,9 @@ private: | 
| // Used to signal thread termination. | 
| OwnPtr<WebWaitableEvent> m_terminationEvent; | 
| + long long m_minQuietPeriodMsBeforeDoingIdleGc; | 
| + bool m_dontStartIdleTaskYet; | 
| + | 
| // FIXME: This has to be last because of crbug.com/401397 - the | 
| // WorkerThread might get deleted before it had a chance to properly | 
| // shut down. By deleting the WebThread first, we can guarantee that |