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

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

Issue 2518273003: [Blink Heap] Move isLowEndDevice to Memory Coordinator, attempt #3 (Closed)
Patch Set: Created 4 years 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 116
117 class PLATFORM_EXPORT ProcessHeap { 117 class PLATFORM_EXPORT ProcessHeap {
118 STATIC_ONLY(ProcessHeap); 118 STATIC_ONLY(ProcessHeap);
119 119
120 public: 120 public:
121 static void init(); 121 static void init();
122 static void shutdown(); 122 static void shutdown();
123 123
124 static CrossThreadPersistentRegion& crossThreadPersistentRegion(); 124 static CrossThreadPersistentRegion& crossThreadPersistentRegion();
125 125
126 static bool isLowEndDevice() { return s_isLowEndDevice; }
127 static void increaseTotalAllocatedObjectSize(size_t delta) { 126 static void increaseTotalAllocatedObjectSize(size_t delta) {
128 atomicAdd(&s_totalAllocatedObjectSize, static_cast<long>(delta)); 127 atomicAdd(&s_totalAllocatedObjectSize, static_cast<long>(delta));
129 } 128 }
130 static void decreaseTotalAllocatedObjectSize(size_t delta) { 129 static void decreaseTotalAllocatedObjectSize(size_t delta) {
131 atomicSubtract(&s_totalAllocatedObjectSize, static_cast<long>(delta)); 130 atomicSubtract(&s_totalAllocatedObjectSize, static_cast<long>(delta));
132 } 131 }
133 static size_t totalAllocatedObjectSize() { 132 static size_t totalAllocatedObjectSize() {
134 return acquireLoad(&s_totalAllocatedObjectSize); 133 return acquireLoad(&s_totalAllocatedObjectSize);
135 } 134 }
136 static void increaseTotalMarkedObjectSize(size_t delta) { 135 static void increaseTotalMarkedObjectSize(size_t delta) {
(...skipping 11 matching lines...) Expand all
148 static void decreaseTotalAllocatedSpace(size_t delta) { 147 static void decreaseTotalAllocatedSpace(size_t delta) {
149 atomicSubtract(&s_totalAllocatedSpace, static_cast<long>(delta)); 148 atomicSubtract(&s_totalAllocatedSpace, static_cast<long>(delta));
150 } 149 }
151 static size_t totalAllocatedSpace() { 150 static size_t totalAllocatedSpace() {
152 return acquireLoad(&s_totalAllocatedSpace); 151 return acquireLoad(&s_totalAllocatedSpace);
153 } 152 }
154 static void resetHeapCounters(); 153 static void resetHeapCounters();
155 154
156 private: 155 private:
157 static bool s_shutdownComplete; 156 static bool s_shutdownComplete;
158 static bool s_isLowEndDevice;
159 static size_t s_totalAllocatedSpace; 157 static size_t s_totalAllocatedSpace;
160 static size_t s_totalAllocatedObjectSize; 158 static size_t s_totalAllocatedObjectSize;
161 static size_t s_totalMarkedObjectSize; 159 static size_t s_totalMarkedObjectSize;
162 160
163 friend class ThreadState; 161 friend class ThreadState;
164 }; 162 };
165 163
166 // Stats for the heap. 164 // Stats for the heap.
167 class ThreadHeapStats { 165 class ThreadHeapStats {
168 USING_FAST_MALLOC(ThreadHeapStats); 166 USING_FAST_MALLOC(ThreadHeapStats);
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 template <typename T> 670 template <typename T>
673 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) { 671 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) {
674 T** cell = reinterpret_cast<T**>(object); 672 T** cell = reinterpret_cast<T**>(object);
675 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) 673 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell))
676 *cell = nullptr; 674 *cell = nullptr;
677 } 675 }
678 676
679 } // namespace blink 677 } // namespace blink
680 678
681 #endif // Heap_h 679 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698