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

Unified Diff: content/public/renderer/v8_heap_statistics_collector.h

Issue 196103006: Add V8 heap statistics in a time-line manner in tracing. (Closed) Base URL: /home/dmikurube/repos/chromium@work-sai-json
Patch Set: rebased Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/public/renderer/v8_heap_statistics_collector.h
diff --git a/content/public/renderer/v8_heap_statistics_collector.h b/content/public/renderer/v8_heap_statistics_collector.h
new file mode 100644
index 0000000000000000000000000000000000000000..45b0ae6329aff5078366497edb9194a98e147320
--- /dev/null
+++ b/content/public/renderer/v8_heap_statistics_collector.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
fmeawad 2014/07/10 18:22:23 2014?
Dai Mikurube (NOT FULLTIME) 2014/07/11 04:34:38 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_RENDERER_V8_HEAP_STATISTICS_COLLECTOR_H_
+#define CONTENT_PUBLIC_RENDERER_V8_HEAP_STATISTICS_COLLECTOR_H_
+
+#include "base/callback.h"
+#include "content/common/content_export.h"
+
+namespace base {
+class Value;
+}
+
+namespace content {
+
+// Retrievs statistics about v8, asynchronously.
+class CONTENT_EXPORT V8HeapStatisticsCollector {
+ public:
+ static V8HeapStatisticsCollector* Instance();
+
+ struct Statistics {
+ Statistics() : total_bytes(0), used_bytes(0) {}
+ size_t total_bytes;
+ size_t used_bytes;
+ };
+ typedef base::Callback<void(const Statistics&)> ResultCallback;
+
+ // Begins collecting heap statistics. Only one collection can be pending at
+ // once. Returns true on success. Callback will not be called if initiation
+ // fails.
+ //
+ // Must be called on the RenderThread.
+ virtual bool InitiateCollection(const ResultCallback& callback) = 0;
+
+ protected:
+ V8HeapStatisticsCollector() {}
+ virtual ~V8HeapStatisticsCollector() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_RENDERER_V8_HEAP_STATISTICS_COLLECTOR_H_

Powered by Google App Engine
This is Rietveld 408576698