| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 inline void MessageQueue<DataType>::prepend(PassOwnPtr<DataType> message) | 125 inline void MessageQueue<DataType>::prepend(PassOwnPtr<DataType> message) |
| 126 { | 126 { |
| 127 MutexLocker lock(m_mutex); | 127 MutexLocker lock(m_mutex); |
| 128 m_queue.prepend(message.leakPtr()); | 128 m_queue.prepend(message.leakPtr()); |
| 129 m_condition.signal(); | 129 m_condition.signal(); |
| 130 } | 130 } |
| 131 | 131 |
| 132 template<typename DataType> | 132 template<typename DataType> |
| 133 inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessage() | 133 inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessage() |
| 134 { | 134 { |
| 135 MessageQueueWaitResult exitReason; | 135 MessageQueueWaitResult exitReason; |
| 136 OwnPtr<DataType> result = waitForMessageFilteredWithTimeout(exitReason,
MessageQueue<DataType>::alwaysTruePredicate, infiniteTime()); | 136 OwnPtr<DataType> result = waitForMessageFilteredWithTimeout(exitReason,
MessageQueue<DataType>::alwaysTruePredicate, infiniteTime()); |
| 137 ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueu
eMessageReceived); | 137 ASSERT(exitReason == MessageQueueTerminated || exitReason == MessageQueu
eMessageReceived); |
| 138 return result.release(); | 138 return result.release(); |
| 139 } | 139 } |
| 140 | 140 |
| 141 template<typename DataType> | 141 template<typename DataType> |
| 142 template<typename Predicate> | 142 template<typename Predicate> |
| 143 inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessageFilteredWi
thTimeout(MessageQueueWaitResult& result, Predicate& predicate, double absoluteT
ime) | 143 inline PassOwnPtr<DataType> MessageQueue<DataType>::waitForMessageFilteredWi
thTimeout(MessageQueueWaitResult& result, Predicate& predicate, double absoluteT
ime) |
| 144 { | 144 { |
| 145 MutexLocker lock(m_mutex); | 145 MutexLocker lock(m_mutex); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 } // namespace WTF | 229 } // namespace WTF |
| 230 | 230 |
| 231 using WTF::MessageQueue; | 231 using WTF::MessageQueue; |
| 232 // MessageQueueWaitResult enum and all its values. | 232 // MessageQueueWaitResult enum and all its values. |
| 233 using WTF::MessageQueueWaitResult; | 233 using WTF::MessageQueueWaitResult; |
| 234 using WTF::MessageQueueTerminated; | 234 using WTF::MessageQueueTerminated; |
| 235 using WTF::MessageQueueTimeout; | 235 using WTF::MessageQueueTimeout; |
| 236 using WTF::MessageQueueMessageReceived; | 236 using WTF::MessageQueueMessageReceived; |
| 237 | 237 |
| 238 #endif // MessageQueue_h | 238 #endif // MessageQueue_h |
| OLD | NEW |