| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CrossThreadHolder_h | 5 #ifndef CrossThreadHolder_h |
| 6 #define CrossThreadHolder_h | 6 #define CrossThreadHolder_h |
| 7 | 7 |
| 8 #include "core/dom/ActiveDOMObject.h" | 8 #include "core/dom/ActiveDOMObject.h" |
| 9 #include "core/dom/CrossThreadTask.h" | 9 #include "core/dom/CrossThreadTask.h" |
| 10 #include "core/dom/ExecutionContext.h" | 10 #include "core/dom/ExecutionContext.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 { | 134 { |
| 135 MutexLocker locker(m_mutex->mutex()); | 135 MutexLocker locker(m_mutex->mutex()); |
| 136 if (m_holder) | 136 if (m_holder) |
| 137 m_holder->clearInternal(); | 137 m_holder->clearInternal(); |
| 138 ASSERT(!m_holder); | 138 ASSERT(!m_holder); |
| 139 } | 139 } |
| 140 | 140 |
| 141 // We have to destruct |*m_obj| here because destructing |*m_obj| | 141 // We have to destruct |*m_obj| here because destructing |*m_obj| |
| 142 // in ~Bridge() might be too late when |executionContext| is | 142 // in ~Bridge() might be too late when |executionContext| is |
| 143 // stopped. | 143 // stopped. |
| 144 m_obj.clear(); | 144 m_obj.reset(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 | 147 |
| 148 OwnPtr<T> m_obj; | 148 OwnPtr<T> m_obj; |
| 149 // All accesses to |m_holder| must be protected by |m_mutex|. | 149 // All accesses to |m_holder| must be protected by |m_mutex|. |
| 150 RefPtr<MutexWrapper> m_mutex; | 150 RefPtr<MutexWrapper> m_mutex; |
| 151 CrossThreadHolder* m_holder; | 151 CrossThreadHolder* m_holder; |
| 152 }; | 152 }; |
| 153 | 153 |
| 154 // Must be protected by |m_mutex|. | 154 // Must be protected by |m_mutex|. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 168 RefPtr<MutexWrapper> m_mutex; | 168 RefPtr<MutexWrapper> m_mutex; |
| 169 // |m_bridge| is protected by |m_mutex|. | 169 // |m_bridge| is protected by |m_mutex|. |
| 170 // |m_bridge| is cleared before the thread that allocated |*m_bridge| | 170 // |m_bridge| is cleared before the thread that allocated |*m_bridge| |
| 171 // is stopped. | 171 // is stopped. |
| 172 CrossThreadPersistent<Bridge> m_bridge; | 172 CrossThreadPersistent<Bridge> m_bridge; |
| 173 }; | 173 }; |
| 174 | 174 |
| 175 } // namespace blink | 175 } // namespace blink |
| 176 | 176 |
| 177 #endif // CrossThreadHolder_h | 177 #endif // CrossThreadHolder_h |
| OLD | NEW |