OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2013 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 30 matching lines...) Expand all Loading... |
41 WTF_MAKE_NONCOPYABLE(TaskSynchronizer); | 41 WTF_MAKE_NONCOPYABLE(TaskSynchronizer); |
42 public: | 42 public: |
43 TaskSynchronizer(); | 43 TaskSynchronizer(); |
44 | 44 |
45 // Called from a thread that waits for the task completion. | 45 // Called from a thread that waits for the task completion. |
46 void waitForTaskCompletion(); | 46 void waitForTaskCompletion(); |
47 | 47 |
48 // Called from a thread that executes the task. | 48 // Called from a thread that executes the task. |
49 void taskCompleted(); | 49 void taskCompleted(); |
50 | 50 |
51 #if ENABLE(ASSERT) | |
52 bool hasCheckedForTermination() const { return m_hasCheckedForTermination; } | |
53 void setHasCheckedForTermination() { m_hasCheckedForTermination = true; } | |
54 #endif | |
55 | |
56 private: | 51 private: |
57 void waitForTaskCompletionInternal(); | 52 void waitForTaskCompletionInternal(); |
58 | 53 |
59 bool m_taskCompleted; | 54 bool m_taskCompleted; |
60 Mutex m_synchronousMutex; | 55 Mutex m_synchronousMutex; |
61 ThreadCondition m_synchronousCondition; | 56 ThreadCondition m_synchronousCondition; |
62 #if ENABLE(ASSERT) | |
63 bool m_hasCheckedForTermination; | |
64 #endif | |
65 }; | 57 }; |
66 | 58 |
67 } // namespace blink | 59 } // namespace blink |
68 | 60 |
69 #endif // TaskSynchronizer_h | 61 #endif // TaskSynchronizer_h |
OLD | NEW |