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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_callbacks.cc

Issue 10854081: IndexedDB: Simplify cursor data callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 4 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) 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 #include "content/browser/in_process_webkit/indexed_db_callbacks.h" 5 #include "content/browser/in_process_webkit/indexed_db_callbacks.h"
6 6
7 #include "content/common/indexed_db/indexed_db_messages.h" 7 #include "content/common/indexed_db/indexed_db_messages.h"
8 #include "webkit/quota/quota_manager.h" 8 #include "webkit/quota/quota_manager.h"
9 9
10 using content::IndexedDBKey; 10 using content::IndexedDBKey;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 origin_url_); 46 origin_url_);
47 int32 database_id = dispatcher_host()->Add(database, thread_id(), 47 int32 database_id = dispatcher_host()->Add(database, thread_id(),
48 origin_url_); 48 origin_url_);
49 database_id_ = database_id; 49 database_id_ = database_id;
50 dispatcher_host()->Send( 50 dispatcher_host()->Send(
51 new IndexedDBMsg_CallbacksUpgradeNeeded( 51 new IndexedDBMsg_CallbacksUpgradeNeeded(
52 thread_id(), response_id(), transaction_id, database_id, 52 thread_id(), response_id(), transaction_id, database_id,
53 old_version)); 53 old_version));
54 } 54 }
55 55
56 // TODO(jsbell): Remove this after WK92278 rolls.
57 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
58 WebKit::WebIDBCursor* idb_object) {
59 int32 object_id = dispatcher_host()->Add(idb_object);
60 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
61 params.thread_id = thread_id();
62 params.response_id = response_id();
63 params.cursor_id = object_id;
64 params.key = IndexedDBKey(idb_object->key());
65 params.primary_key = IndexedDBKey(idb_object->primaryKey());
66 params.serialized_value = SerializedScriptValue(idb_object->value());
67 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
68 }
69
70 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( 56 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
71 WebKit::WebIDBCursor* idb_object, 57 WebKit::WebIDBCursor* idb_object,
72 const WebKit::WebIDBKey& key, 58 const WebKit::WebIDBKey& key,
73 const WebKit::WebIDBKey& primaryKey, 59 const WebKit::WebIDBKey& primaryKey,
74 const WebKit::WebSerializedScriptValue& value) { 60 const WebKit::WebSerializedScriptValue& value) {
75 int32 object_id = dispatcher_host()->Add(idb_object); 61 int32 object_id = dispatcher_host()->Add(idb_object);
76 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params; 62 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
77 params.thread_id = thread_id(); 63 params.thread_id = thread_id();
78 params.response_id = response_id(); 64 params.response_id = response_id();
79 params.cursor_id = object_id; 65 params.cursor_id = object_id;
80 params.key = IndexedDBKey(key); 66 params.key = IndexedDBKey(key);
81 params.primary_key = IndexedDBKey(primaryKey); 67 params.primary_key = IndexedDBKey(primaryKey);
82 params.serialized_value = SerializedScriptValue(value); 68 params.serialized_value = SerializedScriptValue(value);
83 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params)); 69 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
84 } 70 }
85 71
86 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( 72 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
87 const WebKit::WebSerializedScriptValue& value) { 73 const WebKit::WebSerializedScriptValue& value) {
88 dispatcher_host()->Send( 74 dispatcher_host()->Send(
89 new IndexedDBMsg_CallbacksSuccessSerializedScriptValue( 75 new IndexedDBMsg_CallbacksSuccessSerializedScriptValue(
90 thread_id(), response_id(), SerializedScriptValue(value))); 76 thread_id(), response_id(), SerializedScriptValue(value)));
91 } 77 }
92 78
93 // TODO(jsbell): Remove this after WK92278 rolls.
94 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithContinuation() {
95 DCHECK(cursor_id_ != -1);
96 WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId(
97 cursor_id_);
98
99 DCHECK(idb_cursor);
100 if (!idb_cursor)
101 return;
102 IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
103 params.thread_id = thread_id();
104 params.response_id = response_id();
105 params.cursor_id = cursor_id_;
106 params.key = IndexedDBKey(idb_cursor->key());
107 params.primary_key = IndexedDBKey(idb_cursor->primaryKey());
108 params.serialized_value = SerializedScriptValue(idb_cursor->value());
109 dispatcher_host()->Send(
110 new IndexedDBMsg_CallbacksSuccessCursorContinue(params));
111 }
112
113 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( 79 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
114 const WebKit::WebIDBKey& key, 80 const WebKit::WebIDBKey& key,
115 const WebKit::WebIDBKey& primaryKey, 81 const WebKit::WebIDBKey& primaryKey,
116 const WebKit::WebSerializedScriptValue& value) { 82 const WebKit::WebSerializedScriptValue& value) {
117 DCHECK(cursor_id_ != -1); 83 DCHECK(cursor_id_ != -1);
118 WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId( 84 WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId(
119 cursor_id_); 85 cursor_id_);
120 86
121 DCHECK(idb_cursor); 87 DCHECK(idb_cursor);
122 if (!idb_cursor) 88 if (!idb_cursor)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 153
188 void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess( 154 void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
189 const WebKit::WebSerializedScriptValue& value, 155 const WebKit::WebSerializedScriptValue& value,
190 const WebKit::WebIDBKey& primaryKey, 156 const WebKit::WebIDBKey& primaryKey,
191 const WebKit::WebIDBKeyPath& keyPath) { 157 const WebKit::WebIDBKeyPath& keyPath) {
192 dispatcher_host()->Send( 158 dispatcher_host()->Send(
193 new IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKey( 159 new IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKey(
194 thread_id(), response_id(), SerializedScriptValue(value), 160 thread_id(), response_id(), SerializedScriptValue(value),
195 IndexedDBKey(primaryKey), IndexedDBKeyPath(keyPath))); 161 IndexedDBKey(primaryKey), IndexedDBKeyPath(keyPath)));
196 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698