OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/timing/MemoryInfo.h" | 31 #include "core/timing/MemoryInfo.h" |
32 | 32 |
33 #include <limits> | 33 #include <limits> |
34 | 34 |
35 #include "core/frame/LocalFrame.h" | 35 #include "core/frame/LocalFrame.h" |
36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
37 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
| 38 #include "platform/wtf/CurrentTime.h" |
| 39 #include "platform/wtf/MathExtras.h" |
| 40 #include "platform/wtf/ThreadSpecific.h" |
38 #include "v8/include/v8.h" | 41 #include "v8/include/v8.h" |
39 #include "wtf/CurrentTime.h" | |
40 #include "wtf/MathExtras.h" | |
41 #include "wtf/ThreadSpecific.h" | |
42 | 42 |
43 namespace blink { | 43 namespace blink { |
44 | 44 |
45 static const double kTwentyMinutesInSeconds = 20 * 60; | 45 static const double kTwentyMinutesInSeconds = 20 * 60; |
46 | 46 |
47 static void GetHeapSize(HeapInfo& info) { | 47 static void GetHeapSize(HeapInfo& info) { |
48 v8::HeapStatistics heap_statistics; | 48 v8::HeapStatistics heap_statistics; |
49 v8::Isolate::GetCurrent()->GetHeapStatistics(&heap_statistics); | 49 v8::Isolate::GetCurrent()->GetHeapStatistics(&heap_statistics); |
50 info.used_js_heap_size = heap_statistics.used_heap_size(); | 50 info.used_js_heap_size = heap_statistics.used_heap_size(); |
51 info.total_js_heap_size = heap_statistics.total_physical_size(); | 51 info.total_js_heap_size = heap_statistics.total_physical_size(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 } | 150 } |
151 | 151 |
152 MemoryInfo::MemoryInfo() { | 152 MemoryInfo::MemoryInfo() { |
153 if (RuntimeEnabledFeatures::preciseMemoryInfoEnabled()) | 153 if (RuntimeEnabledFeatures::preciseMemoryInfoEnabled()) |
154 GetHeapSize(info_); | 154 GetHeapSize(info_); |
155 else | 155 else |
156 HeapSizeCache::ForCurrentThread().GetCachedHeapSize(info_); | 156 HeapSizeCache::ForCurrentThread().GetCachedHeapSize(info_); |
157 } | 157 } |
158 | 158 |
159 } // namespace blink | 159 } // namespace blink |
OLD | NEW |