| 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 | |
| 41 { | 38 { |
| 42 } | 39 } |
| 43 | 40 |
| 44 void TaskSynchronizer::waitForTaskCompletion() | 41 void TaskSynchronizer::waitForTaskCompletion() |
| 45 { | 42 { |
| 46 if (ThreadState::current()) { | 43 if (ThreadState::current()) { |
| 47 // Prevent the deadlock between park request by other threads and blocki
ng | 44 // Prevent the deadlock between park request by other threads and blocki
ng |
| 48 // by m_synchronousCondition. | 45 // by m_synchronousCondition. |
| 49 ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack); | 46 ThreadState::SafePointScope scope(ThreadState::HeapPointersOnStack); |
| 50 waitForTaskCompletionInternal(); | 47 waitForTaskCompletionInternal(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 64 | 61 |
| 65 void TaskSynchronizer::taskCompleted() | 62 void TaskSynchronizer::taskCompleted() |
| 66 { | 63 { |
| 67 m_synchronousMutex.lock(); | 64 m_synchronousMutex.lock(); |
| 68 m_taskCompleted = true; | 65 m_taskCompleted = true; |
| 69 m_synchronousCondition.signal(); | 66 m_synchronousCondition.signal(); |
| 70 m_synchronousMutex.unlock(); | 67 m_synchronousMutex.unlock(); |
| 71 } | 68 } |
| 72 | 69 |
| 73 } // namespace blink | 70 } // namespace blink |
| OLD | NEW |