Index: sql/connection_memory_dump_provider.h |
diff --git a/sql/connection_memory_dump_provider.h b/sql/connection_memory_dump_provider.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..576434d9ec2be359954b6e150e0aad451127b1d7 |
--- /dev/null |
+++ b/sql/connection_memory_dump_provider.h |
@@ -0,0 +1,46 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef SQL_SQL_CONNECTION_MEMORY_DUMP_PROVIDER_H |
Primiano Tucci (use gerrit)
2016/01/11 19:27:42
nit s/SQL_SQL_/SQL_/
ssid
2016/01/12 12:23:07
Done.
|
+#define SQL_SQL_CONNECTION_MEMORY_DUMP_PROVIDER_H |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "base/synchronization/lock.h" |
+#include "base/trace_event/memory_dump_provider.h" |
+ |
+struct sqlite3; |
+ |
+namespace sql { |
+ |
+class ConnectionMemoryDumpProvider |
+ : public base::trace_event::MemoryDumpProvider { |
+ public: |
+ ConnectionMemoryDumpProvider(sqlite3* db, const std::string& name); |
+ ~ConnectionMemoryDumpProvider() override; |
+ |
+ void reset_database() { |
Primiano Tucci (use gerrit)
2016/01/11 19:27:42
non-trivial methods should be CamelCased and be de
ssid
2016/01/12 12:23:08
Done.
|
+ base::AutoLock l(lock_); |
Primiano Tucci (use gerrit)
2016/01/11 19:27:42
nit: s/l/lock/ typically I see this in the codebas
ssid
2016/01/12 12:23:07
Done.
|
+ db_ = nullptr; |
+ } |
+ |
+ // base::trace_event::MemoryDumpProvider implementation. |
+ bool OnMemoryDump( |
+ const base::trace_event::MemoryDumpArgs& args, |
+ base::trace_event::ProcessMemoryDump* process_memory_dump) override; |
+ |
+ private: |
+ // Not owned by ConnectionMemoryDumpProvider. Weak reference to the database |
Primiano Tucci (use gerrit)
2016/01/11 19:27:42
remove the "weak reference to ..." it's confusing
ssid
2016/01/12 12:23:07
Done.
|
+ // in connection. |
+ sqlite3* db_; |
+ base::Lock lock_; |
+ std::string name_; |
Primiano Tucci (use gerrit)
2016/01/11 19:27:42
maybe s/name_/connection_name_/ ?
ssid
2016/01/12 12:23:07
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(ConnectionMemoryDumpProvider); |
+}; |
+ |
+} // namespace sql |
+ |
+#endif // SQL_SQL_CONNECTION_MEMORY_DUMP_PROVIDER_H |