ssid | 83aa5be | 2015-05-08 12:03:26 | [diff] [blame] | 1 | // 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 | |
ssid | f51216b0 | 2015-06-04 19:46:23 | [diff] [blame^] | 8 | #include <string> |
| 9 | |
ssid | 83aa5be | 2015-05-08 12:03:26 | [diff] [blame] | 10 | #include "base/trace_event/memory_dump_provider.h" |
| 11 | #include "gin/gin_export.h" |
| 12 | |
| 13 | namespace gin { |
| 14 | |
| 15 | class IsolateHolder; |
| 16 | |
| 17 | // Memory dump provider for the chrome://tracing infrastructure. It dumps |
| 18 | // summarized memory stats about the V8 Isolate. |
| 19 | class V8IsolateMemoryDumpProvider |
| 20 | : public base::trace_event::MemoryDumpProvider { |
| 21 | public: |
| 22 | explicit V8IsolateMemoryDumpProvider(IsolateHolder* isolate_holder); |
| 23 | ~V8IsolateMemoryDumpProvider() override; |
| 24 | |
| 25 | // MemoryDumpProvider implementation. |
ssid | f51216b0 | 2015-06-04 19:46:23 | [diff] [blame^] | 26 | bool OnMemoryDump( |
| 27 | base::trace_event::ProcessMemoryDump* process_memory_dump) override; |
ssid | 83aa5be | 2015-05-08 12:03:26 | [diff] [blame] | 28 | |
| 29 | private: |
| 30 | IsolateHolder* isolate_holder_; // Not owned. |
| 31 | |
ssid | f51216b0 | 2015-06-04 19:46:23 | [diff] [blame^] | 32 | void DumpHeapSpacesStatistics( |
| 33 | base::trace_event::ProcessMemoryDump* process_memory_dump, |
| 34 | const std::string& dump_base_name); |
| 35 | void DumpHeapObjectStatistics( |
| 36 | base::trace_event::ProcessMemoryDump* process_memory_dump, |
| 37 | const std::string& dump_base_name); |
ssid | 83aa5be | 2015-05-08 12:03:26 | [diff] [blame] | 38 | |
| 39 | DISALLOW_COPY_AND_ASSIGN(V8IsolateMemoryDumpProvider); |
| 40 | }; |
| 41 | |
| 42 | } // namespace gin |
| 43 | |
| 44 | #endif // GIN_V8_ISOLATE_MEMORY_DUMP_PROVIDER_H_ |