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_webidbobjectstore_impl.h" | 5 #include "content/common/indexed_db/proxy_webidbobjectstore_impl.h" |
6 | 6 |
7 #include "content/common/indexed_db/indexed_db_messages.h" | 7 #include "content/common/indexed_db/indexed_db_messages.h" |
8 #include "content/public/common/serialized_script_value.h" | 8 #include "content/public/common/serialized_script_value.h" |
9 #include "content/common/indexed_db/indexed_db_dispatcher.h" | 9 #include "content/common/indexed_db/indexed_db_dispatcher.h" |
10 #include "content/common/indexed_db/proxy_webidbindex_impl.h" | 10 #include "content/common/indexed_db/proxy_webidbindex_impl.h" |
11 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" | 11 #include "content/common/indexed_db/proxy_webidbtransaction_impl.h" |
12 #include "content/common/child_thread.h" | 12 #include "content/common/child_thread.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDOMStringList.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKey.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyPath.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSerialize
dScriptValue.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
19 | 20 |
20 using WebKit::WebDOMStringList; | 21 using WebKit::WebDOMStringList; |
21 using WebKit::WebExceptionCode; | 22 using WebKit::WebExceptionCode; |
22 using WebKit::WebFrame; | 23 using WebKit::WebFrame; |
23 using WebKit::WebIDBCallbacks; | 24 using WebKit::WebIDBCallbacks; |
| 25 using WebKit::WebIDBKeyPath; |
24 using WebKit::WebIDBKeyRange; | 26 using WebKit::WebIDBKeyRange; |
25 using WebKit::WebIDBIndex; | 27 using WebKit::WebIDBIndex; |
26 using WebKit::WebIDBKey; | 28 using WebKit::WebIDBKey; |
27 using WebKit::WebIDBTransaction; | 29 using WebKit::WebIDBTransaction; |
28 using WebKit::WebSerializedScriptValue; | 30 using WebKit::WebSerializedScriptValue; |
29 using WebKit::WebString; | 31 using WebKit::WebString; |
30 | 32 |
31 RendererWebIDBObjectStoreImpl::RendererWebIDBObjectStoreImpl( | 33 RendererWebIDBObjectStoreImpl::RendererWebIDBObjectStoreImpl( |
32 int32 idb_object_store_id) | 34 int32 idb_object_store_id) |
33 : idb_object_store_id_(idb_object_store_id) { | 35 : idb_object_store_id_(idb_object_store_id) { |
34 } | 36 } |
35 | 37 |
36 RendererWebIDBObjectStoreImpl::~RendererWebIDBObjectStoreImpl() { | 38 RendererWebIDBObjectStoreImpl::~RendererWebIDBObjectStoreImpl() { |
37 // It's not possible for there to be pending callbacks that address this | 39 // 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 wich owns | 40 // object since inside WebKit, they hold a reference to the object wich owns |
39 // this object. But, if that ever changed, then we'd need to invalidate | 41 // this object. But, if that ever changed, then we'd need to invalidate |
40 // any such pointers. | 42 // any such pointers. |
41 IndexedDBDispatcher::Send( | 43 IndexedDBDispatcher::Send( |
42 new IndexedDBHostMsg_ObjectStoreDestroyed(idb_object_store_id_)); | 44 new IndexedDBHostMsg_ObjectStoreDestroyed(idb_object_store_id_)); |
43 } | 45 } |
44 | 46 |
45 WebString RendererWebIDBObjectStoreImpl::name() const { | 47 WebString RendererWebIDBObjectStoreImpl::name() const { |
46 string16 result; | 48 string16 result; |
47 IndexedDBDispatcher::Send( | 49 IndexedDBDispatcher::Send( |
48 new IndexedDBHostMsg_ObjectStoreName(idb_object_store_id_, &result)); | 50 new IndexedDBHostMsg_ObjectStoreName(idb_object_store_id_, &result)); |
49 return result; | 51 return result; |
50 } | 52 } |
51 | 53 |
52 WebString RendererWebIDBObjectStoreImpl::keyPathString() const { | 54 WebIDBKeyPath RendererWebIDBObjectStoreImpl::keyPath() const { |
53 NullableString16 result; | 55 content::IndexedDBKeyPath result; |
54 IndexedDBDispatcher::Send( | 56 IndexedDBDispatcher::Send( |
55 new IndexedDBHostMsg_ObjectStoreKeyPath(idb_object_store_id_, &result)); | 57 new IndexedDBHostMsg_ObjectStoreKeyPath(idb_object_store_id_, &result)); |
56 return result; | 58 return result; |
57 } | 59 } |
58 | 60 |
59 WebDOMStringList RendererWebIDBObjectStoreImpl::indexNames() const { | 61 WebDOMStringList RendererWebIDBObjectStoreImpl::indexNames() const { |
60 std::vector<string16> result; | 62 std::vector<string16> result; |
61 IndexedDBDispatcher::Send( | 63 IndexedDBDispatcher::Send( |
62 new IndexedDBHostMsg_ObjectStoreIndexNames( | 64 new IndexedDBHostMsg_ObjectStoreIndexNames( |
63 idb_object_store_id_, &result)); | 65 idb_object_store_id_, &result)); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 const WebIDBTransaction& transaction, | 125 const WebIDBTransaction& transaction, |
124 WebExceptionCode& ec) { | 126 WebExceptionCode& ec) { |
125 IndexedDBDispatcher* dispatcher = | 127 IndexedDBDispatcher* dispatcher = |
126 IndexedDBDispatcher::ThreadSpecificInstance(); | 128 IndexedDBDispatcher::ThreadSpecificInstance(); |
127 dispatcher->RequestIDBObjectStoreClear( | 129 dispatcher->RequestIDBObjectStoreClear( |
128 callbacks, idb_object_store_id_, transaction, &ec); | 130 callbacks, idb_object_store_id_, transaction, &ec); |
129 } | 131 } |
130 | 132 |
131 WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( | 133 WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( |
132 const WebString& name, | 134 const WebString& name, |
133 const WebString& key_path, | 135 const WebIDBKeyPath& key_path, |
134 bool unique, | 136 bool unique, |
135 bool multi_entry, | 137 bool multi_entry, |
136 const WebIDBTransaction& transaction, | 138 const WebIDBTransaction& transaction, |
137 WebExceptionCode& ec) { | 139 WebExceptionCode& ec) { |
138 IndexedDBHostMsg_ObjectStoreCreateIndex_Params params; | 140 IndexedDBHostMsg_ObjectStoreCreateIndex_Params params; |
139 params.name = name; | 141 params.name = name; |
140 params.key_path = key_path; | 142 params.key_path = content::IndexedDBKeyPath(key_path); |
141 params.unique = unique; | 143 params.unique = unique; |
142 params.multi_entry = multi_entry; | 144 params.multi_entry = multi_entry; |
143 params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); | 145 params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); |
144 params.idb_object_store_id = idb_object_store_id_; | 146 params.idb_object_store_id = idb_object_store_id_; |
145 | 147 |
146 int32 index_id; | 148 int32 index_id; |
147 IndexedDBDispatcher::Send( | 149 IndexedDBDispatcher::Send( |
148 new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec)); | 150 new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec)); |
149 if (!index_id) | 151 if (!index_id) |
150 return NULL; | 152 return NULL; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 const WebIDBKeyRange& idb_key_range, | 191 const WebIDBKeyRange& idb_key_range, |
190 WebIDBCallbacks* callbacks, | 192 WebIDBCallbacks* callbacks, |
191 const WebIDBTransaction& transaction, | 193 const WebIDBTransaction& transaction, |
192 WebExceptionCode& ec) { | 194 WebExceptionCode& ec) { |
193 IndexedDBDispatcher* dispatcher = | 195 IndexedDBDispatcher* dispatcher = |
194 IndexedDBDispatcher::ThreadSpecificInstance(); | 196 IndexedDBDispatcher::ThreadSpecificInstance(); |
195 dispatcher->RequestIDBObjectStoreCount( | 197 dispatcher->RequestIDBObjectStoreCount( |
196 idb_key_range, callbacks, idb_object_store_id_, | 198 idb_key_range, callbacks, idb_object_store_id_, |
197 transaction, &ec); | 199 transaction, &ec); |
198 } | 200 } |
OLD | NEW |