OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 CCScopedThreadProxy_h | 5 #ifndef CCScopedThreadProxy_h |
6 #define CCScopedThreadProxy_h | 6 #define CCScopedThreadProxy_h |
7 | 7 |
8 #include "CCThreadTask.h" | 8 #include "CCThreadTask.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include <wtf/ThreadSafeRefCounted.h> | 10 #include <wtf/ThreadSafeRefCounted.h> |
11 | 11 |
12 namespace WebCore { | 12 namespace cc { |
13 | 13 |
14 // This class is a proxy used to post tasks to an target thread from any other t
hread. The proxy may be shut down at | 14 // This class is a proxy used to post tasks to an target thread from any other t
hread. The proxy may be shut down at |
15 // any point from the target thread after which no more tasks posted to the prox
y will run. In other words, all | 15 // any point from the target thread after which no more tasks posted to the prox
y will run. In other words, all |
16 // tasks posted via a proxy are scoped to the lifecycle of the proxy. Use this w
hen posting tasks to an object that | 16 // tasks posted via a proxy are scoped to the lifecycle of the proxy. Use this w
hen posting tasks to an object that |
17 // might die with tasks in flight. | 17 // might die with tasks in flight. |
18 // | 18 // |
19 // The proxy must be created and shut down from the target thread, tasks may be
posted from any thread. | 19 // The proxy must be created and shut down from the target thread, tasks may be
posted from any thread. |
20 // | 20 // |
21 // Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending
tasks are not cancelled by actually | 21 // Implementation note: Unlike ScopedRunnableMethodFactory in Chromium, pending
tasks are not cancelled by actually |
22 // destroying the proxy. Instead each pending task holds a reference to the prox
y to avoid maintaining an explicit | 22 // destroying the proxy. Instead each pending task holds a reference to the prox
y to avoid maintaining an explicit |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 deref(); | 63 deref(); |
64 } | 64 } |
65 | 65 |
66 CCThread* m_targetThread; | 66 CCThread* m_targetThread; |
67 bool m_shutdown; // Only accessed on the target thread | 67 bool m_shutdown; // Only accessed on the target thread |
68 }; | 68 }; |
69 | 69 |
70 } | 70 } |
71 | 71 |
72 #endif | 72 #endif |
OLD | NEW |