| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "config.h" | 29 #include "config.h" |
| 30 #include "platform/TaskSynchronizer.h" | 30 #include "platform/TaskSynchronizer.h" |
| 31 | 31 |
| 32 #include "heap/ThreadState.h" | 32 #include "heap/ThreadState.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 TaskSynchronizer::TaskSynchronizer() | 36 TaskSynchronizer::TaskSynchronizer() |
| 37 : m_taskCompleted(false) | 37 : m_taskCompleted(false) |
| 38 #if ENABLE(ASSERT) |
| 39 , m_hasCheckedForTermination(false) |
| 40 #endif |
| 38 { | 41 { |
| 39 } | 42 } |
| 40 | 43 |
| 41 void TaskSynchronizer::waitForTaskCompletion() | 44 void TaskSynchronizer::waitForTaskCompletion() |
| 42 { | 45 { |
| 43 if (ThreadState::current()) { | 46 if (ThreadState::current()) { |
| 44 // Prevent the deadlock between park request by other threads and blocki
ng | 47 // Prevent the deadlock between park request by other threads and blocki
ng |
| 45 // by m_synchronousCondition. | 48 // by m_synchronousCondition. |
| 46 ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack); | 49 ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack); |
| 47 waitForTaskCompletionInternal(); | 50 waitForTaskCompletionInternal(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 61 | 64 |
| 62 void TaskSynchronizer::taskCompleted() | 65 void TaskSynchronizer::taskCompleted() |
| 63 { | 66 { |
| 64 m_synchronousMutex.lock(); | 67 m_synchronousMutex.lock(); |
| 65 m_taskCompleted = true; | 68 m_taskCompleted = true; |
| 66 m_synchronousCondition.signal(); | 69 m_synchronousCondition.signal(); |
| 67 m_synchronousMutex.unlock(); | 70 m_synchronousMutex.unlock(); |
| 68 } | 71 } |
| 69 | 72 |
| 70 } // namespace blink | 73 } // namespace blink |
| OLD | NEW |