| Index: content/renderer/indexed_db_dispatcher.h
|
| diff --git a/content/renderer/indexed_db_dispatcher.h b/content/renderer/indexed_db_dispatcher.h
|
| index 6f7deef941d45ae01d482dbef49e5eb88dc3d2d3..20c1e489cecc517f11224a857524f260e237d610 100644
|
| --- a/content/renderer/indexed_db_dispatcher.h
|
| +++ b/content/renderer/indexed_db_dispatcher.h
|
| @@ -11,16 +11,25 @@
|
|
|
| #include "base/id_map.h"
|
| #include "base/nullable_string16.h"
|
| -#include "ipc/ipc_channel.h"
|
| +#include "base/threading/thread_local.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebExceptionCode.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBCallbacks.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabase.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBObjectStore.h"
|
| #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h"
|
| +#include "webkit/glue/worker_task_runner.h"
|
|
|
| class IndexedDBKey;
|
| +struct IndexedDBMsg_CallbacksSuccessCursorContinue_Params;
|
| +struct IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params;
|
| +struct IndexedDBMsg_CallbacksSuccessIDBCursor_Params;
|
| class RendererWebIDBCursorImpl;
|
|
|
| +namespace IPC {
|
| +class Message;
|
| +}
|
| +
|
| namespace WebKit {
|
| class WebFrame;
|
| class WebIDBKeyRange;
|
| @@ -32,13 +41,18 @@ class SerializedScriptValue;
|
| }
|
|
|
| // Handle the indexed db related communication for this entire renderer.
|
| -class IndexedDBDispatcher : public IPC::Channel::Listener {
|
| +class IndexedDBDispatcher : public webkit_glue::WorkerTaskRunner::Observer {
|
| public:
|
| - IndexedDBDispatcher();
|
| virtual ~IndexedDBDispatcher();
|
| + static void Init();
|
| + // This returns the dispatcher associated with the current WebWorkerRunLoop,
|
| + // if being run from a worker.
|
| + static IndexedDBDispatcher* Instance();
|
| +
|
| + // webkit_glue::WorkerTaskRunner::Observer implementation.
|
| + virtual void OnWorkerRunLoopStopped() OVERRIDE;
|
|
|
| - // IPC::Channel::Listener implementation.
|
| - virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
|
| + void OnMessageReceived(const IPC::Message& msg);
|
| void Send(IPC::Message* msg);
|
|
|
| void RequestIDBFactoryGetDatabaseNames(
|
| @@ -169,36 +183,41 @@ class IndexedDBDispatcher : public IPC::Channel::Listener {
|
| static int32 TransactionId(const WebKit::WebIDBTransaction& transaction);
|
|
|
| private:
|
| + IndexedDBDispatcher();
|
| // IDBCallback message handlers.
|
| void OnSuccessNull(int32 response_id);
|
| - void OnSuccessIDBDatabase(int32 response_id, int32 object_id);
|
| - void OnSuccessIndexedDBKey(int32 response_id, const IndexedDBKey& key);
|
| - void OnSuccessIDBTransaction(int32 response_id, int32 object_id);
|
| - void OnSuccessOpenCursor(int32 response_id, int32 object_id,
|
| - const IndexedDBKey& key,
|
| - const IndexedDBKey& primary_key,
|
| - const content::SerializedScriptValue& value);
|
| - void OnSuccessCursorContinue(int32 response_id,
|
| - int32 cursor_id,
|
| - const IndexedDBKey& key,
|
| - const IndexedDBKey& primary_key,
|
| - const content::SerializedScriptValue& value);
|
| + void OnSuccessIDBDatabase(int32 thread_id,
|
| + int32 response_id,
|
| + int32 object_id);
|
| + void OnSuccessIndexedDBKey(int32 thread_id,
|
| + int32 response_id,
|
| + const IndexedDBKey& key);
|
| + void OnSuccessIDBTransaction(int32 thread_id,
|
| + int32 response_id,
|
| + int32 object_id);
|
| + void OnSuccessOpenCursor(
|
| + const IndexedDBMsg_CallbacksSuccessIDBCursor_Params& p);
|
| + void OnSuccessCursorContinue(
|
| + const IndexedDBMsg_CallbacksSuccessCursorContinue_Params& p);
|
| void OnSuccessCursorPrefetch(
|
| - int32 response_id,
|
| - int32 cursor_id,
|
| - const std::vector<IndexedDBKey>& keys,
|
| - const std::vector<IndexedDBKey>& primary_keys,
|
| - const std::vector<content::SerializedScriptValue>& values);
|
| - void OnSuccessStringList(int32 response_id,
|
| + const IndexedDBMsg_CallbacksSuccessCursorPrefetch_Params& p);
|
| + void OnSuccessStringList(int32 thread_id,
|
| + int32 response_id,
|
| const std::vector<string16>& value);
|
| void OnSuccessSerializedScriptValue(
|
| + int32 thread_id,
|
| int32 response_id,
|
| const content::SerializedScriptValue& value);
|
| - void OnError(int32 response_id, int code, const string16& message);
|
| - void OnBlocked(int32 response_id);
|
| - void OnAbort(int32 transaction_id);
|
| - void OnComplete(int32 transaction_id);
|
| - void OnVersionChange(int32 database_id, const string16& newVersion);
|
| + void OnError(int32 thread_id,
|
| + int32 response_id,
|
| + int code,
|
| + const string16& message);
|
| + void OnBlocked(int32 thread_id, int32 response_id);
|
| + void OnAbort(int32 thread_id, int32 transaction_id);
|
| + void OnComplete(int32 thread_id, int32 transaction_id);
|
| + void OnVersionChange(int32 thread_id,
|
| + int32 database_id,
|
| + const string16& newVersion);
|
|
|
| // Reset cursor prefetch caches for all cursors except exception_cursor_id.
|
| void ResetCursorPrefetchCaches(int32 exception_cursor_id = -1);
|
| @@ -214,6 +233,8 @@ class IndexedDBDispatcher : public IPC::Channel::Listener {
|
| // Map from cursor id to RendererWebIDBCursorImpl.
|
| std::map<int32, RendererWebIDBCursorImpl*> cursors_;
|
|
|
| + static base::ThreadLocalPointer<IndexedDBDispatcher>* idb_dispatcher_tls_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher);
|
| };
|
|
|
|
|