Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: content/common/indexed_db/proxy_webidbobjectstore_impl.cc

Issue 10204003: Use WebIDBKeyPath type in WebKit API, implement IndexedDBKeyPath type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting nit. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const WebIDBTransaction& transaction, 136 const WebIDBTransaction& transaction,
135 WebExceptionCode& ec) { 137 WebExceptionCode& ec) {
136 IndexedDBDispatcher* dispatcher = 138 IndexedDBDispatcher* dispatcher =
137 IndexedDBDispatcher::ThreadSpecificInstance(); 139 IndexedDBDispatcher::ThreadSpecificInstance();
138 dispatcher->RequestIDBObjectStoreClear( 140 dispatcher->RequestIDBObjectStoreClear(
139 callbacks, idb_object_store_id_, transaction, &ec); 141 callbacks, idb_object_store_id_, transaction, &ec);
140 } 142 }
141 143
142 WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex( 144 WebIDBIndex* RendererWebIDBObjectStoreImpl::createIndex(
143 const WebString& name, 145 const WebString& name,
144 const WebString& key_path, 146 const WebIDBKeyPath& key_path,
145 bool unique, 147 bool unique,
146 bool multi_entry, 148 bool multi_entry,
147 const WebIDBTransaction& transaction, 149 const WebIDBTransaction& transaction,
148 WebExceptionCode& ec) { 150 WebExceptionCode& ec) {
149 IndexedDBHostMsg_ObjectStoreCreateIndex_Params params; 151 IndexedDBHostMsg_ObjectStoreCreateIndex_Params params;
150 params.name = name; 152 params.name = name;
151 params.key_path = key_path; 153 params.key_path = IndexedDBKeyPath(key_path);
152 params.unique = unique; 154 params.unique = unique;
153 params.multi_entry = multi_entry; 155 params.multi_entry = multi_entry;
154 params.transaction_id = IndexedDBDispatcher::TransactionId(transaction); 156 params.transaction_id = IndexedDBDispatcher::TransactionId(transaction);
155 params.idb_object_store_id = idb_object_store_id_; 157 params.idb_object_store_id = idb_object_store_id_;
156 158
157 int32 index_id; 159 int32 index_id;
158 IndexedDBDispatcher::Send( 160 IndexedDBDispatcher::Send(
159 new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec)); 161 new IndexedDBHostMsg_ObjectStoreCreateIndex(params, &index_id, &ec));
160 if (!index_id) 162 if (!index_id)
161 return NULL; 163 return NULL;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 const WebIDBKeyRange& idb_key_range, 202 const WebIDBKeyRange& idb_key_range,
201 WebIDBCallbacks* callbacks, 203 WebIDBCallbacks* callbacks,
202 const WebIDBTransaction& transaction, 204 const WebIDBTransaction& transaction,
203 WebExceptionCode& ec) { 205 WebExceptionCode& ec) {
204 IndexedDBDispatcher* dispatcher = 206 IndexedDBDispatcher* dispatcher =
205 IndexedDBDispatcher::ThreadSpecificInstance(); 207 IndexedDBDispatcher::ThreadSpecificInstance();
206 dispatcher->RequestIDBObjectStoreCount( 208 dispatcher->RequestIDBObjectStoreCount(
207 idb_key_range, callbacks, idb_object_store_id_, 209 idb_key_range, callbacks, idb_object_store_id_,
208 transaction, &ec); 210 transaction, &ec);
209 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698