| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 private: | 84 private: |
| 85 MutexWrapper() = default; | 85 MutexWrapper() = default; |
| 86 Mutex m_mutex; | 86 Mutex m_mutex; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 // All methods except for clearInternal() | 89 // All methods except for clearInternal() |
| 90 // must be called on |executionContext|'s thread. | 90 // must be called on |executionContext|'s thread. |
| 91 class Bridge | 91 class Bridge |
| 92 : public GarbageCollectedFinalized<Bridge> | 92 : public GarbageCollectedFinalized<Bridge> |
| 93 , public ActiveDOMObject { | 93 , public ActiveDOMObject { |
| 94 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(Bridge); | 94 USING_GARBAGE_COLLECTED_MIXIN(Bridge); |
| 95 public: | 95 public: |
| 96 Bridge(ExecutionContext* executionContext, PassOwnPtr<T> obj, PassRefPtr
<MutexWrapper> mutex, CrossThreadHolder* holder) | 96 Bridge(ExecutionContext* executionContext, PassOwnPtr<T> obj, PassRefPtr
<MutexWrapper> mutex, CrossThreadHolder* holder) |
| 97 : ActiveDOMObject(executionContext) | 97 : ActiveDOMObject(executionContext) |
| 98 , m_obj(obj) | 98 , m_obj(obj) |
| 99 , m_mutex(mutex) | 99 , m_mutex(mutex) |
| 100 , m_holder(holder) | 100 , m_holder(holder) |
| 101 { | 101 { |
| 102 suspendIfNeeded(); | 102 suspendIfNeeded(); |
| 103 } | 103 } |
| 104 | 104 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |