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

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

Issue 2694173002: Remove thread-local weak processing (Closed)
Patch Set: temp Created 3 years, 10 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "wtf/ThreadingPrimitives.h" 47 #include "wtf/ThreadingPrimitives.h"
48 #include <memory> 48 #include <memory>
49 49
50 namespace v8 { 50 namespace v8 {
51 class Isolate; 51 class Isolate;
52 }; 52 };
53 53
54 namespace blink { 54 namespace blink {
55 55
56 class BasePage; 56 class BasePage;
57 class CallbackStack;
58 class GarbageCollectedMixinConstructorMarker; 57 class GarbageCollectedMixinConstructorMarker;
59 class PersistentNode; 58 class PersistentNode;
60 class PersistentRegion; 59 class PersistentRegion;
61 class BaseArena; 60 class BaseArena;
62 class SafePointBarrier; 61 class SafePointBarrier;
63 class ThreadHeap; 62 class ThreadHeap;
64 class ThreadState; 63 class ThreadState;
65 class Visitor; 64 class Visitor;
66 65
67 // Declare that a class has a pre-finalizer. The pre-finalizer is called 66 // Declare that a class has a pre-finalizer. The pre-finalizer is called
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 return **s_threadSpecific; 178 return **s_threadSpecific;
180 } 179 }
181 180
182 static ThreadState* mainThreadState() { 181 static ThreadState* mainThreadState() {
183 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage); 182 return reinterpret_cast<ThreadState*>(s_mainThreadStateStorage);
184 } 183 }
185 184
186 static ThreadState* fromObject(const void*); 185 static ThreadState* fromObject(const void*);
187 186
188 bool isMainThread() const { return this == mainThreadState(); } 187 bool isMainThread() const { return this == mainThreadState(); }
189 #if DCHECK_IS_ON()
190 bool checkThread() const { return m_thread == currentThread(); } 188 bool checkThread() const { return m_thread == currentThread(); }
191 #endif
192 189
193 ThreadHeap& heap() const { return *m_heap; } 190 ThreadHeap& heap() const { return *m_heap; }
194 191
195 // When ThreadState is detaching from non-main thread its 192 // When ThreadState is detaching from non-main thread its
196 // heap is expected to be empty (because it is going away). 193 // heap is expected to be empty (because it is going away).
197 // Perform registered cleanup tasks and garbage collection 194 // Perform registered cleanup tasks and garbage collection
198 // to sweep away any objects that are left on this heap. 195 // to sweep away any objects that are left on this heap.
199 // We assert that nothing must remain after this cleanup. 196 // We assert that nothing must remain after this cleanup.
200 // If assertion does not hold we crash as we are potentially 197 // If assertion does not hold we crash as we are potentially
201 // in the dangling pointer situation. 198 // in the dangling pointer situation.
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 STACK_ALLOCATED(); 379 STACK_ALLOCATED();
383 GCSnapshotInfo(size_t numObjectTypes); 380 GCSnapshotInfo(size_t numObjectTypes);
384 381
385 // Map from gcInfoIndex (vector-index) to count/size. 382 // Map from gcInfoIndex (vector-index) to count/size.
386 Vector<int> liveCount; 383 Vector<int> liveCount;
387 Vector<int> deadCount; 384 Vector<int> deadCount;
388 Vector<size_t> liveSize; 385 Vector<size_t> liveSize;
389 Vector<size_t> deadSize; 386 Vector<size_t> deadSize;
390 }; 387 };
391 388
392 void pushThreadLocalWeakCallback(void*, WeakCallback);
393 bool popAndInvokeThreadLocalWeakCallback(Visitor*);
394 void threadLocalWeakProcessing();
395
396 size_t objectPayloadSizeForTesting(); 389 size_t objectPayloadSizeForTesting();
397 390
398 void shouldFlushHeapDoesNotContainCache() { 391 void shouldFlushHeapDoesNotContainCache() {
399 m_shouldFlushHeapDoesNotContainCache = true; 392 m_shouldFlushHeapDoesNotContainCache = true;
400 } 393 }
401 394
402 void registerTraceDOMWrappers( 395 void registerTraceDOMWrappers(
403 v8::Isolate* isolate, 396 v8::Isolate* isolate,
404 void (*traceDOMWrappers)(v8::Isolate*, Visitor*), 397 void (*traceDOMWrappers)(v8::Isolate*, Visitor*),
405 void (*invalidateDeadObjectsInWrappersMarkingDeque)(v8::Isolate*), 398 void (*invalidateDeadObjectsInWrappersMarkingDeque)(v8::Isolate*),
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 BaseArena* m_arenas[BlinkGC::NumberOfArenas]; 650 BaseArena* m_arenas[BlinkGC::NumberOfArenas];
658 int m_vectorBackingArenaIndex; 651 int m_vectorBackingArenaIndex;
659 size_t m_arenaAges[BlinkGC::NumberOfArenas]; 652 size_t m_arenaAges[BlinkGC::NumberOfArenas];
660 size_t m_currentArenaAges; 653 size_t m_currentArenaAges;
661 654
662 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker; 655 GarbageCollectedMixinConstructorMarker* m_gcMixinMarker;
663 656
664 bool m_shouldFlushHeapDoesNotContainCache; 657 bool m_shouldFlushHeapDoesNotContainCache;
665 GCState m_gcState; 658 GCState m_gcState;
666 659
667 std::unique_ptr<CallbackStack> m_threadLocalWeakCallbackStack;
668
669 using PreFinalizerCallback = bool (*)(void*); 660 using PreFinalizerCallback = bool (*)(void*);
670 using PreFinalizer = std::pair<void*, PreFinalizerCallback>; 661 using PreFinalizer = std::pair<void*, PreFinalizerCallback>;
671 662
672 // Pre-finalizers are called in the reverse order in which they are 663 // Pre-finalizers are called in the reverse order in which they are
673 // registered by the constructors (including constructors of Mixin objects) 664 // registered by the constructors (including constructors of Mixin objects)
674 // for an object, by processing the m_orderedPreFinalizers back-to-front. 665 // for an object, by processing the m_orderedPreFinalizers back-to-front.
675 ListHashSet<PreFinalizer> m_orderedPreFinalizers; 666 ListHashSet<PreFinalizer> m_orderedPreFinalizers;
676 667
677 v8::Isolate* m_isolate; 668 v8::Isolate* m_isolate;
678 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); 669 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 class ThreadStateFor<AnyThread> { 719 class ThreadStateFor<AnyThread> {
729 STATIC_ONLY(ThreadStateFor); 720 STATIC_ONLY(ThreadStateFor);
730 721
731 public: 722 public:
732 static ThreadState* state() { return ThreadState::current(); } 723 static ThreadState* state() { return ThreadState::current(); }
733 }; 724 };
734 725
735 } // namespace blink 726 } // namespace blink
736 727
737 #endif // ThreadState_h 728 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Persistent.h ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698