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

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

Issue 1670463002: [Oilpan] Unify memory usage reporters of Oilpan (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 #endif 513 #endif
514 514
515 #if defined(LEAK_SANITIZER) 515 #if defined(LEAK_SANITIZER)
516 void registerStaticPersistentNode(PersistentNode*); 516 void registerStaticPersistentNode(PersistentNode*);
517 void releaseStaticPersistentNodes(); 517 void releaseStaticPersistentNodes();
518 518
519 void enterStaticReferenceRegistrationDisabledScope(); 519 void enterStaticReferenceRegistrationDisabledScope();
520 void leaveStaticReferenceRegistrationDisabledScope(); 520 void leaveStaticReferenceRegistrationDisabledScope();
521 #endif 521 #endif
522 522
523 void reportMemoryToV8();
524
525 size_t heapSize();
sof 2016/02/15 20:47:36 This declaration appears to be without a definitio
peria 2016/02/16 03:20:20 removed.
526 size_t allocatedObjectSize() { return m_allocatedObjectSize; }
sof 2016/02/15 20:47:36 These two can be const methods. And, if concurren
peria 2016/02/16 03:20:20 Yes and they should be, but I removed these access
sof 2016/02/16 06:32:56 If so, why is the latest patchset still using atom
527 size_t markedObjectSize() { return m_markedObjectSize; }
528
529 void resetHeapCounters();
530 void increaseAllocatedObjectSize(size_t);
531 void decreaseAllocatedObjectSize(size_t);
532 void increaseMarkedObjectSize(size_t);
533
523 private: 534 private:
524 enum SnapshotType { 535 enum SnapshotType {
525 HeapSnapshot, 536 HeapSnapshot,
526 FreelistSnapshot 537 FreelistSnapshot
527 }; 538 };
528 539
529 ThreadState(); 540 ThreadState();
530 ~ThreadState(); 541 ~ThreadState();
531 542
532 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope(); 543 NO_SANITIZE_ADDRESS void copyStackUntilSafePointScope();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 size_t m_disabledStaticPersistentsRegistration; 682 size_t m_disabledStaticPersistentsRegistration;
672 #endif 683 #endif
673 684
674 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will 685 // Ideally we want to allocate an array of size |gcInfoTableMax| but it will
675 // waste memory. Thus we limit the array size to 2^8 and share one entry 686 // waste memory. Thus we limit the array size to 2^8 and share one entry
676 // with multiple types of vectors. This won't be an issue in practice, 687 // with multiple types of vectors. This won't be an issue in practice,
677 // since there will be less than 2^8 types of objects in common cases. 688 // since there will be less than 2^8 types of objects in common cases.
678 static const int likelyToBePromptlyFreedArraySize = (1 << 8); 689 static const int likelyToBePromptlyFreedArraySize = (1 << 8);
679 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA rraySize - 1; 690 static const int likelyToBePromptlyFreedArrayMask = likelyToBePromptlyFreedA rraySize - 1;
680 OwnPtr<int[]> m_likelyToBePromptlyFreed; 691 OwnPtr<int[]> m_likelyToBePromptlyFreed;
692
693 // Stats for heap memory of this thread.
694 size_t m_allocatedObjectSize;
695 size_t m_markedObjectSize;
696 size_t m_reportedMemoryToV8;
681 }; 697 };
682 698
683 template<ThreadAffinity affinity> class ThreadStateFor; 699 template<ThreadAffinity affinity> class ThreadStateFor;
684 700
685 template<> class ThreadStateFor<MainThreadOnly> { 701 template<> class ThreadStateFor<MainThreadOnly> {
686 STATIC_ONLY(ThreadStateFor); 702 STATIC_ONLY(ThreadStateFor);
687 public: 703 public:
688 static ThreadState* state() 704 static ThreadState* state()
689 { 705 {
690 // This specialization must only be used from the main thread. 706 // This specialization must only be used from the main thread.
691 ASSERT(ThreadState::current()->isMainThread()); 707 ASSERT(ThreadState::current()->isMainThread());
692 return ThreadState::mainThreadState(); 708 return ThreadState::mainThreadState();
693 } 709 }
694 }; 710 };
695 711
696 template<> class ThreadStateFor<AnyThread> { 712 template<> class ThreadStateFor<AnyThread> {
697 STATIC_ONLY(ThreadStateFor); 713 STATIC_ONLY(ThreadStateFor);
698 public: 714 public:
699 static ThreadState* state() { return ThreadState::current(); } 715 static ThreadState* state() { return ThreadState::current(); }
700 }; 716 };
701 717
702 } // namespace blink 718 } // namespace blink
703 719
704 #endif // ThreadState_h 720 #endif // ThreadState_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapPage.cpp ('k') | third_party/WebKit/Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698