[M85 Migration] Add an evas gl option for rotation
[platform/framework/web/chromium-efl.git] / sql / database_memory_dump_provider.h
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 SQL_DATABASE_MEMORY_DUMP_PROVIDER_H_
6 #define SQL_DATABASE_MEMORY_DUMP_PROVIDER_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/synchronization/lock.h"
12 #include "base/trace_event/memory_dump_provider.h"
13
14 struct sqlite3;
15
16 namespace base {
17 namespace trace_event {
18 class ProcessMemoryDump;
19 }
20 }  // namespace base
21
22 namespace sql {
23
24 class DatabaseMemoryDumpProvider
25     : public base::trace_event::MemoryDumpProvider {
26  public:
27   DatabaseMemoryDumpProvider(sqlite3* db, const std::string& name);
28   ~DatabaseMemoryDumpProvider() override;
29
30   void ResetDatabase();
31
32   // base::trace_event::MemoryDumpProvider implementation.
33   bool OnMemoryDump(
34       const base::trace_event::MemoryDumpArgs& args,
35       base::trace_event::ProcessMemoryDump* process_memory_dump) override;
36
37   // Reports memory usage into provided memory dump with the given |dump_name|.
38   // Called by sql::Database when its owner asks it to report memory usage.
39   bool ReportMemoryUsage(base::trace_event::ProcessMemoryDump* pmd,
40                          const std::string& dump_name);
41
42  private:
43   bool GetDbMemoryUsage(int* cache_size, int* schema_size, int* statement_size);
44
45   std::string FormatDumpName() const;
46
47   sqlite3* db_;  // not owned.
48   base::Lock lock_;
49   std::string connection_name_;
50
51   DISALLOW_COPY_AND_ASSIGN(DatabaseMemoryDumpProvider);
52 };
53
54 }  // namespace sql
55
56 #endif  // SQL_DATABASE_MEMORY_DUMP_PROVIDER_H_