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

Side by Side Diff: content/browser/indexed_db/indexed_db_database.h

Issue 320833002: [IndexedDB] Use consistent enums on both sides of IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated review comments. Created 6 years, 6 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_INDEXED_DB_INDEXED_DB_DATABASE_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "content/browser/indexed_db/indexed_db.h" 16 #include "content/browser/indexed_db/indexed_db.h"
17 #include "content/browser/indexed_db/indexed_db_backing_store.h" 17 #include "content/browser/indexed_db/indexed_db_backing_store.h"
18 #include "content/browser/indexed_db/indexed_db_callbacks.h" 18 #include "content/browser/indexed_db/indexed_db_callbacks.h"
19 #include "content/browser/indexed_db/indexed_db_metadata.h" 19 #include "content/browser/indexed_db/indexed_db_metadata.h"
20 #include "content/browser/indexed_db/indexed_db_pending_connection.h" 20 #include "content/browser/indexed_db/indexed_db_pending_connection.h"
21 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h" 21 #include "content/browser/indexed_db/indexed_db_transaction_coordinator.h"
22 #include "content/browser/indexed_db/list_set.h" 22 #include "content/browser/indexed_db/list_set.h"
23 #include "third_party/WebKit/public/platform/WebIDBTypes.h"
23 #include "url/gurl.h" 24 #include "url/gurl.h"
24 25
25 namespace content { 26 namespace content {
26 27
27 class IndexedDBBlobInfo; 28 class IndexedDBBlobInfo;
28 class IndexedDBConnection; 29 class IndexedDBConnection;
29 class IndexedDBDatabaseCallbacks; 30 class IndexedDBDatabaseCallbacks;
30 class IndexedDBFactory; 31 class IndexedDBFactory;
31 class IndexedDBKey; 32 class IndexedDBKey;
32 class IndexedDBKeyPath; 33 class IndexedDBKeyPath;
33 class IndexedDBKeyRange; 34 class IndexedDBKeyRange;
34 class IndexedDBTransaction; 35 class IndexedDBTransaction;
35 struct IndexedDBValue; 36 struct IndexedDBValue;
36 37
37 class CONTENT_EXPORT IndexedDBDatabase 38 class CONTENT_EXPORT IndexedDBDatabase
38 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) { 39 : NON_EXPORTED_BASE(public base::RefCounted<IndexedDBDatabase>) {
39 public: 40 public:
40 enum TaskType {
41 NORMAL_TASK = 0,
42 PREEMPTIVE_TASK
43 };
44
45 enum PutMode {
46 ADD_OR_UPDATE,
47 ADD_ONLY,
48 CURSOR_UPDATE
49 };
50
51 // An index and corresponding set of keys 41 // An index and corresponding set of keys
52 typedef std::pair<int64, std::vector<IndexedDBKey> > IndexKeys; 42 typedef std::pair<int64, std::vector<IndexedDBKey> > IndexKeys;
53 43
54 // Identifier is pair of (origin url, database name). 44 // Identifier is pair of (origin url, database name).
55 typedef std::pair<GURL, base::string16> Identifier; 45 typedef std::pair<GURL, base::string16> Identifier;
56 46
57 static const int64 kInvalidId = 0; 47 static const int64 kInvalidId = 0;
58 static const int64 kMinimumIndexId = 30; 48 static const int64 kMinimumIndexId = 30;
59 49
60 static scoped_refptr<IndexedDBDatabase> Create( 50 static scoped_refptr<IndexedDBDatabase> Create(
(...skipping 23 matching lines...) Expand all
84 74
85 void CreateObjectStore(int64 transaction_id, 75 void CreateObjectStore(int64 transaction_id,
86 int64 object_store_id, 76 int64 object_store_id,
87 const base::string16& name, 77 const base::string16& name,
88 const IndexedDBKeyPath& key_path, 78 const IndexedDBKeyPath& key_path,
89 bool auto_increment); 79 bool auto_increment);
90 void DeleteObjectStore(int64 transaction_id, int64 object_store_id); 80 void DeleteObjectStore(int64 transaction_id, int64 object_store_id);
91 void CreateTransaction(int64 transaction_id, 81 void CreateTransaction(int64 transaction_id,
92 IndexedDBConnection* connection, 82 IndexedDBConnection* connection,
93 const std::vector<int64>& object_store_ids, 83 const std::vector<int64>& object_store_ids,
94 uint16 mode); 84 uint16 mode);
jsbell 2014/06/11 16:42:01 Can you update this to use the blink::WebIDBTransa
Pritam Nikam 2014/06/12 11:19:20 Done.
95 void Close(IndexedDBConnection* connection, bool forced); 85 void Close(IndexedDBConnection* connection, bool forced);
96 void ForceClose(); 86 void ForceClose();
97 87
98 void Commit(int64 transaction_id); 88 void Commit(int64 transaction_id);
99 void Abort(int64 transaction_id); 89 void Abort(int64 transaction_id);
100 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error); 90 void Abort(int64 transaction_id, const IndexedDBDatabaseError& error);
101 91
102 void CreateIndex(int64 transaction_id, 92 void CreateIndex(int64 transaction_id,
103 int64 object_store_id, 93 int64 object_store_id,
104 int64 index_id, 94 int64 index_id,
(...skipping 20 matching lines...) Expand all
125 int64 object_store_id, 115 int64 object_store_id,
126 int64 index_id, 116 int64 index_id,
127 scoped_ptr<IndexedDBKeyRange> key_range, 117 scoped_ptr<IndexedDBKeyRange> key_range,
128 bool key_only, 118 bool key_only,
129 scoped_refptr<IndexedDBCallbacks> callbacks); 119 scoped_refptr<IndexedDBCallbacks> callbacks);
130 void Put(int64 transaction_id, 120 void Put(int64 transaction_id,
131 int64 object_store_id, 121 int64 object_store_id,
132 IndexedDBValue* value, 122 IndexedDBValue* value,
133 ScopedVector<webkit_blob::BlobDataHandle>* handles, 123 ScopedVector<webkit_blob::BlobDataHandle>* handles,
134 scoped_ptr<IndexedDBKey> key, 124 scoped_ptr<IndexedDBKey> key,
135 PutMode mode, 125 blink::WebIDBPutMode mode,
136 scoped_refptr<IndexedDBCallbacks> callbacks, 126 scoped_refptr<IndexedDBCallbacks> callbacks,
137 const std::vector<IndexKeys>& index_keys); 127 const std::vector<IndexKeys>& index_keys);
138 void SetIndexKeys(int64 transaction_id, 128 void SetIndexKeys(int64 transaction_id,
139 int64 object_store_id, 129 int64 object_store_id,
140 scoped_ptr<IndexedDBKey> primary_key, 130 scoped_ptr<IndexedDBKey> primary_key,
141 const std::vector<IndexKeys>& index_keys); 131 const std::vector<IndexKeys>& index_keys);
142 void SetIndexesReady(int64 transaction_id, 132 void SetIndexesReady(int64 transaction_id,
143 int64 object_store_id, 133 int64 object_store_id,
144 const std::vector<int64>& index_ids); 134 const std::vector<int64>& index_ids);
145 void OpenCursor(int64 transaction_id, 135 void OpenCursor(int64 transaction_id,
146 int64 object_store_id, 136 int64 object_store_id,
147 int64 index_id, 137 int64 index_id,
148 scoped_ptr<IndexedDBKeyRange> key_range, 138 scoped_ptr<IndexedDBKeyRange> key_range,
149 indexed_db::CursorDirection, 139 blink::WebIDBCursorDirection,
150 bool key_only, 140 bool key_only,
151 TaskType task_type, 141 blink::WebIDBTaskType task_type,
152 scoped_refptr<IndexedDBCallbacks> callbacks); 142 scoped_refptr<IndexedDBCallbacks> callbacks);
153 void Count(int64 transaction_id, 143 void Count(int64 transaction_id,
154 int64 object_store_id, 144 int64 object_store_id,
155 int64 index_id, 145 int64 index_id,
156 scoped_ptr<IndexedDBKeyRange> key_range, 146 scoped_ptr<IndexedDBKeyRange> key_range,
157 scoped_refptr<IndexedDBCallbacks> callbacks); 147 scoped_refptr<IndexedDBCallbacks> callbacks);
158 void DeleteRange(int64 transaction_id, 148 void DeleteRange(int64 transaction_id,
159 int64 object_store_id, 149 int64 object_store_id,
160 scoped_ptr<IndexedDBKeyRange> key_range, 150 scoped_ptr<IndexedDBKeyRange> key_range,
161 scoped_refptr<IndexedDBCallbacks> callbacks); 151 scoped_refptr<IndexedDBCallbacks> callbacks);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 280
291 typedef list_set<IndexedDBConnection*> ConnectionSet; 281 typedef list_set<IndexedDBConnection*> ConnectionSet;
292 ConnectionSet connections_; 282 ConnectionSet connections_;
293 283
294 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase); 284 DISALLOW_COPY_AND_ASSIGN(IndexedDBDatabase);
295 }; 285 };
296 286
297 } // namespace content 287 } // namespace content
298 288
299 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_ 289 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698