ssid | 9f8022f | 2015-10-12 17:49:03 | [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 | |
Lei Zhang | 02f91da | 2021-04-26 19:47:38 | [diff] [blame] | 5 | #ifndef SQL_SQL_MEMORY_DUMP_PROVIDER_H_ |
| 6 | #define SQL_SQL_MEMORY_DUMP_PROVIDER_H_ |
ssid | 9f8022f | 2015-10-12 17:49:03 | [diff] [blame] | 7 | |
Victor Costan | e56cc68 | 2018-12-27 01:53:46 | [diff] [blame] | 8 | #include "base/component_export.h" |
ssid | 9f8022f | 2015-10-12 17:49:03 | [diff] [blame] | 9 | #include "base/memory/singleton.h" |
| 10 | #include "base/trace_event/memory_dump_provider.h" |
ssid | 9f8022f | 2015-10-12 17:49:03 | [diff] [blame] | 11 | |
| 12 | namespace sql { |
| 13 | |
| 14 | // Adds process-wide memory usage statistics about sqlite to chrome://tracing. |
Victor Costan | cfbfa60 | 2018-08-01 23:24:46 | [diff] [blame] | 15 | // sql::Database::OnMemoryDump adds per-connection memory statistics. |
Victor Costan | e56cc68 | 2018-12-27 01:53:46 | [diff] [blame] | 16 | class COMPONENT_EXPORT(SQL) SqlMemoryDumpProvider |
ssid | 9f8022f | 2015-10-12 17:49:03 | [diff] [blame] | 17 | : public base::trace_event::MemoryDumpProvider { |
| 18 | public: |
| 19 | static SqlMemoryDumpProvider* GetInstance(); |
| 20 | |
Victor Costan | 00c7643 | 2021-07-07 16:55:58 | [diff] [blame] | 21 | SqlMemoryDumpProvider(const SqlMemoryDumpProvider&) = delete; |
| 22 | SqlMemoryDumpProvider& operator=(const SqlMemoryDumpProvider&) = delete; |
| 23 | |
ssid | 9f8022f | 2015-10-12 17:49:03 | [diff] [blame] | 24 | // MemoryDumpProvider implementation. |
| 25 | bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 26 | base::trace_event::ProcessMemoryDump* pmd) override; |
| 27 | |
| 28 | private: |
| 29 | friend struct base::DefaultSingletonTraits<SqlMemoryDumpProvider>; |
| 30 | |
| 31 | SqlMemoryDumpProvider(); |
| 32 | ~SqlMemoryDumpProvider() override; |
ssid | 9f8022f | 2015-10-12 17:49:03 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | } // namespace sql |
| 36 | |
Lei Zhang | 02f91da | 2021-04-26 19:47:38 | [diff] [blame] | 37 | #endif // SQL_SQL_MEMORY_DUMP_PROVIDER_H_ |