| 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 20 matching lines...) Expand all Loading... |
| 31 #ifndef MemoryInfo_h | 31 #ifndef MemoryInfo_h |
| 32 #define MemoryInfo_h | 32 #define MemoryInfo_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/ScriptWrappable.h" | 34 #include "bindings/core/v8/ScriptWrappable.h" |
| 35 #include "core/CoreExport.h" | 35 #include "core/CoreExport.h" |
| 36 #include "platform/heap/Handle.h" | 36 #include "platform/heap/Handle.h" |
| 37 #include "wtf/Allocator.h" | 37 #include "wtf/Allocator.h" |
| 38 | 38 |
| 39 namespace blink { | 39 namespace blink { |
| 40 | 40 |
| 41 class ScriptState; |
| 42 class ScriptValue; |
| 43 |
| 41 struct HeapInfo { | 44 struct HeapInfo { |
| 42 DISALLOW_NEW(); | 45 DISALLOW_NEW(); |
| 43 HeapInfo() : usedJSHeapSize(0), totalJSHeapSize(0), jsHeapSizeLimit(0) {} | 46 HeapInfo() : usedJSHeapSize(0), totalJSHeapSize(0), jsHeapSizeLimit(0) {} |
| 44 | 47 |
| 45 size_t usedJSHeapSize; | 48 size_t usedJSHeapSize; |
| 46 size_t totalJSHeapSize; | 49 size_t totalJSHeapSize; |
| 47 size_t jsHeapSizeLimit; | 50 size_t jsHeapSizeLimit; |
| 48 }; | 51 }; |
| 49 | 52 |
| 50 class CORE_EXPORT MemoryInfo final : public GarbageCollected<MemoryInfo>, | 53 class CORE_EXPORT MemoryInfo final : public GarbageCollected<MemoryInfo>, |
| 51 public ScriptWrappable { | 54 public ScriptWrappable { |
| 52 DEFINE_WRAPPERTYPEINFO(); | 55 DEFINE_WRAPPERTYPEINFO(); |
| 53 | 56 |
| 54 public: | 57 public: |
| 55 static MemoryInfo* create() { return new MemoryInfo(); } | 58 static MemoryInfo* create() { return new MemoryInfo(); } |
| 56 | 59 |
| 57 size_t totalJSHeapSize() const { return m_info.totalJSHeapSize; } | 60 size_t totalJSHeapSize() const { return m_info.totalJSHeapSize; } |
| 58 size_t usedJSHeapSize() const { return m_info.usedJSHeapSize; } | 61 size_t usedJSHeapSize() const { return m_info.usedJSHeapSize; } |
| 59 size_t jsHeapSizeLimit() const { return m_info.jsHeapSizeLimit; } | 62 size_t jsHeapSizeLimit() const { return m_info.jsHeapSizeLimit; } |
| 60 | 63 |
| 64 ScriptValue toJSONForBinding(ScriptState*) const; |
| 65 |
| 61 DEFINE_INLINE_TRACE() {} | 66 DEFINE_INLINE_TRACE() {} |
| 62 | 67 |
| 63 private: | 68 private: |
| 64 MemoryInfo(); | 69 MemoryInfo(); |
| 65 | 70 |
| 66 HeapInfo m_info; | 71 HeapInfo m_info; |
| 67 }; | 72 }; |
| 68 | 73 |
| 69 CORE_EXPORT size_t quantizeMemorySize(size_t); | 74 CORE_EXPORT size_t quantizeMemorySize(size_t); |
| 70 | 75 |
| 71 } // namespace blink | 76 } // namespace blink |
| 72 | 77 |
| 73 #endif // MemoryInfo_h | 78 #endif // MemoryInfo_h |
| OLD | NEW |