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

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

Issue 2019673002: Experiment: disallow Persistent use by non-attached threads. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« 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/Member.h" 8 #include "platform/heap/Member.h"
9 #include "platform/heap/PersistentNode.h" 9 #include "platform/heap/PersistentNode.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 private: 174 private:
175 NO_LAZY_SWEEP_SANITIZE_ADDRESS 175 NO_LAZY_SWEEP_SANITIZE_ADDRESS
176 void assign(T* ptr) 176 void assign(T* ptr)
177 { 177 {
178 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) 178 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration)
179 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr); 179 releaseStore(reinterpret_cast<void* volatile*>(&m_raw), ptr);
180 else 180 else
181 m_raw = ptr; 181 m_raw = ptr;
182 checkPointer(); 182 checkPointer();
183 ASSERT(ThreadState::current());
183 if (m_raw) { 184 if (m_raw) {
184 if (!m_persistentNode) 185 if (!m_persistentNode)
185 initialize(); 186 initialize();
186 return; 187 return;
187 } 188 }
188 uninitialize(); 189 uninitialize();
189 } 190 }
190 191
191 NO_LAZY_SWEEP_SANITIZE_ADDRESS 192 NO_LAZY_SWEEP_SANITIZE_ADDRESS
192 void initialize() 193 void initialize()
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 // into it. 743 // into it.
743 // 744 //
744 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like 745 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like
745 // CrossThreadWeakPersistent<>. 746 // CrossThreadWeakPersistent<>.
746 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); } 747 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); }
747 }; 748 };
748 749
749 } // namespace WTF 750 } // namespace WTF
750 751
751 #endif // Persistent_h 752 #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