Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: third_party/WebKit/Source/modules/fetch/CrossThreadHolder.h

Issue 1884113002: Remove RawPtr.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix HeapTest.Bind expectation Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 ~CrossThreadHolder() 59 ~CrossThreadHolder()
60 { 60 {
61 MutexLocker locker(m_mutex->mutex()); 61 MutexLocker locker(m_mutex->mutex());
62 clearInternal(); 62 clearInternal();
63 } 63 }
64 64
65 private: 65 private:
66 // Object graph: 66 // Object graph:
67 // +------+ +-----------------+ 67 // +------+ +-----------------+
68 // T <-OwnPtr- |Bridge| ---------RawPtr--------> |CrossThreadHolder| 68 // T <-OwnPtr- |Bridge| ---------*-------------> |CrossThreadHolder|
69 // | | <-CrossThreadPersistent- | | 69 // | | <-CrossThreadPersistent- | |
70 // +------+ +-----------------+ 70 // +------+ +-----------------+
71 // | | 71 // | |
72 // +--RefPtr--> MutexWrapper <--RefPtr--+ 72 // +--RefPtr--> MutexWrapper <--RefPtr--+
73 // The CrossThreadPersistent/RawPtr between CrossThreadHolder and Bridge 73 // The CrossThreadPersistent<T>/T* between CrossThreadHolder and Bridge
74 // are protected by MutexWrapper 74 // are protected by MutexWrapper
75 // and cleared when CrossThreadHolder::clearInternal() is called, i.e.: 75 // and cleared when CrossThreadHolder::clearInternal() is called, i.e.:
76 // [1] when |executionContext| is stopped, or 76 // [1] when |executionContext| is stopped, or
77 // [2] when CrossThreadHolder is destructed. 77 // [2] when CrossThreadHolder is destructed.
78 // Then Bridge is shortly garbage collected and T is destructed. 78 // Then Bridge is shortly garbage collected and T is destructed.
79 79
80 class MutexWrapper : public ThreadSafeRefCounted<MutexWrapper> { 80 class MutexWrapper : public ThreadSafeRefCounted<MutexWrapper> {
81 public: 81 public:
82 static PassRefPtr<MutexWrapper> create() { return adoptRef(new MutexWrap per()); } 82 static PassRefPtr<MutexWrapper> create() { return adoptRef(new MutexWrap per()); }
83 Mutex& mutex() { return m_mutex; } 83 Mutex& mutex() { return m_mutex; }
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintTiming.cpp ('k') | third_party/WebKit/Source/platform/CrossThreadCopier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698