| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 5 #ifndef CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 6 #define CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 class SerializedScriptValue; | 42 class SerializedScriptValue; |
| 43 } | 43 } |
| 44 | 44 |
| 45 CONTENT_EXPORT extern const size_t kMaxIDBValueSizeInBytes; | 45 CONTENT_EXPORT extern const size_t kMaxIDBValueSizeInBytes; |
| 46 | 46 |
| 47 // Handle the indexed db related communication for this context thread - the | 47 // Handle the indexed db related communication for this context thread - the |
| 48 // main thread and each worker thread have their own copies. | 48 // main thread and each worker thread have their own copies. |
| 49 class CONTENT_EXPORT IndexedDBDispatcher | 49 class CONTENT_EXPORT IndexedDBDispatcher |
| 50 : public webkit_glue::WorkerTaskRunner::Observer { | 50 : public webkit_glue::WorkerTaskRunner::Observer { |
| 51 public: | 51 public: |
| 52 // Constructor made public to allow RenderThreadImpl to own a copy without |
| 53 // failing a NOTREACHED in ThreadSpecificInstance in tests that instantiate |
| 54 // two copies of RenderThreadImpl on the same thread. Everyone else probably |
| 55 // wants to use ThreadSpecificInstance(). |
| 56 IndexedDBDispatcher(); |
| 52 virtual ~IndexedDBDispatcher(); | 57 virtual ~IndexedDBDispatcher(); |
| 53 static IndexedDBDispatcher* ThreadSpecificInstance(); | 58 static IndexedDBDispatcher* ThreadSpecificInstance(); |
| 54 | 59 |
| 55 // webkit_glue::WorkerTaskRunner::Observer implementation. | 60 // webkit_glue::WorkerTaskRunner::Observer implementation. |
| 56 virtual void OnWorkerRunLoopStopped() OVERRIDE; | 61 virtual void OnWorkerRunLoopStopped() OVERRIDE; |
| 57 | 62 |
| 58 void OnMessageReceived(const IPC::Message& msg); | 63 void OnMessageReceived(const IPC::Message& msg); |
| 59 static bool Send(IPC::Message* msg); | 64 static bool Send(IPC::Message* msg); |
| 60 | 65 |
| 61 void RequestIDBFactoryGetDatabaseNames( | 66 void RequestIDBFactoryGetDatabaseNames( |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 WebKit::WebIDBTransactionCallbacks* callbacks, | 207 WebKit::WebIDBTransactionCallbacks* callbacks, |
| 203 int32 id); | 208 int32 id); |
| 204 | 209 |
| 205 void CursorDestroyed(int32 cursor_id); | 210 void CursorDestroyed(int32 cursor_id); |
| 206 | 211 |
| 207 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); | 212 static int32 TransactionId(const WebKit::WebIDBTransaction& transaction); |
| 208 | 213 |
| 209 private: | 214 private: |
| 210 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); | 215 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, ValueSizeTest); |
| 211 | 216 |
| 212 IndexedDBDispatcher(); | |
| 213 // IDBCallback message handlers. | 217 // IDBCallback message handlers. |
| 214 void OnSuccessNull(int32 response_id); | 218 void OnSuccessNull(int32 response_id); |
| 215 void OnSuccessIDBDatabase(int32 thread_id, | 219 void OnSuccessIDBDatabase(int32 thread_id, |
| 216 int32 response_id, | 220 int32 response_id, |
| 217 int32 object_id); | 221 int32 object_id); |
| 218 void OnSuccessIndexedDBKey(int32 thread_id, | 222 void OnSuccessIndexedDBKey(int32 thread_id, |
| 219 int32 response_id, | 223 int32 response_id, |
| 220 const IndexedDBKey& key); | 224 const IndexedDBKey& key); |
| 221 void OnSuccessIDBTransaction(int32 thread_id, | 225 void OnSuccessIDBTransaction(int32 thread_id, |
| 222 int32 response_id, | 226 int32 response_id, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> | 260 IDMap<WebKit::WebIDBDatabaseCallbacks, IDMapOwnPointer> |
| 257 pending_database_callbacks_; | 261 pending_database_callbacks_; |
| 258 | 262 |
| 259 // Map from cursor id to RendererWebIDBCursorImpl. | 263 // Map from cursor id to RendererWebIDBCursorImpl. |
| 260 std::map<int32, RendererWebIDBCursorImpl*> cursors_; | 264 std::map<int32, RendererWebIDBCursorImpl*> cursors_; |
| 261 | 265 |
| 262 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); | 266 DISALLOW_COPY_AND_ASSIGN(IndexedDBDispatcher); |
| 263 }; | 267 }; |
| 264 | 268 |
| 265 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ | 269 #endif // CONTENT_COMMON_INDEXED_DB_INDEXED_DB_DISPATCHER_H_ |
| OLD | NEW |