OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WorkerThreadLifecycleObserver_h | 5 #ifndef WorkerThreadLifecycleObserver_h |
6 #define WorkerThreadLifecycleObserver_h | 6 #define WorkerThreadLifecycleObserver_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/LifecycleObserver.h" | 9 #include "platform/LifecycleObserver.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // the worker thread is about to terminate. While contextDestroyed() is called, | 22 // the worker thread is about to terminate. While contextDestroyed() is called, |
23 // it is guaranteed that the worker thread is still alive. | 23 // it is guaranteed that the worker thread is still alive. |
24 // | 24 // |
25 // A newly created observer should firstly check whether the worker thread is | 25 // A newly created observer should firstly check whether the worker thread is |
26 // alive by wasContextDestroyedBeforeObserverCreation(). If this return true, | 26 // alive by wasContextDestroyedBeforeObserverCreation(). If this return true, |
27 // the worker thread has already been terminated before the observer is created, | 27 // the worker thread has already been terminated before the observer is created, |
28 // and contextDestroyed() is never notified. | 28 // and contextDestroyed() is never notified. |
29 class CORE_EXPORT WorkerThreadLifecycleObserver | 29 class CORE_EXPORT WorkerThreadLifecycleObserver |
30 : public LifecycleObserver<WorkerThreadLifecycleContext, | 30 : public LifecycleObserver<WorkerThreadLifecycleContext, |
31 WorkerThreadLifecycleObserver> { | 31 WorkerThreadLifecycleObserver> { |
| 32 public: |
| 33 virtual void contextDestroyed(WorkerThreadLifecycleContext*) {} |
| 34 |
32 protected: | 35 protected: |
33 explicit WorkerThreadLifecycleObserver(WorkerThreadLifecycleContext*); | 36 explicit WorkerThreadLifecycleObserver(WorkerThreadLifecycleContext*); |
34 virtual ~WorkerThreadLifecycleObserver(); | 37 virtual ~WorkerThreadLifecycleObserver(); |
35 | 38 |
36 bool wasContextDestroyedBeforeObserverCreation() const { | 39 bool wasContextDestroyedBeforeObserverCreation() const { |
37 return m_wasContextDestroyedBeforeObserverCreation; | 40 return m_wasContextDestroyedBeforeObserverCreation; |
38 } | 41 } |
39 | 42 |
40 private: | 43 private: |
41 const bool m_wasContextDestroyedBeforeObserverCreation; | 44 const bool m_wasContextDestroyedBeforeObserverCreation; |
42 }; | 45 }; |
43 | 46 |
44 } // namespace blink | 47 } // namespace blink |
45 | 48 |
46 #endif // WorkerThreadLifecycleObserver_h | 49 #endif // WorkerThreadLifecycleObserver_h |
OLD | NEW |