blob: b53d2a87ed5b8678243e05601df82e7c9e78ad0c [file] [log] [blame]
ssid83aa5be2015-05-08 12:03:261// Copyright 2015 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 GIN_V8_ISOLATE_MEMORY_DUMP_PROVIDER_H_
6#define GIN_V8_ISOLATE_MEMORY_DUMP_PROVIDER_H_
7
ssidf51216b02015-06-04 19:46:238#include <string>
9
avi90e658dd2015-12-21 07:16:1910#include "base/macros.h"
Siddhartha331b5f0d2017-12-12 14:47:0511#include "base/single_thread_task_runner.h"
ssid83aa5be2015-05-08 12:03:2612#include "base/trace_event/memory_dump_provider.h"
13#include "gin/gin_export.h"
14
15namespace gin {
16
17class IsolateHolder;
18
19// Memory dump provider for the chrome://tracing infrastructure. It dumps
20// summarized memory stats about the V8 Isolate.
21class V8IsolateMemoryDumpProvider
22 : public base::trace_event::MemoryDumpProvider {
23 public:
Siddhartha331b5f0d2017-12-12 14:47:0524 V8IsolateMemoryDumpProvider(
25 IsolateHolder* isolate_holder,
26 scoped_refptr<base::SingleThreadTaskRunner> task_runner);
ssid83aa5be2015-05-08 12:03:2627 ~V8IsolateMemoryDumpProvider() override;
28
29 // MemoryDumpProvider implementation.
ssidf51216b02015-06-04 19:46:2330 bool OnMemoryDump(
ssid90694aeec2015-08-06 13:01:3031 const base::trace_event::MemoryDumpArgs& args,
ssidf51216b02015-06-04 19:46:2332 base::trace_event::ProcessMemoryDump* process_memory_dump) override;
ssid83aa5be2015-05-08 12:03:2633
34 private:
sside36cfaf2015-06-12 16:42:2035 void DumpHeapStatistics(
ssid2888a242015-08-07 23:08:4236 const base::trace_event::MemoryDumpArgs& args,
sside36cfaf2015-06-12 16:42:2037 base::trace_event::ProcessMemoryDump* process_memory_dump);
ssid83aa5be2015-05-08 12:03:2638
sside36cfaf2015-06-12 16:42:2039 IsolateHolder* isolate_holder_; // Not owned.
ssid83aa5be2015-05-08 12:03:2640
41 DISALLOW_COPY_AND_ASSIGN(V8IsolateMemoryDumpProvider);
42};
43
44} // namespace gin
45
46#endif // GIN_V8_ISOLATE_MEMORY_DUMP_PROVIDER_H_