| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/indexed_db_dispatcher.h" | 5 #include "content/renderer/indexed_db_dispatcher.h" |
| 6 | 6 |
| 7 #include "content/common/indexed_db_messages.h" | 7 #include "content/common/indexed_db_messages.h" |
| 8 #include "content/renderer/render_thread.h" | 8 #include "content/renderer/render_thread.h" |
| 9 #include "content/renderer/render_view.h" | 9 #include "content/renderer/render_view.h" |
| 10 #include "content/renderer/renderer_webidbcursor_impl.h" | 10 #include "content/renderer/renderer_webidbcursor_impl.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 IndexedDBDispatcher::~IndexedDBDispatcher() { | 36 IndexedDBDispatcher::~IndexedDBDispatcher() { |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { | 39 bool IndexedDBDispatcher::OnMessageReceived(const IPC::Message& msg) { |
| 40 bool handled = true; | 40 bool handled = true; |
| 41 IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) | 41 IPC_BEGIN_MESSAGE_MAP(IndexedDBDispatcher, msg) |
| 42 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, | 42 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBCursor, |
| 43 OnSuccessOpenCursor) | 43 OnSuccessOpenCursor) |
| 44 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, | 44 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBDatabase, |
| 45 OnSuccessIDBDatabase) | 45 OnSuccessIDBDatabase) |
| 46 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBIndex, | |
| 47 OnSuccessIDBIndex) | |
| 48 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, | 46 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIndexedDBKey, |
| 49 OnSuccessIndexedDBKey) | 47 OnSuccessIndexedDBKey) |
| 50 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, | 48 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessIDBTransaction, |
| 51 OnSuccessIDBTransaction) | 49 OnSuccessIDBTransaction) |
| 52 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, | 50 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksSuccessSerializedScriptValue, |
| 53 OnSuccessSerializedScriptValue) | 51 OnSuccessSerializedScriptValue) |
| 54 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) | 52 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksError, OnError) |
| 55 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) | 53 IPC_MESSAGE_HANDLER(IndexedDBMsg_CallbacksBlocked, OnBlocked) |
| 56 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) | 54 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksAbort, OnAbort) |
| 57 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) | 55 IPC_MESSAGE_HANDLER(IndexedDBMsg_TransactionCallbacksComplete, OnComplete) |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 pending_callbacks_.Remove(response_id); | 379 pending_callbacks_.Remove(response_id); |
| 382 } | 380 } |
| 383 | 381 |
| 384 void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 response_id, | 382 void IndexedDBDispatcher::OnSuccessIDBTransaction(int32 response_id, |
| 385 int32 object_id) { | 383 int32 object_id) { |
| 386 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | 384 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
| 387 callbacks->onSuccess(new RendererWebIDBTransactionImpl(object_id)); | 385 callbacks->onSuccess(new RendererWebIDBTransactionImpl(object_id)); |
| 388 pending_callbacks_.Remove(response_id); | 386 pending_callbacks_.Remove(response_id); |
| 389 } | 387 } |
| 390 | 388 |
| 391 void IndexedDBDispatcher::OnSuccessIDBIndex(int32 response_id, | |
| 392 int32 object_id) { | |
| 393 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | |
| 394 callbacks->onSuccess(new RendererWebIDBIndexImpl(object_id)); | |
| 395 pending_callbacks_.Remove(response_id); | |
| 396 } | |
| 397 | |
| 398 void IndexedDBDispatcher::OnSuccessSerializedScriptValue( | 389 void IndexedDBDispatcher::OnSuccessSerializedScriptValue( |
| 399 int32 response_id, const SerializedScriptValue& value) { | 390 int32 response_id, const SerializedScriptValue& value) { |
| 400 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); | 391 WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); |
| 401 callbacks->onSuccess(value); | 392 callbacks->onSuccess(value); |
| 402 pending_callbacks_.Remove(response_id); | 393 pending_callbacks_.Remove(response_id); |
| 403 } | 394 } |
| 404 | 395 |
| 405 void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id, | 396 void IndexedDBDispatcher::OnSuccessOpenCursor(int32 repsonse_id, |
| 406 int32 object_id) { | 397 int32 object_id) { |
| 407 WebIDBCallbacks* callbacks = | 398 WebIDBCallbacks* callbacks = |
| (...skipping 30 matching lines...) Expand all Loading... |
| 438 | 429 |
| 439 void IndexedDBDispatcher::OnVersionChange(int32 database_id, | 430 void IndexedDBDispatcher::OnVersionChange(int32 database_id, |
| 440 const string16& newVersion) { | 431 const string16& newVersion) { |
| 441 WebIDBDatabaseCallbacks* callbacks = | 432 WebIDBDatabaseCallbacks* callbacks = |
| 442 pending_database_callbacks_.Lookup(database_id); | 433 pending_database_callbacks_.Lookup(database_id); |
| 443 // callbacks would be NULL if a versionchange event is received after close | 434 // callbacks would be NULL if a versionchange event is received after close |
| 444 // has been called. | 435 // has been called. |
| 445 if (callbacks) | 436 if (callbacks) |
| 446 callbacks->onVersionChange(newVersion); | 437 callbacks->onVersionChange(newVersion); |
| 447 } | 438 } |
| OLD | NEW |