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

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

Issue 1842803003: Introduce ProcessHeap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 233
234 NO_LAZY_SWEEP_SANITIZE_ADDRESS 234 NO_LAZY_SWEEP_SANITIZE_ADDRESS
235 void initialize() 235 void initialize()
236 { 236 {
237 ASSERT(!m_persistentNode); 237 ASSERT(!m_persistentNode);
238 if (!m_raw) 238 if (!m_raw)
239 return; 239 return;
240 240
241 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon figuration, crossThreadnessConfiguration>::trace>::trampoline; 241 TraceCallback traceCallback = TraceMethodDelegate<PersistentBase<T, weak nessConfiguration, crossThreadnessConfiguration>, &PersistentBase<T, weaknessCon figuration, crossThreadnessConfiguration>::trace>::trampoline;
242 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) { 242 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) {
243 m_persistentNode = Heap::crossThreadPersistentRegion().allocatePersi stentNode(this, traceCallback); 243 m_persistentNode = ProcessHeap::crossThreadPersistentRegion().alloca tePersistentNode(this, traceCallback);
244 } else { 244 } else {
245 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st ate(); 245 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st ate();
246 ASSERT(state->checkThread()); 246 ASSERT(state->checkThread());
247 m_persistentNode = state->getPersistentRegion()->allocatePersistentN ode(this, traceCallback); 247 m_persistentNode = state->getPersistentRegion()->allocatePersistentN ode(this, traceCallback);
248 #if ENABLE(ASSERT) 248 #if ENABLE(ASSERT)
249 m_state = state; 249 m_state = state;
250 #endif 250 #endif
251 } 251 }
252 } 252 }
253 253
254 void uninitialize() 254 void uninitialize()
255 { 255 {
256 if (!m_persistentNode) 256 if (!m_persistentNode)
257 return; 257 return;
258 258
259 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) { 259 if (crossThreadnessConfiguration == CrossThreadPersistentConfiguration) {
260 Heap::crossThreadPersistentRegion().freePersistentNode(m_persistentN ode); 260 ProcessHeap::crossThreadPersistentRegion().freePersistentNode(m_pers istentNode);
261 } else { 261 } else {
262 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st ate(); 262 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::st ate();
263 ASSERT(state->checkThread()); 263 ASSERT(state->checkThread());
264 // Persistent handle must be created and destructed in the same thre ad. 264 // Persistent handle must be created and destructed in the same thre ad.
265 ASSERT(m_state == state); 265 ASSERT(m_state == state);
266 state->getPersistentRegion()->freePersistentNode(m_persistentNode); 266 state->getPersistentRegion()->freePersistentNode(m_persistentNode);
267 } 267 }
268 m_persistentNode = nullptr; 268 m_persistentNode = nullptr;
269 } 269 }
270 270
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 // into it. 1491 // into it.
1492 // 1492 //
1493 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like 1493 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like
1494 // CrossThreadWeakPersistent<>. 1494 // CrossThreadWeakPersistent<>.
1495 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); } 1495 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); }
1496 }; 1496 };
1497 1497
1498 } // namespace WTF 1498 } // namespace WTF
1499 1499
1500 #endif 1500 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/BlinkGCMemoryDumpProvider.cpp ('k') | third_party/WebKit/Source/platform/heap/Heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698