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

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

Issue 18145004: IndexedDB: Eliminate WebIDBCursor wrapper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CALLBACKS_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h" 10 #include "content/browser/indexed_db/indexed_db_dispatcher_host.h"
11 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
12 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h" 12 #include "third_party/WebKit/public/platform/WebIDBCallbacks.h"
13 #include "third_party/WebKit/public/platform/WebIDBDatabase.h" 13 #include "third_party/WebKit/public/platform/WebIDBDatabase.h"
14 14
15 namespace content { 15 namespace content {
16 class IndexedDBCursor;
16 class IndexedDBDatabaseError; 17 class IndexedDBDatabaseError;
17 class WebIDBCursorImpl;
18 class WebIDBDatabaseImpl; 18 class WebIDBDatabaseImpl;
19 struct IndexedDBDatabaseMetadata; 19 struct IndexedDBDatabaseMetadata;
20 20
21 class IndexedDBCallbacksBase { 21 class IndexedDBCallbacksBase {
22 public: 22 public:
23 virtual ~IndexedDBCallbacksBase(); 23 virtual ~IndexedDBCallbacksBase();
24 24
25 virtual void onError(const IndexedDBDatabaseError& error); 25 virtual void onError(const IndexedDBDatabaseError& error);
26 virtual void onBlocked(long long old_version); 26 virtual void onBlocked(long long old_version);
27 27
28 // implemented by subclasses, but need to be called later 28 // implemented by subclasses, but need to be called later
29 virtual void onSuccess(const std::vector<string16>& value); 29 virtual void onSuccess(const std::vector<string16>& value);
30 virtual void onSuccess(WebIDBDatabaseImpl* idb_object, 30 virtual void onSuccess(WebIDBDatabaseImpl* idb_object,
31 const IndexedDBDatabaseMetadata& metadata); 31 const IndexedDBDatabaseMetadata& metadata);
32 virtual void onUpgradeNeeded(long long old_version, 32 virtual void onUpgradeNeeded(long long old_version,
33 WebIDBDatabaseImpl* database, 33 WebIDBDatabaseImpl* database,
34 const IndexedDBDatabaseMetadata&, 34 const IndexedDBDatabaseMetadata&,
35 WebKit::WebIDBCallbacks::DataLoss data_loss); 35 WebKit::WebIDBCallbacks::DataLoss data_loss);
36 virtual void onSuccess(WebIDBCursorImpl* idb_object, 36 virtual void onSuccess(IndexedDBCursor* idb_object,
37 const IndexedDBKey& key, 37 const IndexedDBKey& key,
38 const IndexedDBKey& primaryKey, 38 const IndexedDBKey& primaryKey,
39 std::vector<char>* value); 39 std::vector<char>* value);
40 virtual void onSuccess(const IndexedDBKey& key, 40 virtual void onSuccess(const IndexedDBKey& key,
41 const IndexedDBKey& primaryKey, 41 const IndexedDBKey& primaryKey,
42 std::vector<char>* value); 42 std::vector<char>* value);
43 virtual void onSuccess(std::vector<char>* value); 43 virtual void onSuccess(std::vector<char>* value);
44 virtual void onSuccessWithPrefetch( 44 virtual void onSuccessWithPrefetch(
45 const std::vector<IndexedDBKey>& keys, 45 const std::vector<IndexedDBKey>& keys,
46 const std::vector<IndexedDBKey>& primaryKeys, 46 const std::vector<IndexedDBKey>& primaryKeys,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 OVERRIDE; 95 OVERRIDE;
96 96
97 private: 97 private:
98 int64 host_transaction_id_; 98 int64 host_transaction_id_;
99 GURL origin_url_; 99 GURL origin_url_;
100 int32 ipc_database_id_; 100 int32 ipc_database_id_;
101 int32 ipc_database_callbacks_id_; 101 int32 ipc_database_callbacks_id_;
102 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacksDatabase); 102 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacksDatabase);
103 }; 103 };
104 104
105 // WebIDBCursorImpl uses: 105 // IndexedDBCursor uses:
106 // * onSuccess(WebIDBCursorImpl*, WebIDBKey, WebIDBKey, WebData) 106 // * onSuccess(IndexedDBCursor*, WebIDBKey, WebIDBKey, WebData)
107 // when an openCursor()/openKeyCursor() call has succeeded, 107 // when an openCursor()/openKeyCursor() call has succeeded,
108 // * onSuccess(WebIDBKey, WebIDBKey, WebData) 108 // * onSuccess(WebIDBKey, WebIDBKey, WebData)
109 // when an advance()/continue() call has succeeded, or 109 // when an advance()/continue() call has succeeded, or
110 // * onSuccess() 110 // * onSuccess()
111 // to indicate it does not contain any data, i.e., there is no key within 111 // to indicate it does not contain any data, i.e., there is no key within
112 // the key range, or it has reached the end. 112 // the key range, or it has reached the end.
113 template <> 113 template <>
114 class IndexedDBCallbacks<WebIDBCursorImpl> : public IndexedDBCallbacksBase { 114 class IndexedDBCallbacks<IndexedDBCursor> : public IndexedDBCallbacksBase {
115 public: 115 public:
116 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host, 116 IndexedDBCallbacks(IndexedDBDispatcherHost* dispatcher_host,
117 int32 ipc_thread_id, 117 int32 ipc_thread_id,
118 int32 ipc_callbacks_id, 118 int32 ipc_callbacks_id,
119 int32 ipc_cursor_id) 119 int32 ipc_cursor_id)
120 : IndexedDBCallbacksBase(dispatcher_host, 120 : IndexedDBCallbacksBase(dispatcher_host,
121 ipc_thread_id, 121 ipc_thread_id,
122 ipc_callbacks_id), 122 ipc_callbacks_id),
123 ipc_cursor_id_(ipc_cursor_id) {} 123 ipc_cursor_id_(ipc_cursor_id) {}
124 124
125 virtual void onSuccess(WebIDBCursorImpl* idb_object, 125 virtual void onSuccess(IndexedDBCursor* idb_object,
126 const IndexedDBKey& key, 126 const IndexedDBKey& key,
127 const IndexedDBKey& primaryKey, 127 const IndexedDBKey& primaryKey,
128 std::vector<char>* value); 128 std::vector<char>* value);
129 virtual void onSuccess(const IndexedDBKey& key, 129 virtual void onSuccess(const IndexedDBKey& key,
130 const IndexedDBKey& primaryKey, 130 const IndexedDBKey& primaryKey,
131 std::vector<char>* value); 131 std::vector<char>* value);
132 virtual void onSuccess(std::vector<char>* value); 132 virtual void onSuccess(std::vector<char>* value);
133 virtual void onSuccessWithPrefetch( 133 virtual void onSuccessWithPrefetch(
134 const std::vector<IndexedDBKey>& keys, 134 const std::vector<IndexedDBKey>& keys,
135 const std::vector<IndexedDBKey>& primaryKeys, 135 const std::vector<IndexedDBKey>& primaryKeys,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 virtual void onSuccess(); 200 virtual void onSuccess();
201 virtual void onSuccess(const IndexedDBKey& value); 201 virtual void onSuccess(const IndexedDBKey& value);
202 202
203 private: 203 private:
204 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks); 204 DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedDBCallbacks);
205 }; 205 };
206 206
207 } // namespace content 207 } // namespace content
208 208
209 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_ 209 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CALLBACKS_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698