| OLD | NEW |
| 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/indexed_db_key.h" | 7 #include "chrome/common/indexed_db_messages.h" |
| 8 #include "chrome/common/render_messages.h" | |
| 9 #include "chrome/common/render_messages_params.h" | |
| 10 #include "chrome/common/serialized_script_value.h" | |
| 11 #include "chrome/renderer/render_thread.h" | 8 #include "chrome/renderer/render_thread.h" |
| 12 #include "chrome/renderer/render_view.h" | 9 #include "chrome/renderer/render_view.h" |
| 13 #include "chrome/renderer/renderer_webidbcursor_impl.h" | 10 #include "chrome/renderer/renderer_webidbcursor_impl.h" |
| 14 #include "chrome/renderer/renderer_webidbdatabase_impl.h" | 11 #include "chrome/renderer/renderer_webidbdatabase_impl.h" |
| 15 #include "chrome/renderer/renderer_webidbindex_impl.h" | 12 #include "chrome/renderer/renderer_webidbindex_impl.h" |
| 16 #include "chrome/renderer/renderer_webidbobjectstore_impl.h" | 13 #include "chrome/renderer/renderer_webidbobjectstore_impl.h" |
| 17 #include "chrome/renderer/renderer_webidbtransaction_impl.h" | 14 #include "chrome/renderer/renderer_webidbtransaction_impl.h" |
| 18 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" | 15 #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
| 19 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" | 16 #include "third_party/WebKit/WebKit/chromium/public/WebIDBDatabaseError.h" |
| 20 #include "third_party/WebKit/WebKit/chromium/public/WebIDBKeyRange.h" | 17 #include "third_party/WebKit/WebKit/chromium/public/WebIDBKeyRange.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 33 | 30 |
| 34 IndexedDBDispatcher::IndexedDBDispatcher() { | 31 IndexedDBDispatcher::IndexedDBDispatcher() { |
| 35 } | 32 } |
| 36 | 33 |
| 37 IndexedDBDispatcher::~IndexedDBDispatcher() { | 34 IndexedDBDispatcher::~IndexedDBDispatcher() { |
| 38 } | 35 } |
| 39 | 36 |
| 40 bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { | 37 bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 41 bool handled = true; | 38 bool handled = true; |
| 42 IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) | 39 IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) |
| 43 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessNull, | 40 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessNull, OnSuccessNull) |
| 44 OnSuccessNull) | 41 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, |
| 45 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBCursor, | |
| 46 OnSuccessOpenCursor) | 42 OnSuccessOpenCursor) |
| 47 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBDatabase, | 43 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, |
| 48 OnSuccessIDBDatabase) | 44 OnSuccessIDBDatabase) |
| 49 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBIndex, | 45 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBIndex, |
| 50 OnSuccessIDBIndex) | 46 OnSuccessIDBIndex) |
| 51 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIndexedDBKey, | 47 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, |
| 52 OnSuccessIndexedDBKey) | 48 OnSuccessIndexedDBKey) |
| 53 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBObjectStore, | 49 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBObjectStore, |
| 54 OnSuccessIDBObjectStore) | 50 OnSuccessIDBObjectStore) |
| 55 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessIDBTransaction, | 51 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, |
| 56 OnSuccessIDBTransaction) | 52 OnSuccessIDBTransaction) |
| 57 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksSuccessSerializedScriptValue, | 53 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, |
| 58 OnSuccessSerializedScriptValue) | 54 OnSuccessSerializedScriptValue) |
| 59 IPC_MESSAGE_HANDLER(ViewMsg_IDBCallbacksError, | 55 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
| 60 OnError) | 56 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) |
| 61 IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksAbort, | 57 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) |
| 62 OnAbort) | 58 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksTimeout, OnTimeout) |
| 63 IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksComplete, | |
| 64 OnComplete) | |
| 65 IPC_MESSAGE_HANDLER(ViewMsg_IDBTransactionCallbacksTimeout, | |
| 66 OnTimeout) | |
| 67 IPC_MESSAGE_UNHANDLED(handled = false) | 59 IPC_MESSAGE_UNHANDLED(handled = false) |
| 68 IPC_END_MESSAGE_MAP() | 60 IPC_END_MESSAGE_MAP() |
| 69 return handled; | 61 return handled; |
| 70 } | 62 } |
| 71 | 63 |
| 72 void IndexedDBDispatcher::RequestIDBCursorUpdate( | 64 void IndexedDBDispatcher::RequestIDBCursorUpdate( |
| 73 const SerializedScriptValue& value, | 65 const SerializedScriptValue& value, |
| 74 WebIDBCallbacks* callbacks_ptr, | 66 WebIDBCallbacks* callbacks_ptr, |
| 75 int32 idb_cursor_id, | 67 int32 idb_cursor_id, |
| 76 WebExceptionCode* ec) { | 68 WebExceptionCode* ec) { |
| 77 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 69 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 78 | 70 |
| 79 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 71 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 80 RenderThread::current()->Send( | 72 RenderThread::current()->Send( |
| 81 new ViewHostMsg_IDBCursorUpdate(idb_cursor_id, response_id, value, ec)); | 73 new IndexedDBHostMsg_CursorUpdate(idb_cursor_id, response_id, value, ec)); |
| 82 if (*ec) | 74 if (*ec) |
| 83 pending_callbacks_.Remove(response_id); | 75 pending_callbacks_.Remove(response_id); |
| 84 } | 76 } |
| 85 | 77 |
| 86 void IndexedDBDispatcher::RequestIDBCursorContinue( | 78 void IndexedDBDispatcher::RequestIDBCursorContinue( |
| 87 const IndexedDBKey& key, | 79 const IndexedDBKey& key, |
| 88 WebIDBCallbacks* callbacks_ptr, | 80 WebIDBCallbacks* callbacks_ptr, |
| 89 int32 idb_cursor_id, | 81 int32 idb_cursor_id, |
| 90 WebExceptionCode* ec) { | 82 WebExceptionCode* ec) { |
| 91 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 83 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 92 | 84 |
| 93 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 85 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 94 RenderThread::current()->Send( | 86 RenderThread::current()->Send( |
| 95 new ViewHostMsg_IDBCursorContinue(idb_cursor_id, response_id, key, ec)); | 87 new IndexedDBHostMsg_CursorContinue(idb_cursor_id, response_id, key, ec)); |
| 96 if (*ec) | 88 if (*ec) |
| 97 pending_callbacks_.Remove(response_id); | 89 pending_callbacks_.Remove(response_id); |
| 98 } | 90 } |
| 99 | 91 |
| 100 void IndexedDBDispatcher::RequestIDBCursorDelete( | 92 void IndexedDBDispatcher::RequestIDBCursorDelete( |
| 101 WebIDBCallbacks* callbacks_ptr, | 93 WebIDBCallbacks* callbacks_ptr, |
| 102 int32 idb_cursor_id, | 94 int32 idb_cursor_id, |
| 103 WebExceptionCode* ec) { | 95 WebExceptionCode* ec) { |
| 104 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 96 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 105 | 97 |
| 106 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 98 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 107 RenderThread::current()->Send( | 99 RenderThread::current()->Send( |
| 108 new ViewHostMsg_IDBCursorDelete(idb_cursor_id, response_id, ec)); | 100 new IndexedDBHostMsg_CursorDelete(idb_cursor_id, response_id, ec)); |
| 109 if (*ec) | 101 if (*ec) |
| 110 pending_callbacks_.Remove(response_id); | 102 pending_callbacks_.Remove(response_id); |
| 111 } | 103 } |
| 112 | 104 |
| 113 void IndexedDBDispatcher::RequestIDBFactoryOpen( | 105 void IndexedDBDispatcher::RequestIDBFactoryOpen( |
| 114 const string16& name, | 106 const string16& name, |
| 115 WebIDBCallbacks* callbacks_ptr, | 107 WebIDBCallbacks* callbacks_ptr, |
| 116 const string16& origin, | 108 const string16& origin, |
| 117 WebFrame* web_frame, | 109 WebFrame* web_frame, |
| 118 uint64 maximum_size) { | 110 uint64 maximum_size) { |
| 119 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 111 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 120 | 112 |
| 121 if (!web_frame) | 113 if (!web_frame) |
| 122 return; // We must be shutting down. | 114 return; // We must be shutting down. |
| 123 RenderView* render_view = RenderView::FromWebView(web_frame->view()); | 115 RenderView* render_view = RenderView::FromWebView(web_frame->view()); |
| 124 if (!render_view) | 116 if (!render_view) |
| 125 return; // We must be shutting down. | 117 return; // We must be shutting down. |
| 126 | 118 |
| 127 ViewHostMsg_IDBFactoryOpen_Params params; | 119 IndexedDBHostMsg_FactoryOpen_Params params; |
| 128 params.routing_id_ = render_view->routing_id(); | 120 params.routing_id = render_view->routing_id(); |
| 129 params.response_id_ = pending_callbacks_.Add(callbacks.release()); | 121 params.response_id = pending_callbacks_.Add(callbacks.release()); |
| 130 params.origin_ = origin; | 122 params.origin = origin; |
| 131 params.name_ = name; | 123 params.name = name; |
| 132 params.maximum_size_ = maximum_size; | 124 params.maximum_size = maximum_size; |
| 133 RenderThread::current()->Send(new ViewHostMsg_IDBFactoryOpen(params)); | 125 RenderThread::current()->Send(new IndexedDBHostMsg_FactoryOpen(params)); |
| 134 } | 126 } |
| 135 | 127 |
| 136 void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( | 128 void IndexedDBDispatcher::RequestIDBDatabaseSetVersion( |
| 137 const string16& version, | 129 const string16& version, |
| 138 WebIDBCallbacks* callbacks_ptr, | 130 WebIDBCallbacks* callbacks_ptr, |
| 139 int32 idb_database_id, | 131 int32 idb_database_id, |
| 140 WebExceptionCode* ec) { | 132 WebExceptionCode* ec) { |
| 141 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 133 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 142 | 134 |
| 143 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 135 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 144 RenderThread::current()->Send( | 136 RenderThread::current()->Send( |
| 145 new ViewHostMsg_IDBDatabaseSetVersion(idb_database_id, response_id, | 137 new IndexedDBHostMsg_DatabaseSetVersion(idb_database_id, response_id, |
| 146 version, ec)); | 138 version, ec)); |
| 147 if (*ec) | 139 if (*ec) |
| 148 pending_callbacks_.Remove(response_id); | 140 pending_callbacks_.Remove(response_id); |
| 149 } | 141 } |
| 150 | 142 |
| 151 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( | 143 void IndexedDBDispatcher::RequestIDBIndexOpenObjectCursor( |
| 152 const WebIDBKeyRange& idb_key_range, | 144 const WebIDBKeyRange& idb_key_range, |
| 153 unsigned short direction, | 145 unsigned short direction, |
| 154 WebIDBCallbacks* callbacks_ptr, | 146 WebIDBCallbacks* callbacks_ptr, |
| 155 int32 idb_index_id, | 147 int32 idb_index_id, |
| 156 const WebIDBTransaction& transaction, | 148 const WebIDBTransaction& transaction, |
| 157 WebExceptionCode* ec) { | 149 WebExceptionCode* ec) { |
| 158 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 150 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 159 ViewHostMsg_IDBIndexOpenCursor_Params params; | 151 IndexedDBHostMsg_IndexOpenCursor_Params params; |
| 160 params.response_id_ = pending_callbacks_.Add(callbacks.release()); | 152 params.response_id = pending_callbacks_.Add(callbacks.release()); |
| 161 params.lower_key_.Set(idb_key_range.lower()); | 153 params.lower_key.Set(idb_key_range.lower()); |
| 162 params.upper_key_.Set(idb_key_range.upper()); | 154 params.upper_key.Set(idb_key_range.upper()); |
| 163 params.lower_open_ = idb_key_range.lowerOpen(); | 155 params.lower_open = idb_key_range.lowerOpen(); |
| 164 params.upper_open_ = idb_key_range.upperOpen(); | 156 params.upper_open = idb_key_range.upperOpen(); |
| 165 params.direction_ = direction; | 157 params.direction = direction; |
| 166 params.idb_index_id_ = idb_index_id; | 158 params.idb_index_id = idb_index_id; |
| 167 params.transaction_id_ = TransactionId(transaction); | 159 params.transaction_id = TransactionId(transaction); |
| 168 RenderThread::current()->Send( | 160 RenderThread::current()->Send( |
| 169 new ViewHostMsg_IDBIndexOpenObjectCursor(params, ec)); | 161 new IndexedDBHostMsg_IndexOpenObjectCursor(params, ec)); |
| 170 if (*ec) | 162 if (*ec) |
| 171 pending_callbacks_.Remove(params.response_id_); | 163 pending_callbacks_.Remove(params.response_id); |
| 172 } | 164 } |
| 173 | 165 |
| 174 void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( | 166 void IndexedDBDispatcher::RequestIDBIndexOpenKeyCursor( |
| 175 const WebIDBKeyRange& idb_key_range, | 167 const WebIDBKeyRange& idb_key_range, |
| 176 unsigned short direction, | 168 unsigned short direction, |
| 177 WebIDBCallbacks* callbacks_ptr, | 169 WebIDBCallbacks* callbacks_ptr, |
| 178 int32 idb_index_id, | 170 int32 idb_index_id, |
| 179 const WebIDBTransaction& transaction, | 171 const WebIDBTransaction& transaction, |
| 180 WebExceptionCode* ec) { | 172 WebExceptionCode* ec) { |
| 181 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 173 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 182 ViewHostMsg_IDBIndexOpenCursor_Params params; | 174 IndexedDBHostMsg_IndexOpenCursor_Params params; |
| 183 params.response_id_ = pending_callbacks_.Add(callbacks.release()); | 175 params.response_id = pending_callbacks_.Add(callbacks.release()); |
| 184 // TODO(jorlow): We really should just create a Chromium abstraction for | 176 // TODO(jorlow): We really should just create a Chromium abstraction for |
| 185 // KeyRange rather than doing it ad-hoc like this. | 177 // KeyRange rather than doing it ad-hoc like this. |
| 186 params.lower_key_.Set(idb_key_range.lower()); | 178 params.lower_key.Set(idb_key_range.lower()); |
| 187 params.upper_key_.Set(idb_key_range.upper()); | 179 params.upper_key.Set(idb_key_range.upper()); |
| 188 params.lower_open_ = idb_key_range.lowerOpen(); | 180 params.lower_open = idb_key_range.lowerOpen(); |
| 189 params.upper_open_ = idb_key_range.upperOpen(); | 181 params.upper_open = idb_key_range.upperOpen(); |
| 190 params.direction_ = direction; | 182 params.direction = direction; |
| 191 params.idb_index_id_ = idb_index_id; | 183 params.idb_index_id = idb_index_id; |
| 192 params.transaction_id_ = TransactionId(transaction); | 184 params.transaction_id = TransactionId(transaction); |
| 193 RenderThread::current()->Send( | 185 RenderThread::current()->Send( |
| 194 new ViewHostMsg_IDBIndexOpenKeyCursor(params, ec)); | 186 new IndexedDBHostMsg_IndexOpenKeyCursor(params, ec)); |
| 195 if (*ec) | 187 if (*ec) |
| 196 pending_callbacks_.Remove(params.response_id_); | 188 pending_callbacks_.Remove(params.response_id); |
| 197 } | 189 } |
| 198 | 190 |
| 199 void IndexedDBDispatcher::RequestIDBIndexGetObject( | 191 void IndexedDBDispatcher::RequestIDBIndexGetObject( |
| 200 const IndexedDBKey& key, | 192 const IndexedDBKey& key, |
| 201 WebIDBCallbacks* callbacks_ptr, | 193 WebIDBCallbacks* callbacks_ptr, |
| 202 int32 idb_index_id, | 194 int32 idb_index_id, |
| 203 const WebIDBTransaction& transaction, | 195 const WebIDBTransaction& transaction, |
| 204 WebExceptionCode* ec) { | 196 WebExceptionCode* ec) { |
| 205 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 197 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 206 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 198 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 207 RenderThread::current()->Send( | 199 RenderThread::current()->Send( |
| 208 new ViewHostMsg_IDBIndexGetObject( | 200 new IndexedDBHostMsg_IndexGetObject( |
| 209 idb_index_id, response_id, key, | 201 idb_index_id, response_id, key, |
| 210 TransactionId(transaction), ec)); | 202 TransactionId(transaction), ec)); |
| 211 if (*ec) | 203 if (*ec) |
| 212 pending_callbacks_.Remove(response_id); | 204 pending_callbacks_.Remove(response_id); |
| 213 } | 205 } |
| 214 | 206 |
| 215 void IndexedDBDispatcher::RequestIDBIndexGetKey( | 207 void IndexedDBDispatcher::RequestIDBIndexGetKey( |
| 216 const IndexedDBKey& key, | 208 const IndexedDBKey& key, |
| 217 WebIDBCallbacks* callbacks_ptr, | 209 WebIDBCallbacks* callbacks_ptr, |
| 218 int32 idb_index_id, | 210 int32 idb_index_id, |
| 219 const WebIDBTransaction& transaction, | 211 const WebIDBTransaction& transaction, |
| 220 WebExceptionCode* ec) { | 212 WebExceptionCode* ec) { |
| 221 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 213 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 222 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 214 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 223 RenderThread::current()->Send( | 215 RenderThread::current()->Send( |
| 224 new ViewHostMsg_IDBIndexGetKey( | 216 new IndexedDBHostMsg_IndexGetKey( |
| 225 idb_index_id, response_id, key, | 217 idb_index_id, response_id, key, |
| 226 TransactionId(transaction), ec)); | 218 TransactionId(transaction), ec)); |
| 227 if (*ec) | 219 if (*ec) |
| 228 pending_callbacks_.Remove(response_id); | 220 pending_callbacks_.Remove(response_id); |
| 229 } | 221 } |
| 230 | 222 |
| 231 void IndexedDBDispatcher::RequestIDBObjectStoreGet( | 223 void IndexedDBDispatcher::RequestIDBObjectStoreGet( |
| 232 const IndexedDBKey& key, | 224 const IndexedDBKey& key, |
| 233 WebIDBCallbacks* callbacks_ptr, | 225 WebIDBCallbacks* callbacks_ptr, |
| 234 int32 idb_object_store_id, | 226 int32 idb_object_store_id, |
| 235 const WebIDBTransaction& transaction, | 227 const WebIDBTransaction& transaction, |
| 236 WebExceptionCode* ec) { | 228 WebExceptionCode* ec) { |
| 237 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 229 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 238 | 230 |
| 239 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 231 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 240 RenderThread::current()->Send( | 232 RenderThread::current()->Send( |
| 241 new ViewHostMsg_IDBObjectStoreGet( | 233 new IndexedDBHostMsg_ObjectStoreGet( |
| 242 idb_object_store_id, response_id, | 234 idb_object_store_id, response_id, |
| 243 key, TransactionId(transaction), ec)); | 235 key, TransactionId(transaction), ec)); |
| 244 if (*ec) | 236 if (*ec) |
| 245 pending_callbacks_.Remove(response_id); | 237 pending_callbacks_.Remove(response_id); |
| 246 } | 238 } |
| 247 | 239 |
| 248 void IndexedDBDispatcher::RequestIDBObjectStorePut( | 240 void IndexedDBDispatcher::RequestIDBObjectStorePut( |
| 249 const SerializedScriptValue& value, | 241 const SerializedScriptValue& value, |
| 250 const IndexedDBKey& key, | 242 const IndexedDBKey& key, |
| 251 bool add_only, | 243 bool add_only, |
| 252 WebIDBCallbacks* callbacks_ptr, | 244 WebIDBCallbacks* callbacks_ptr, |
| 253 int32 idb_object_store_id, | 245 int32 idb_object_store_id, |
| 254 const WebIDBTransaction& transaction, | 246 const WebIDBTransaction& transaction, |
| 255 WebExceptionCode* ec) { | 247 WebExceptionCode* ec) { |
| 256 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 248 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 257 ViewHostMsg_IDBObjectStorePut_Params params; | 249 IndexedDBHostMsg_ObjectStorePut_Params params; |
| 258 params.idb_object_store_id_ = idb_object_store_id; | 250 params.idb_object_store_id = idb_object_store_id; |
| 259 params.response_id_ = pending_callbacks_.Add(callbacks.release()); | 251 params.response_id = pending_callbacks_.Add(callbacks.release()); |
| 260 params.serialized_value_ = value; | 252 params.serialized_value = value; |
| 261 params.key_ = key; | 253 params.key = key; |
| 262 params.add_only_ = add_only; | 254 params.add_only = add_only; |
| 263 params.transaction_id_ = TransactionId(transaction); | 255 params.transaction_id = TransactionId(transaction); |
| 264 RenderThread::current()->Send(new ViewHostMsg_IDBObjectStorePut(params, ec)); | 256 RenderThread::current()->Send(new IndexedDBHostMsg_ObjectStorePut( |
| 257 params, ec)); |
| 265 if (*ec) | 258 if (*ec) |
| 266 pending_callbacks_.Remove(params.response_id_); | 259 pending_callbacks_.Remove(params.response_id); |
| 267 } | 260 } |
| 268 | 261 |
| 269 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( | 262 void IndexedDBDispatcher::RequestIDBObjectStoreDelete( |
| 270 const IndexedDBKey& key, | 263 const IndexedDBKey& key, |
| 271 WebIDBCallbacks* callbacks_ptr, | 264 WebIDBCallbacks* callbacks_ptr, |
| 272 int32 idb_object_store_id, | 265 int32 idb_object_store_id, |
| 273 const WebIDBTransaction& transaction, | 266 const WebIDBTransaction& transaction, |
| 274 WebExceptionCode* ec) { | 267 WebExceptionCode* ec) { |
| 275 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 268 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 276 | 269 |
| 277 int32 response_id = pending_callbacks_.Add(callbacks.release()); | 270 int32 response_id = pending_callbacks_.Add(callbacks.release()); |
| 278 RenderThread::current()->Send( | 271 RenderThread::current()->Send( |
| 279 new ViewHostMsg_IDBObjectStoreDelete( | 272 new IndexedDBHostMsg_ObjectStoreDelete( |
| 280 idb_object_store_id, response_id, | 273 idb_object_store_id, response_id, |
| 281 key, TransactionId(transaction), ec)); | 274 key, TransactionId(transaction), ec)); |
| 282 if (*ec) | 275 if (*ec) |
| 283 pending_callbacks_.Remove(response_id); | 276 pending_callbacks_.Remove(response_id); |
| 284 } | 277 } |
| 285 | 278 |
| 286 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( | 279 void IndexedDBDispatcher::RequestIDBObjectStoreOpenCursor( |
| 287 const WebIDBKeyRange& idb_key_range, | 280 const WebIDBKeyRange& idb_key_range, |
| 288 unsigned short direction, | 281 unsigned short direction, |
| 289 WebIDBCallbacks* callbacks_ptr, | 282 WebIDBCallbacks* callbacks_ptr, |
| 290 int32 idb_object_store_id, | 283 int32 idb_object_store_id, |
| 291 const WebIDBTransaction& transaction, | 284 const WebIDBTransaction& transaction, |
| 292 WebExceptionCode* ec) { | 285 WebExceptionCode* ec) { |
| 293 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 286 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 294 ViewHostMsg_IDBObjectStoreOpenCursor_Params params; | 287 IndexedDBHostMsg_ObjectStoreOpenCursor_Params params; |
| 295 params.response_id_ = pending_callbacks_.Add(callbacks.release()); | 288 params.response_id = pending_callbacks_.Add(callbacks.release()); |
| 296 params.lower_key_.Set(idb_key_range.lower()); | 289 params.lower_key.Set(idb_key_range.lower()); |
| 297 params.upper_key_.Set(idb_key_range.upper()); | 290 params.upper_key.Set(idb_key_range.upper()); |
| 298 params.lower_open_ = idb_key_range.lowerOpen(); | 291 params.lower_open = idb_key_range.lowerOpen(); |
| 299 params.upper_open_ = idb_key_range.upperOpen(); | 292 params.upper_open = idb_key_range.upperOpen(); |
| 300 params.direction_ = direction; | 293 params.direction = direction; |
| 301 params.idb_object_store_id_ = idb_object_store_id; | 294 params.idb_object_store_id = idb_object_store_id; |
| 302 params.transaction_id_ = TransactionId(transaction); | 295 params.transaction_id = TransactionId(transaction); |
| 303 RenderThread::current()->Send( | 296 RenderThread::current()->Send( |
| 304 new ViewHostMsg_IDBObjectStoreOpenCursor(params, ec)); | 297 new IndexedDBHostMsg_ObjectStoreOpenCursor(params, ec)); |
| 305 if (*ec) | 298 if (*ec) |
| 306 pending_callbacks_.Remove(params.response_id_); | 299 pending_callbacks_.Remove(params.response_id); |
| 307 } | 300 } |
| 308 | 301 |
| 309 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( | 302 void IndexedDBDispatcher::RegisterWebIDBTransactionCallbacks( |
| 310 WebIDBTransactionCallbacks* callbacks, | 303 WebIDBTransactionCallbacks* callbacks, |
| 311 int32 id) { | 304 int32 id) { |
| 312 pending_transaction_callbacks_.AddWithID(callbacks, id); | 305 pending_transaction_callbacks_.AddWithID(callbacks, id); |
| 313 } | 306 } |
| 314 | 307 |
| 315 int32 IndexedDBDispatcher::TransactionId( | 308 int32 IndexedDBDispatcher::TransactionId( |
| 316 const WebIDBTransaction& transaction) { | 309 const WebIDBTransaction& transaction) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 callbacks->onComplete(); | 388 callbacks->onComplete(); |
| 396 pending_transaction_callbacks_.Remove(transaction_id); | 389 pending_transaction_callbacks_.Remove(transaction_id); |
| 397 } | 390 } |
| 398 | 391 |
| 399 void IndexedDBDispatcher::OnTimeout(int32 transaction_id) { | 392 void IndexedDBDispatcher::OnTimeout(int32 transaction_id) { |
| 400 WebIDBTransactionCallbacks* callbacks = | 393 WebIDBTransactionCallbacks* callbacks = |
| 401 pending_transaction_callbacks_.Lookup(transaction_id); | 394 pending_transaction_callbacks_.Lookup(transaction_id); |
| 402 callbacks->onTimeout(); | 395 callbacks->onTimeout(); |
| 403 pending_transaction_callbacks_.Remove(transaction_id); | 396 pending_transaction_callbacks_.Remove(transaction_id); |
| 404 } | 397 } |
| OLD | NEW |