Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(321)

Side by Side Diff: content/browser/dom_storage/session_storage_database.h

Issue 1906243002: [tracing] Add a memory dump provider for DOM storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unittests. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_
6 #define CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ 6 #define CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 13
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "content/common/content_export.h" 18 #include "content/common/content_export.h"
19 #include "content/common/dom_storage/dom_storage_types.h" 19 #include "content/common/dom_storage/dom_storage_types.h"
20 #include "third_party/leveldatabase/src/include/leveldb/status.h" 20 #include "third_party/leveldatabase/src/include/leveldb/status.h"
21 21
22 class GURL; 22 class GURL;
23 23
24 namespace leveldb { 24 namespace leveldb {
25 class DB; 25 class DB;
26 struct ReadOptions; 26 struct ReadOptions;
27 class WriteBatch; 27 class WriteBatch;
28 } // namespace leveldb 28 } // namespace leveldb
29 29
30 namespace base {
31 namespace trace_event {
32 class ProcessMemoryDump;
33 }
34 }
35
30 namespace content { 36 namespace content {
31 37
32 // SessionStorageDatabase holds the data from multiple namespaces and multiple 38 // SessionStorageDatabase holds the data from multiple namespaces and multiple
33 // origins. All DOMStorageAreas for session storage share the same 39 // origins. All DOMStorageAreas for session storage share the same
34 // SessionStorageDatabase. 40 // SessionStorageDatabase.
35 41
36 // Only one thread is allowed to call the public functions other than 42 // Only one thread is allowed to call the public functions other than
37 // ReadAreaValues and ReadNamespacesAndOrigins. Other threads are allowed to 43 // ReadAreaValues and ReadNamespacesAndOrigins. Other threads are allowed to
38 // call ReadAreaValues and ReadNamespacesAndOrigins. 44 // call ReadAreaValues and ReadNamespacesAndOrigins.
39 class CONTENT_EXPORT SessionStorageDatabase : 45 class CONTENT_EXPORT SessionStorageDatabase :
(...skipping 28 matching lines...) Expand all
68 // Deletes the data for |namespace_id| and |origin|. 74 // Deletes the data for |namespace_id| and |origin|.
69 bool DeleteArea(const std::string& namespace_id, const GURL& origin); 75 bool DeleteArea(const std::string& namespace_id, const GURL& origin);
70 76
71 // Deletes the data for |namespace_id|. 77 // Deletes the data for |namespace_id|.
72 bool DeleteNamespace(const std::string& namespace_id); 78 bool DeleteNamespace(const std::string& namespace_id);
73 79
74 // Reads the namespace IDs and origins present in the database. 80 // Reads the namespace IDs and origins present in the database.
75 bool ReadNamespacesAndOrigins( 81 bool ReadNamespacesAndOrigins(
76 std::map<std::string, std::vector<GURL> >* namespaces_and_origins); 82 std::map<std::string, std::vector<GURL> >* namespaces_and_origins);
77 83
84 // Adds memory statistics to |pmd| for chrome://tracing.
85 bool OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd);
michaeln 2016/05/02 22:47:12 maybe remove the return value since it's always |t
ssid 2016/05/04 06:06:14 Done.
86
78 private: 87 private:
79 friend class base::RefCountedThreadSafe<SessionStorageDatabase>; 88 friend class base::RefCountedThreadSafe<SessionStorageDatabase>;
80 class DBOperation; 89 class DBOperation;
81 friend class SessionStorageDatabase::DBOperation; 90 friend class SessionStorageDatabase::DBOperation;
82 friend class SessionStorageDatabaseTest; 91 friend class SessionStorageDatabaseTest;
83 92
84 ~SessionStorageDatabase(); 93 ~SessionStorageDatabase();
85 94
86 // Opens the database at file_path_ if it exists already and creates it if 95 // Opens the database at file_path_ if it exists already and creates it if
87 // |create_if_needed| is true. Returns true if the database was opened, false 96 // |create_if_needed| is true. Returns true if the database was opened, false
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // The number of database operations in progress. We need this so that we can 217 // The number of database operations in progress. We need this so that we can
209 // delete an inconsistent database at the right moment. 218 // delete an inconsistent database at the right moment.
210 int operation_count_; 219 int operation_count_;
211 220
212 DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabase); 221 DISALLOW_COPY_AND_ASSIGN(SessionStorageDatabase);
213 }; 222 };
214 223
215 } // namespace content 224 } // namespace content
216 225
217 #endif // CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_ 226 #endif // CONTENT_BROWSER_DOM_STORAGE_SESSION_STORAGE_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698