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 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" | 5 #include "content/common/indexed_db/proxy_webidbdatabase_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "content/common/child_thread.h" | 9 #include "content/common/child_thread.h" |
10 #include "content/common/indexed_db/indexed_db_messages.h" | 10 #include "content/common/indexed_db/indexed_db_messages.h" |
11 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 11 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" |
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" | 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebVector.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBMetadata.h" |
16 #include "webkit/glue/worker_task_runner.h" | 16 #include "webkit/glue/worker_task_runner.h" |
17 | 17 |
18 using WebKit::WebDOMStringList; | 18 using WebKit::WebDOMStringList; |
19 using WebKit::WebExceptionCode; | 19 using WebKit::WebExceptionCode; |
20 using WebKit::WebFrame; | 20 using WebKit::WebFrame; |
21 using WebKit::WebIDBCallbacks; | 21 using WebKit::WebIDBCallbacks; |
22 using WebKit::WebIDBDatabaseCallbacks; | 22 using WebKit::WebIDBDatabaseCallbacks; |
23 using WebKit::WebIDBMetadata; | 23 using WebKit::WebIDBMetadata; |
24 using WebKit::WebIDBKeyPath; | 24 using WebKit::WebIDBKeyPath; |
25 using WebKit::WebIDBTransaction; | |
26 using WebKit::WebString; | 25 using WebKit::WebString; |
27 using WebKit::WebVector; | 26 using WebKit::WebVector; |
28 using webkit_glue::WorkerTaskRunner; | 27 using webkit_glue::WorkerTaskRunner; |
29 | 28 |
30 namespace content { | 29 namespace content { |
31 | 30 |
32 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 ipc_database_id) | 31 RendererWebIDBDatabaseImpl::RendererWebIDBDatabaseImpl(int32 ipc_database_id) |
33 : ipc_database_id_(ipc_database_id) { | 32 : ipc_database_id_(ipc_database_id) { |
34 } | 33 } |
35 | 34 |
36 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { | 35 RendererWebIDBDatabaseImpl::~RendererWebIDBDatabaseImpl() { |
37 // It's not possible for there to be pending callbacks that address this | 36 // It's not possible for there to be pending callbacks that address this |
38 // object since inside WebKit, they hold a reference to the object which owns | 37 // object since inside WebKit, they hold a reference to the object which owns |
39 // this object. But, if that ever changed, then we'd need to invalidate | 38 // this object. But, if that ever changed, then we'd need to invalidate |
40 // any such pointers. | 39 // any such pointers. |
41 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseDestroyed( | 40 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseDestroyed( |
42 ipc_database_id_)); | 41 ipc_database_id_)); |
43 IndexedDBDispatcher* dispatcher = | 42 IndexedDBDispatcher* dispatcher = |
44 IndexedDBDispatcher::ThreadSpecificInstance(); | 43 IndexedDBDispatcher::ThreadSpecificInstance(); |
45 dispatcher->DatabaseDestroyed(ipc_database_id_); | 44 dispatcher->DatabaseDestroyed(ipc_database_id_); |
46 } | 45 } |
47 | 46 |
48 WebIDBMetadata RendererWebIDBDatabaseImpl::metadata() const { | |
49 IndexedDBDatabaseMetadata idb_metadata; | |
50 IndexedDBDispatcher::Send( | |
51 new IndexedDBHostMsg_DatabaseMetadata(ipc_database_id_, &idb_metadata)); | |
52 | |
53 return IndexedDBDispatcher::ConvertMetadata(idb_metadata); | |
54 } | |
55 | |
56 void RendererWebIDBDatabaseImpl::createObjectStore( | 47 void RendererWebIDBDatabaseImpl::createObjectStore( |
57 long long transaction_id, | 48 long long transaction_id, |
58 long long object_store_id, | 49 long long object_store_id, |
59 const WebKit::WebString& name, | 50 const WebKit::WebString& name, |
60 const WebKit::WebIDBKeyPath& key_path, | 51 const WebKit::WebIDBKeyPath& key_path, |
61 bool auto_increment) { | 52 bool auto_increment) { |
62 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; | 53 IndexedDBHostMsg_DatabaseCreateObjectStore_Params params; |
63 params.ipc_database_id = ipc_database_id_; | 54 params.ipc_database_id = ipc_database_id_; |
64 params.transaction_id = transaction_id; | 55 params.transaction_id = transaction_id; |
65 params.object_store_id = object_store_id; | 56 params.object_store_id = object_store_id; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseAbort( | 255 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseAbort( |
265 ipc_database_id_, transaction_id)); | 256 ipc_database_id_, transaction_id)); |
266 } | 257 } |
267 | 258 |
268 void RendererWebIDBDatabaseImpl::commit(long long transaction_id) { | 259 void RendererWebIDBDatabaseImpl::commit(long long transaction_id) { |
269 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseCommit( | 260 IndexedDBDispatcher::Send(new IndexedDBHostMsg_DatabaseCommit( |
270 ipc_database_id_, transaction_id)); | 261 ipc_database_id_, transaction_id)); |
271 } | 262 } |
272 | 263 |
273 } // namespace content | 264 } // namespace content |
OLD | NEW |