| Index: content/common/indexed_db_message_filter.h
|
| diff --git a/content/common/indexed_db_message_filter.h b/content/common/indexed_db_message_filter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..aea5c2d74a3b5656da5dc606082ef0c5a91f7380
|
| --- /dev/null
|
| +++ b/content/common/indexed_db_message_filter.h
|
| @@ -0,0 +1,78 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_COMMON_INDEXED_DB_MESSAGE_FILTER_H_
|
| +#define CONTENT_COMMON_INDEXED_DB_MESSAGE_FILTER_H_
|
| +#pragma once
|
| +
|
| +#include <map>
|
| +#include <set>
|
| +
|
| +#include "base/atomic_sequence_num.h"
|
| +#include "base/nullable_string16.h"
|
| +#include "base/threading/thread_local.h"
|
| +#include "content/common/worker_task_runner.h"
|
| +#include "ipc/ipc_channel_proxy.h"
|
| +
|
| +class IndexedDBDispatcher;
|
| +class IndexedDBKey;
|
| +
|
| +namespace content {
|
| +class SerializedScriptValue;
|
| +}
|
| +
|
| +namespace WebKit {
|
| +class WebIDBCallbacks;
|
| +class WebIDBDatabaseCallbacks;
|
| +class WebIDBTransactionCallbacks;
|
| +class WebWorkerRunLoop;
|
| +}
|
| +
|
| +class IndexedDBMessageFilter : public IPC::ChannelProxy::MessageFilter,
|
| + public WorkerTaskRunner::Observer {
|
| + public:
|
| + IndexedDBMessageFilter();
|
| + virtual ~IndexedDBMessageFilter();
|
| +
|
| + // IPC::Channel::Listener implementation.
|
| + virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
|
| +
|
| + // This returns the dispatcher associated with the current WebWorkerRunLoop,
|
| + // if being run from a worker.
|
| + IndexedDBDispatcher* thread_specific_idb_dispatcher();
|
| +
|
| + // WorkerTaskRunner::Observer implementation.
|
| + virtual void onLoopRegistered() OVERRIDE;
|
| + virtual void onLoopUnregistered() OVERRIDE;
|
| +
|
| + int GetUniqueCallbackIDWithThreadID();
|
| + void DidRemoveTransactionID(int32 id);
|
| + void DidAddTransactionID(int32 id);
|
| +
|
| + private:
|
| + friend class MsgForwarderTask;
|
| + typedef std::map<int, int> CallbackIDToRunLoopMap;
|
| +
|
| + void LookupAndForwardToThread(const IPC::Message& msg,
|
| + int32 id,
|
| + const CallbackIDToRunLoopMap& map);
|
| + void ForwardToThread(const IPC::Message& msg, int32 thread_id);
|
| + void ForwardToMainThread(const IPC::Message& msg);
|
| + void DispatchMessage(const IPC::Message& msg);
|
| +
|
| + static int ExtractCallbackID(const IPC::Message& msg);
|
| + static int ExtractThreadID(int callback_id);
|
| + static int InjectThreadID(int callback_id, int thread_id);
|
| +
|
| + scoped_refptr<base::MessageLoopProxy> main_thread_loop_proxy_;
|
| + base::ThreadLocalPointer<IndexedDBDispatcher> idb_dispatcher_tls_;
|
| + base::AtomicSequenceNumber unique_id_;
|
| + CallbackIDToRunLoopMap transaction_id_to_run_loop_;
|
| + base::Lock map_lock_;
|
| +
|
| + class MsgForwarderTask;
|
| + DISALLOW_COPY_AND_ASSIGN(IndexedDBMessageFilter);
|
| +};
|
| +
|
| +#endif // CONTENT_RENDERER_INDEXED_DB_DISPATCHER_H_
|
|
|