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

Side by Side Diff: chrome/renderer/indexed_db_dispatcher.cc

Issue 3165026: [IndexedDB] Add transaction coordinator. (Closed)
Patch Set: Fix Jeremy's comments Created 10 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/renderer/indexed_db_dispatcher.h" 5 #include "chrome/renderer/indexed_db_dispatcher.h"
6 6
7 #include "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/common/serialized_script_value.h" 8 #include "chrome/common/serialized_script_value.h"
9 #include "chrome/renderer/render_thread.h" 9 #include "chrome/renderer/render_thread.h"
10 #include "chrome/renderer/render_view.h" 10 #include "chrome/renderer/render_view.h"
(...skipping 26 matching lines...) Expand all
37 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIndexedDBKey, 37 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIndexedDBKey,
38 OnSuccessIndexedDBKey) 38 OnSuccessIndexedDBKey)
39 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBObjectStore, 39 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBObjectStore,
40 OnSuccessIDBObjectStore) 40 OnSuccessIDBObjectStore)
41 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBIndex, 41 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBIndex,
42 OnSuccessIDBIndex) 42 OnSuccessIDBIndex)
43 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessSerializedScriptValue, 43 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessSerializedScriptValue,
44 OnSuccessSerializedScriptValue) 44 OnSuccessSerializedScriptValue)
45 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksError, 45 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksError,
46 OnError) 46 OnError)
47 IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksAbort,
48 OnAbort)
47 IPC_MESSAGE_UNHANDLED(handled = false) 49 IPC_MESSAGE_UNHANDLED(handled = false)
48 IPC_END_MESSAGE_MAP() 50 IPC_END_MESSAGE_MAP()
49 return handled; 51 return handled;
50 } 52 }
51 53
52 void IndexedDBDispatcher::RequestIDBFactoryOpen( 54 void IndexedDBDispatcher::RequestIDBFactoryOpen(
53 const string16& name, const string16& description, 55 const string16& name, const string16& description,
54 WebIDBCallbacks* callbacks_ptr, const string16& origin, 56 WebIDBCallbacks* callbacks_ptr, const string16& origin,
55 WebFrame* web_frame) { 57 WebFrame* web_frame) {
56 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 58 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const string16& name, WebIDBCallbacks* callbacks_ptr, 150 const string16& name, WebIDBCallbacks* callbacks_ptr,
149 int32 idb_object_store_id) { 151 int32 idb_object_store_id) {
150 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 152 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
151 153
152 RenderThread::current()->Send( 154 RenderThread::current()->Send(
153 new ViewHostMsg_IDBObjectStoreRemoveIndex( 155 new ViewHostMsg_IDBObjectStoreRemoveIndex(
154 idb_object_store_id, pending_callbacks_.Add(callbacks.release()), 156 idb_object_store_id, pending_callbacks_.Add(callbacks.release()),
155 name)); 157 name));
156 } 158 }
157 159
160 void IndexedDBDispatcher::RequestIDBTransactionSetCallbacks(
161 WebKit::WebIDBTransactionCallbacks* callbacks) {
162 pending_transaction_callbacks_.AddWithID(callbacks, callbacks->id());
163 }
164
165
158 void IndexedDBDispatcher::OnSuccessNull(int32 response_id) { 166 void IndexedDBDispatcher::OnSuccessNull(int32 response_id) {
159 WebKit::WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); 167 WebKit::WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
160 callbacks->onSuccess(); 168 callbacks->onSuccess();
161 pending_callbacks_.Remove(response_id); 169 pending_callbacks_.Remove(response_id);
162 } 170 }
163 171
164 void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 response_id, 172 void IndexedDBDispatcher::OnSuccessIDBDatabase(int32 response_id,
165 int32 object_id) { 173 int32 object_id) {
166 WebKit::WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); 174 WebKit::WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
167 callbacks->onSuccess(new RendererWebIDBDatabaseImpl(object_id)); 175 callbacks->onSuccess(new RendererWebIDBDatabaseImpl(object_id));
(...skipping 27 matching lines...) Expand all
195 callbacks->onSuccess(value); 203 callbacks->onSuccess(value);
196 pending_callbacks_.Remove(response_id); 204 pending_callbacks_.Remove(response_id);
197 } 205 }
198 206
199 void IndexedDBDispatcher::OnError(int32 response_id, int code, 207 void IndexedDBDispatcher::OnError(int32 response_id, int code,
200 const string16& message) { 208 const string16& message) {
201 WebKit::WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); 209 WebKit::WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id);
202 callbacks->onError(WebIDBDatabaseError(code, message)); 210 callbacks->onError(WebIDBDatabaseError(code, message));
203 pending_callbacks_.Remove(response_id); 211 pending_callbacks_.Remove(response_id);
204 } 212 }
213
214 void IndexedDBDispatcher::OnAbort(int transaction_id) {
215 WebKit::WebIDBTransactionCallbacks* callbacks =
216 pending_transaction_callbacks_.Lookup(transaction_id);
217 DCHECK(callbacks);
218 callbacks->onAbort();
219 pending_transaction_callbacks_.Remove(transaction_id);
220 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698