Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 21 matching lines...) Expand all Loading... | |
| 32 #define ThreadState_h | 32 #define ThreadState_h |
| 33 | 33 |
| 34 #include "platform/PlatformExport.h" | 34 #include "platform/PlatformExport.h" |
| 35 #include "platform/heap/BlinkGC.h" | 35 #include "platform/heap/BlinkGC.h" |
| 36 #include "platform/heap/BlinkGCInterruptor.h" | 36 #include "platform/heap/BlinkGCInterruptor.h" |
| 37 #include "platform/heap/ThreadingTraits.h" | 37 #include "platform/heap/ThreadingTraits.h" |
| 38 #include "public/platform/WebThread.h" | 38 #include "public/platform/WebThread.h" |
| 39 #include "wtf/AddressSanitizer.h" | 39 #include "wtf/AddressSanitizer.h" |
| 40 #include "wtf/Allocator.h" | 40 #include "wtf/Allocator.h" |
| 41 #include "wtf/Forward.h" | 41 #include "wtf/Forward.h" |
| 42 #include "wtf/Functional.h" | |
| 42 #include "wtf/HashMap.h" | 43 #include "wtf/HashMap.h" |
| 43 #include "wtf/HashSet.h" | 44 #include "wtf/HashSet.h" |
| 44 #include "wtf/ThreadSpecific.h" | 45 #include "wtf/ThreadSpecific.h" |
| 45 #include "wtf/Threading.h" | 46 #include "wtf/Threading.h" |
| 46 #include "wtf/ThreadingPrimitives.h" | 47 #include "wtf/ThreadingPrimitives.h" |
| 47 | 48 |
| 48 namespace v8 { | 49 namespace v8 { |
| 49 class Isolate; | 50 class Isolate; |
| 50 }; | 51 }; |
| 51 | 52 |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 } | 499 } |
| 499 void allocationPointAdjusted(int arenaIndex); | 500 void allocationPointAdjusted(int arenaIndex); |
| 500 void promptlyFreed(size_t gcInfoIndex); | 501 void promptlyFreed(size_t gcInfoIndex); |
| 501 | 502 |
| 502 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time ; } | 503 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time ; } |
| 503 | 504 |
| 504 #if OS(WIN) && COMPILER(MSVC) | 505 #if OS(WIN) && COMPILER(MSVC) |
| 505 size_t threadStackSize(); | 506 size_t threadStackSize(); |
| 506 #endif | 507 #endif |
| 507 | 508 |
| 509 // Registers a closure that will be called while the thread is shutting down | |
| 510 // (i.e. ThreadState::isTerminating will be true), in order to allow for any | |
| 511 // persistent handles that should be cleared. | |
| 512 void registerCleanupHook(PassOwnPtr<SameThreadClosure>); | |
|
haraken
2016/04/14 23:46:15
registerCleanupHook => registerThreadShutdownHooks
| |
| 513 | |
| 508 #if defined(LEAK_SANITIZER) | 514 #if defined(LEAK_SANITIZER) |
| 509 void registerStaticPersistentNode(PersistentNode*); | 515 void registerStaticPersistentNode(PersistentNode*); |
| 510 void releaseStaticPersistentNodes(); | 516 void releaseStaticPersistentNodes(); |
| 511 | 517 |
| 512 void enterStaticReferenceRegistrationDisabledScope(); | 518 void enterStaticReferenceRegistrationDisabledScope(); |
| 513 void leaveStaticReferenceRegistrationDisabledScope(); | 519 void leaveStaticReferenceRegistrationDisabledScope(); |
| 514 #endif | 520 #endif |
| 515 | 521 |
| 516 void resetHeapCounters(); | 522 void resetHeapCounters(); |
| 517 void increaseAllocatedObjectSize(size_t); | 523 void increaseAllocatedObjectSize(size_t); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 651 CallbackStack* m_threadLocalWeakCallbackStack; | 657 CallbackStack* m_threadLocalWeakCallbackStack; |
| 652 | 658 |
| 653 // Pre-finalizers are called in the reverse order in which they are | 659 // Pre-finalizers are called in the reverse order in which they are |
| 654 // registered by the constructors (including constructors of Mixin objects) | 660 // registered by the constructors (including constructors of Mixin objects) |
| 655 // for an object, by processing the m_orderedPreFinalizers back-to-front. | 661 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
| 656 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 662 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
| 657 | 663 |
| 658 v8::Isolate* m_isolate; | 664 v8::Isolate* m_isolate; |
| 659 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 665 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
| 660 | 666 |
| 667 // Invoked while the thread is terminating. Intended to be used to free | |
| 668 // persistent pointers into the thread's heap. | |
| 669 Vector<OwnPtr<SameThreadClosure>> m_cleanupHooks; | |
|
haraken
2016/04/14 23:46:15
m_cleanupHooks => m_threadShutdownHooks
| |
| 670 | |
| 661 #if defined(ADDRESS_SANITIZER) | 671 #if defined(ADDRESS_SANITIZER) |
| 662 void* m_asanFakeStack; | 672 void* m_asanFakeStack; |
| 663 #endif | 673 #endif |
| 664 | 674 |
| 665 #if defined(LEAK_SANITIZER) | 675 #if defined(LEAK_SANITIZER) |
| 666 // PersistentNodes that are stored in static references; | 676 // PersistentNodes that are stored in static references; |
| 667 // references we have to clear before initiating LSan's leak detection. | 677 // references we have to clear before initiating LSan's leak detection. |
| 668 HashSet<PersistentNode*> m_staticPersistents; | 678 HashSet<PersistentNode*> m_staticPersistents; |
| 669 | 679 |
| 670 // Count that controls scoped disabling of persistent registration. | 680 // Count that controls scoped disabling of persistent registration. |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 700 | 710 |
| 701 template<> class ThreadStateFor<AnyThread> { | 711 template<> class ThreadStateFor<AnyThread> { |
| 702 STATIC_ONLY(ThreadStateFor); | 712 STATIC_ONLY(ThreadStateFor); |
| 703 public: | 713 public: |
| 704 static ThreadState* state() { return ThreadState::current(); } | 714 static ThreadState* state() { return ThreadState::current(); } |
| 705 }; | 715 }; |
| 706 | 716 |
| 707 } // namespace blink | 717 } // namespace blink |
| 708 | 718 |
| 709 #endif // ThreadState_h | 719 #endif // ThreadState_h |
| OLD | NEW |