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

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

Issue 10830028: IndexedDB: Send cursor data along with success messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment tweaks and rebase 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 | Annotate | Revision Log
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.
56 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( 57 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
57 WebKit::WebIDBCursor* idb_object) { 58 WebKit::WebIDBCursor* idb_object) {
58 int32 object_id = dispatcher_host()->Add(idb_object); 59 int32 object_id = dispatcher_host()->Add(idb_object);
59 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params; 60 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
60 params.thread_id = thread_id(); 61 params.thread_id = thread_id();
61 params.response_id = response_id(); 62 params.response_id = response_id();
62 params.cursor_id = object_id; 63 params.cursor_id = object_id;
63 params.key = IndexedDBKey(idb_object->key()); 64 params.key = IndexedDBKey(idb_object->key());
64 params.primary_key = IndexedDBKey(idb_object->primaryKey()); 65 params.primary_key = IndexedDBKey(idb_object->primaryKey());
65 params.serialized_value = SerializedScriptValue(idb_object->value()); 66 params.serialized_value = SerializedScriptValue(idb_object->value());
66 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params)); 67 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
67 } 68 }
68 69
69 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess( 70 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
71 WebKit::WebIDBCursor* idb_object,
72 const WebKit::WebIDBKey& key,
73 const WebKit::WebIDBKey& primaryKey,
74 const WebKit::WebSerializedScriptValue& value) {
75 int32 object_id = dispatcher_host()->Add(idb_object);
76 IndexedDBMsg_CallbacksSuccessIDBCursor_Params params;
77 params.thread_id = thread_id();
78 params.response_id = response_id();
79 params.cursor_id = object_id;
80 params.key = IndexedDBKey(key);
81 params.primary_key = IndexedDBKey(primaryKey);
82 params.serialized_value = SerializedScriptValue(value);
83 dispatcher_host()->Send(new IndexedDBMsg_CallbacksSuccessIDBCursor(params));
84 }
85
86 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
70 const WebKit::WebSerializedScriptValue& value) { 87 const WebKit::WebSerializedScriptValue& value) {
71 dispatcher_host()->Send( 88 dispatcher_host()->Send(
72 new IndexedDBMsg_CallbacksSuccessSerializedScriptValue( 89 new IndexedDBMsg_CallbacksSuccessSerializedScriptValue(
73 thread_id(), response_id(), SerializedScriptValue(value))); 90 thread_id(), response_id(), SerializedScriptValue(value)));
74 } 91 }
75 92
93 // TODO(jsbell): Remove this after WK92278 rolls.
76 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithContinuation() { 94 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithContinuation() {
77 DCHECK(cursor_id_ != -1); 95 DCHECK(cursor_id_ != -1);
78 WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId( 96 WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId(
79 cursor_id_); 97 cursor_id_);
80 98
81 DCHECK(idb_cursor); 99 DCHECK(idb_cursor);
82 if (!idb_cursor) 100 if (!idb_cursor)
83 return; 101 return;
84 IndexedDBMsg_CallbacksSuccessCursorContinue_Params params; 102 IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
85 params.thread_id = thread_id(); 103 params.thread_id = thread_id();
86 params.response_id = response_id(); 104 params.response_id = response_id();
87 params.cursor_id = cursor_id_; 105 params.cursor_id = cursor_id_;
88 params.key = IndexedDBKey(idb_cursor->key()); 106 params.key = IndexedDBKey(idb_cursor->key());
89 params.primary_key = IndexedDBKey(idb_cursor->primaryKey()); 107 params.primary_key = IndexedDBKey(idb_cursor->primaryKey());
90 params.serialized_value = SerializedScriptValue(idb_cursor->value()); 108 params.serialized_value = SerializedScriptValue(idb_cursor->value());
91
92 dispatcher_host()->Send( 109 dispatcher_host()->Send(
93 new IndexedDBMsg_CallbacksSuccessCursorContinue(params)); 110 new IndexedDBMsg_CallbacksSuccessCursorContinue(params));
94 } 111 }
112
113 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccess(
114 const WebKit::WebIDBKey& key,
115 const WebKit::WebIDBKey& primaryKey,
116 const WebKit::WebSerializedScriptValue& value) {
117 DCHECK(cursor_id_ != -1);
118 WebKit::WebIDBCursor* idb_cursor = dispatcher_host()->GetCursorFromId(
119 cursor_id_);
120
121 DCHECK(idb_cursor);
122 if (!idb_cursor)
123 return;
124 IndexedDBMsg_CallbacksSuccessCursorContinue_Params params;
125 params.thread_id = thread_id();
126 params.response_id = response_id();
127 params.cursor_id = cursor_id_;
128 params.key = IndexedDBKey(key);
129 params.primary_key = IndexedDBKey(primaryKey);
130 params.serialized_value = SerializedScriptValue(value);
131 dispatcher_host()->Send(
132 new IndexedDBMsg_CallbacksSuccessCursorContinue(params));
133 }
95 134
96 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithPrefetch( 135 void IndexedDBCallbacks<WebKit::WebIDBCursor>::onSuccessWithPrefetch(
97 const WebKit::WebVector<WebKit::WebIDBKey>& keys, 136 const WebKit::WebVector<WebKit::WebIDBKey>& keys,
98 const WebKit::WebVector<WebKit::WebIDBKey>& primaryKeys, 137 const WebKit::WebVector<WebKit::WebIDBKey>& primaryKeys,
99 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values) { 138 const WebKit::WebVector<WebKit::WebSerializedScriptValue>& values) {
100 DCHECK(cursor_id_ != -1); 139 DCHECK(cursor_id_ != -1);
101 140
102 std::vector<IndexedDBKey> msgKeys; 141 std::vector<IndexedDBKey> msgKeys;
103 std::vector<IndexedDBKey> msgPrimaryKeys; 142 std::vector<IndexedDBKey> msgPrimaryKeys;
104 std::vector<SerializedScriptValue> msgValues; 143 std::vector<SerializedScriptValue> msgValues;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 187
149 void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess( 188 void IndexedDBCallbacks<WebKit::WebSerializedScriptValue>::onSuccess(
150 const WebKit::WebSerializedScriptValue& value, 189 const WebKit::WebSerializedScriptValue& value,
151 const WebKit::WebIDBKey& primaryKey, 190 const WebKit::WebIDBKey& primaryKey,
152 const WebKit::WebIDBKeyPath& keyPath) { 191 const WebKit::WebIDBKeyPath& keyPath) {
153 dispatcher_host()->Send( 192 dispatcher_host()->Send(
154 new IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKey( 193 new IndexedDBMsg_CallbacksSuccessSerializedScriptValueWithKey(
155 thread_id(), response_id(), SerializedScriptValue(value), 194 thread_id(), response_id(), SerializedScriptValue(value),
156 IndexedDBKey(primaryKey), IndexedDBKeyPath(keyPath))); 195 IndexedDBKey(primaryKey), IndexedDBKeyPath(keyPath)));
157 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698