OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_RENDERER_V8_HEAP_STATISTICS_COLLECTOR_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_V8_HEAP_STATISTICS_COLLECTOR_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "content/common/content_export.h" |
| 10 |
| 11 namespace base { |
| 12 class Value; |
| 13 } |
| 14 |
| 15 namespace content { |
| 16 |
| 17 // Retrieves statistics about v8, asynchronously. |
| 18 class CONTENT_EXPORT V8HeapStatisticsCollector { |
| 19 public: |
| 20 static V8HeapStatisticsCollector* Instance(); |
| 21 virtual ~V8HeapStatisticsCollector() {} |
| 22 |
| 23 struct Statistics { |
| 24 Statistics() : total_bytes(0), used_bytes(0) {} |
| 25 size_t total_bytes; |
| 26 size_t used_bytes; |
| 27 }; |
| 28 typedef base::Callback<void(const Statistics&)> ResultCallback; |
| 29 |
| 30 // Begins collecting heap statistics. Only one collection can be pending at |
| 31 // once. Returns true on success. Callback will not be called if initiation |
| 32 // fails. |
| 33 // |
| 34 // Must be called on the RenderThread. |
| 35 virtual bool InitiateCollection(const ResultCallback& callback) = 0; |
| 36 }; |
| 37 |
| 38 } // namespace content |
| 39 |
| 40 #endif // CONTENT_PUBLIC_RENDERER_V8_HEAP_STATISTICS_COLLECTOR_H_ |
OLD | NEW |