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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Persistent.h

Issue 2521213003: Make Oilpan's Persistent handle work with const types. (Closed)
Patch Set: add typename Created 4 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Persistent_h 5 #ifndef Persistent_h
6 #define Persistent_h 6 #define Persistent_h
7 7
8 #include "platform/heap/Heap.h" 8 #include "platform/heap/Heap.h"
9 #include "platform/heap/Member.h" 9 #include "platform/heap/Member.h"
10 #include "platform/heap/PersistentNode.h" 10 #include "platform/heap/PersistentNode.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 ThreadState::current()->registerStaticPersistentNode(m_persistentNode, 160 ThreadState::current()->registerStaticPersistentNode(m_persistentNode,
161 nullptr); 161 nullptr);
162 LEAK_SANITIZER_IGNORE_OBJECT(this); 162 LEAK_SANITIZER_IGNORE_OBJECT(this);
163 } 163 }
164 return this; 164 return this;
165 } 165 }
166 166
167 protected: 167 protected:
168 NO_SANITIZE_ADDRESS 168 NO_SANITIZE_ADDRESS
169 T* atomicGet() { 169 T* atomicGet() {
170 return reinterpret_cast<T*>( 170 return reinterpret_cast<T*>(acquireLoad(reinterpret_cast<void* volatile*>(
171 acquireLoad(reinterpret_cast<void* volatile*>(&m_raw))); 171 const_cast<typename std::remove_const<T>::type**>(&m_raw))));
172 } 172 }
173 173
174 private: 174 private:
175 NO_SANITIZE_ADDRESS 175 NO_SANITIZE_ADDRESS
176 void assign(T* ptr) { 176 void assign(T* ptr) {
177 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) 177 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) {
178 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr); 178 releaseStore(
179 else 179 reinterpret_cast<void* volatile*>(
180 const_cast<typename std::remove_const<T>::type**>(&m_raw)),
181 const_cast<typename std::remove_const<T>::type*>(ptr));
182 } else {
180 m_raw = ptr; 183 m_raw = ptr;
184 }
181 checkPointer(); 185 checkPointer();
182 if (m_raw) { 186 if (m_raw) {
183 if (!m_persistentNode) 187 if (!m_persistentNode)
184 initialize(); 188 initialize();
185 return; 189 return;
186 } 190 }
187 uninitialize(); 191 uninitialize();
188 } 192 }
189 193
190 template <typename VisitorDispatcher> 194 template <typename VisitorDispatcher>
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 static blink::CrossThreadPersistent<T> Unwrap( 820 static blink::CrossThreadPersistent<T> Unwrap(
817 const blink::CrossThreadWeakPersistent<T>& wrapped) { 821 const blink::CrossThreadWeakPersistent<T>& wrapped) {
818 blink::CrossThreadPersistentRegion::LockScope persistentLock( 822 blink::CrossThreadPersistentRegion::LockScope persistentLock(
819 blink::ProcessHeap::crossThreadPersistentRegion()); 823 blink::ProcessHeap::crossThreadPersistentRegion());
820 return blink::CrossThreadPersistent<T>(wrapped.get()); 824 return blink::CrossThreadPersistent<T>(wrapped.get());
821 } 825 }
822 }; 826 };
823 } 827 }
824 828
825 #endif // Persistent_h 829 #endif // Persistent_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698