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

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

Issue 2007283002: Allow CrossThreadPersistent in collections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 HeapAllocator_h 5 #ifndef HeapAllocator_h
6 #define HeapAllocator_h 6 #define HeapAllocator_h
7 7
8 #include "platform/heap/Heap.h" 8 #include "platform/heap/Heap.h"
9 #include "platform/heap/TraceTraits.h" 9 #include "platform/heap/TraceTraits.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 }; 415 };
416 416
417 template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTrai tsBase<blink::UntracedMember<T>> { 417 template <typename T> struct VectorTraits<blink::UntracedMember<T>> : VectorTrai tsBase<blink::UntracedMember<T>> {
418 STATIC_ONLY(VectorTraits); 418 STATIC_ONLY(VectorTraits);
419 static const bool needsDestruction = false; 419 static const bool needsDestruction = false;
420 static const bool canInitializeWithMemset = true; 420 static const bool canInitializeWithMemset = true;
421 static const bool canClearUnusedSlotsWithMemset = true; 421 static const bool canClearUnusedSlotsWithMemset = true;
422 static const bool canMoveWithMemcpy = true; 422 static const bool canMoveWithMemcpy = true;
423 }; 423 };
424 424
425 template <typename T> struct VectorTraits<blink::CrossThreadPersistent<T>> : Vec torTraitsBase<blink::CrossThreadPersistent<T>> {
sof 2016/05/25 13:26:39 Why is this needed for CrossThreadPersistent, but
keishi 2016/05/26 04:23:13 I need this to do typedef Deque<CrossThreadPersist
keishi 2016/05/26 04:45:43 So I don't need support for Persistent right now.
sof 2016/05/26 05:14:05 That would my preference.
426 STATIC_ONLY(VectorTraits);
427 static const bool needsDestruction = true;
428 static const bool canInitializeWithMemset = false;
sof 2016/05/25 13:26:39 This can be |true|.
keishi 2016/05/26 04:23:13 Done.
429 static const bool canClearUnusedSlotsWithMemset = false;
430 static const bool canMoveWithMemcpy = false;
sof 2016/05/25 13:26:39 Wouldn't |true| work out?
keishi 2016/05/26 04:23:13 Done.
431 };
432
425 template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTrait sBase<blink::HeapVector<T, 0>> { 433 template <typename T> struct VectorTraits<blink::HeapVector<T, 0>> : VectorTrait sBase<blink::HeapVector<T, 0>> {
426 STATIC_ONLY(VectorTraits); 434 STATIC_ONLY(VectorTraits);
427 static const bool needsDestruction = false; 435 static const bool needsDestruction = false;
428 static const bool canInitializeWithMemset = true; 436 static const bool canInitializeWithMemset = true;
429 static const bool canClearUnusedSlotsWithMemset = true; 437 static const bool canClearUnusedSlotsWithMemset = true;
430 static const bool canMoveWithMemcpy = true; 438 static const bool canMoveWithMemcpy = true;
431 }; 439 };
432 440
433 template <typename T> struct VectorTraits<blink::HeapDeque<T, 0>> : VectorTraits Base<blink::HeapDeque<T, 0>> { 441 template <typename T> struct VectorTraits<blink::HeapDeque<T, 0>> : VectorTraits Base<blink::HeapDeque<T, 0>> {
434 STATIC_ONLY(VectorTraits); 442 STATIC_ONLY(VectorTraits);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 // regardless of whether they contain pointers to other heap allocated 552 // regardless of whether they contain pointers to other heap allocated
545 // objects. 553 // objects.
546 static const bool value = true; 554 static const bool value = true;
547 }; 555 };
548 556
549 template<typename T, size_t inlineCapacity> 557 template<typename T, size_t inlineCapacity>
550 struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator <T, inlineCapacity>>> { 558 struct IsGarbageCollectedType<ListHashSetNode<T, blink::HeapListHashSetAllocator <T, inlineCapacity>>> {
551 static const bool value = true; 559 static const bool value = true;
552 }; 560 };
553 561
562 template<typename T> struct HashTraits<blink::CrossThreadPersistent<T>> : Simple ClassHashTraits<blink::CrossThreadPersistent<T>> {
563 STATIC_ONLY(HashTraits);
564 // FIXME: The distinction between PeekInType and PassInType is there for
sof 2016/05/25 13:26:39 nit: shouldn't be adding new FIXMEs by now.
keishi 2016/05/26 04:23:13 Done.
565 // the sake of the reference counting handles. When they are gone the two
566 // types can be merged into PassInType.
567 // FIXME: Implement proper const'ness for iterator types. Requires support
568 // in the marking Visitor.
569 using PeekInType = T*;
570 using PassInType = T*;
571 using IteratorGetType = blink::Member<T>*;
sof 2016/05/25 13:26:39 why Member<> ?
keishi 2016/05/26 04:23:13 Done.
572 using IteratorConstGetType = const blink::CrossThreadPersistent<T>*;
573 using IteratorReferenceType = blink::CrossThreadPersistent<T>&;
574 using IteratorConstReferenceType = const blink::CrossThreadPersistent<T>&;
575 static IteratorReferenceType getToReferenceConversion(IteratorGetType x) { r eturn *x; }
576 static IteratorConstReferenceType getToReferenceConstConversion(IteratorCons tGetType x) { return *x; }
577 // FIXME: Similarly, there is no need for a distinction between PeekOutType
578 // and PassOutType without reference counting.
579 using PeekOutType = T*;
580 using PassOutType = T*;
581
582 template<typename U>
583 static void store(const U& value, blink::CrossThreadPersistent<T>& storage) { storage = value; }
584
585 static PeekOutType peek(const blink::CrossThreadPersistent<T>& value) { retu rn value; }
586 static PassOutType passOut(const blink::CrossThreadPersistent<T>& value) { r eturn value; }
587 };
588
554 } // namespace WTF 589 } // namespace WTF
555 590
556 #endif 591 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698