| 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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 } | 494 } |
| 495 void allocationPointAdjusted(int arenaIndex); | 495 void allocationPointAdjusted(int arenaIndex); |
| 496 void promptlyFreed(size_t gcInfoIndex); | 496 void promptlyFreed(size_t gcInfoIndex); |
| 497 | 497 |
| 498 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time
; } | 498 void accumulateSweepingTime(double time) { m_accumulatedSweepingTime += time
; } |
| 499 | 499 |
| 500 #if OS(WIN) && COMPILER(MSVC) | 500 #if OS(WIN) && COMPILER(MSVC) |
| 501 size_t threadStackSize(); | 501 size_t threadStackSize(); |
| 502 #endif | 502 #endif |
| 503 | 503 |
| 504 // Registers a closure that will be called while the thread is shutting down | 504 void freePersistentNode(PersistentNode*); |
| 505 // (i.e. ThreadState::isTerminating will be true), in order to allow for any | 505 |
| 506 // persistent handles that should be cleared. | 506 using PersistentClearCallback = void(*)(void*); |
| 507 void registerThreadShutdownHook(PassOwnPtr<SameThreadClosure>); | 507 |
| 508 void registerStaticPersistentNode(PersistentNode*, PersistentClearCallback); |
| 509 void releaseStaticPersistentNodes(); |
| 508 | 510 |
| 509 #if defined(LEAK_SANITIZER) | 511 #if defined(LEAK_SANITIZER) |
| 510 void registerStaticPersistentNode(PersistentNode*); | |
| 511 void releaseStaticPersistentNodes(); | |
| 512 | |
| 513 void enterStaticReferenceRegistrationDisabledScope(); | 512 void enterStaticReferenceRegistrationDisabledScope(); |
| 514 void leaveStaticReferenceRegistrationDisabledScope(); | 513 void leaveStaticReferenceRegistrationDisabledScope(); |
| 515 #endif | 514 #endif |
| 516 | 515 |
| 517 void resetHeapCounters(); | 516 void resetHeapCounters(); |
| 518 void increaseAllocatedObjectSize(size_t); | 517 void increaseAllocatedObjectSize(size_t); |
| 519 void decreaseAllocatedObjectSize(size_t); | 518 void decreaseAllocatedObjectSize(size_t); |
| 520 void increaseMarkedObjectSize(size_t); | 519 void increaseMarkedObjectSize(size_t); |
| 521 | 520 |
| 522 void callThreadShutdownHooks(); | 521 void callThreadShutdownHooks(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 CallbackStack* m_threadLocalWeakCallbackStack; | 645 CallbackStack* m_threadLocalWeakCallbackStack; |
| 647 | 646 |
| 648 // Pre-finalizers are called in the reverse order in which they are | 647 // Pre-finalizers are called in the reverse order in which they are |
| 649 // registered by the constructors (including constructors of Mixin objects) | 648 // registered by the constructors (including constructors of Mixin objects) |
| 650 // for an object, by processing the m_orderedPreFinalizers back-to-front. | 649 // for an object, by processing the m_orderedPreFinalizers back-to-front. |
| 651 ListHashSet<PreFinalizer> m_orderedPreFinalizers; | 650 ListHashSet<PreFinalizer> m_orderedPreFinalizers; |
| 652 | 651 |
| 653 v8::Isolate* m_isolate; | 652 v8::Isolate* m_isolate; |
| 654 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); | 653 void (*m_traceDOMWrappers)(v8::Isolate*, Visitor*); |
| 655 | 654 |
| 656 // Invoked while the thread is terminating. Intended to be used to free | |
| 657 // persistent pointers into the thread's heap. | |
| 658 Vector<OwnPtr<SameThreadClosure>> m_threadShutdownHooks; | |
| 659 | |
| 660 #if defined(ADDRESS_SANITIZER) | 655 #if defined(ADDRESS_SANITIZER) |
| 661 void* m_asanFakeStack; | 656 void* m_asanFakeStack; |
| 662 #endif | 657 #endif |
| 663 | 658 |
| 659 // PersistentNodes that are stored in static references; |
| 660 // references that either have to be cleared upon the thread |
| 661 // detaching from Oilpan and shutting down or references we |
| 662 // have to clear before initiating LSan's leak detection. |
| 663 HashMap<PersistentNode*, PersistentClearCallback> m_staticPersistents; |
| 664 |
| 664 #if defined(LEAK_SANITIZER) | 665 #if defined(LEAK_SANITIZER) |
| 665 // PersistentNodes that are stored in static references; | |
| 666 // references we have to clear before initiating LSan's leak detection. | |
| 667 HashSet<PersistentNode*> m_staticPersistents; | |
| 668 | |
| 669 // Count that controls scoped disabling of persistent registration. | 666 // Count that controls scoped disabling of persistent registration. |
| 670 size_t m_disabledStaticPersistentsRegistration; | 667 size_t m_disabledStaticPersistentsRegistration; |
| 671 #endif | 668 #endif |
| 672 | 669 |
| 673 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will | 670 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will |
| 674 // waste memory. Thus we limit the array size to 2^8 and share one entry | 671 // waste memory. Thus we limit the array size to 2^8 and share one entry |
| 675 // with multiple types of vectors. This won't be an issue in practice, | 672 // with multiple types of vectors. This won't be an issue in practice, |
| 676 // since there will be less than 2^8 types of objects in common cases. | 673 // since there will be less than 2^8 types of objects in common cases. |
| 677 static const int likelyToBePromptlyFreedArraySize = (1 << 8); | 674 static const int likelyToBePromptlyFreedArraySize = (1 << 8); |
| 678 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; | 675 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA
rraySize - 1; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 699 | 696 |
| 700 template<> class ThreadStateFor<AnyThread> { | 697 template<> class ThreadStateFor<AnyThread> { |
| 701 STATIC_ONLY(ThreadStateFor); | 698 STATIC_ONLY(ThreadStateFor); |
| 702 public: | 699 public: |
| 703 static ThreadState* state() { return ThreadState::current(); } | 700 static ThreadState* state() { return ThreadState::current(); } |
| 704 }; | 701 }; |
| 705 | 702 |
| 706 } // namespace blink | 703 } // namespace blink |
| 707 | 704 |
| 708 #endif // ThreadState_h | 705 #endif // ThreadState_h |
| OLD | NEW |