| 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/WebIDBKeyPath.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBKeyRange.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIDBTransaction.h" |
| 18 #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" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 20 | 20 |
| 21 using content::IndexedDBKey; |
| 21 using content::IndexedDBKeyPath; | 22 using content::IndexedDBKeyPath; |
| 23 using content::IndexedDBKeyRange; |
| 22 using content::SerializedScriptValue; | 24 using content::SerializedScriptValue; |
| 23 using WebKit::WebDOMStringList; | 25 using WebKit::WebDOMStringList; |
| 24 using WebKit::WebExceptionCode; | 26 using WebKit::WebExceptionCode; |
| 25 using WebKit::WebFrame; | 27 using WebKit::WebFrame; |
| 26 using WebKit::WebIDBCallbacks; | 28 using WebKit::WebIDBCallbacks; |
| 27 using WebKit::WebIDBKeyPath; | 29 using WebKit::WebIDBKeyPath; |
| 28 using WebKit::WebIDBKeyRange; | 30 using WebKit::WebIDBKeyRange; |
| 29 using WebKit::WebIDBIndex; | 31 using WebKit::WebIDBIndex; |
| 30 using WebKit::WebIDBKey; | 32 using WebKit::WebIDBKey; |
| 31 using WebKit::WebIDBTransaction; | 33 using WebKit::WebIDBTransaction; |
| 32 using WebKit::WebSerializedScriptValue; | 34 using WebKit::WebSerializedScriptValue; |
| 33 using WebKit::WebString; | 35 using WebKit::WebString; |
| 36 using WebKit::WebVector; |
| 34 | 37 |
| 35 RendererWebIDBObjectStoreImpl::RendererWebIDBObjectStoreImpl( | 38 RendererWebIDBObjectStoreImpl::RendererWebIDBObjectStoreImpl( |
| 36 int32 idb_object_store_id) | 39 int32 idb_object_store_id) |
| 37 : idb_object_store_id_(idb_object_store_id) { | 40 : idb_object_store_id_(idb_object_store_id) { |
| 38 } | 41 } |
| 39 | 42 |
| 40 RendererWebIDBObjectStoreImpl::~RendererWebIDBObjectStoreImpl() { | 43 RendererWebIDBObjectStoreImpl::~RendererWebIDBObjectStoreImpl() { |
| 41 // It's not possible for there to be pending callbacks that address this | 44 // It's not possible for there to be pending callbacks that address this |
| 42 // object since inside WebKit, they hold a reference to the object wich owns | 45 // object since inside WebKit, they hold a reference to the object wich owns |
| 43 // this object. But, if that ever changed, then we'd need to invalidate | 46 // this object. But, if that ever changed, then we'd need to invalidate |
| 44 // any such pointers. | 47 // any such pointers. |
| 45 IndexedDBDispatcher::Send( | 48 IndexedDBDispatcher::Send( |
| 46 new IndexedDBHostMsg_ObjectStoreDestroyed(idb_object_store_id_)); | 49 new IndexedDBHostMsg_ObjectStoreDestroyed(idb_object_store_id_)); |
| 47 } | 50 } |
| 48 | 51 |
| 49 void RendererWebIDBObjectStoreImpl::get( | 52 void RendererWebIDBObjectStoreImpl::get( |
| 50 const WebIDBKeyRange& key_range, | 53 const WebIDBKeyRange& key_range, |
| 51 WebIDBCallbacks* callbacks, | 54 WebIDBCallbacks* callbacks, |
| 52 const WebIDBTransaction& transaction, | 55 const WebIDBTransaction& transaction, |
| 53 WebExceptionCode& ec) { | 56 WebExceptionCode& ec) { |
| 54 IndexedDBDispatcher* dispatcher = | 57 IndexedDBDispatcher* dispatcher = |
| 55 IndexedDBDispatcher::ThreadSpecificInstance(); | 58 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 56 dispatcher->RequestIDBObjectStoreGet( | 59 dispatcher->RequestIDBObjectStoreGet( |
| 57 content::IndexedDBKeyRange(key_range), callbacks, | 60 IndexedDBKeyRange(key_range), callbacks, |
| 58 idb_object_store_id_, transaction, &ec); | 61 idb_object_store_id_, transaction, &ec); |
| 59 } | 62 } |
| 60 | 63 |
| 61 void RendererWebIDBObjectStoreImpl::put( | 64 void RendererWebIDBObjectStoreImpl::put( |
| 62 const WebSerializedScriptValue& value, | 65 const WebSerializedScriptValue& value, |
| 63 const WebIDBKey& key, | 66 const WebIDBKey& key, |
| 64 PutMode put_mode, | 67 PutMode put_mode, |
| 65 WebIDBCallbacks* callbacks, | 68 WebIDBCallbacks* callbacks, |
| 66 const WebIDBTransaction& transaction, | 69 const WebIDBTransaction& transaction, |
| 67 WebExceptionCode& ec) { | 70 WebExceptionCode& ec) { |
| 68 IndexedDBDispatcher* dispatcher = | 71 IndexedDBDispatcher* dispatcher = |
| 69 IndexedDBDispatcher::ThreadSpecificInstance(); | 72 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 73 WebVector<WebString> emptyIndexNames; |
| 74 WebVector<WebVector<WebIDBKey> > emptyIndexKeys; |
| 75 dispatcher->RequestIDBObjectStorePut( |
| 76 SerializedScriptValue(value), IndexedDBKey(key), |
| 77 put_mode, callbacks, idb_object_store_id_, transaction, |
| 78 emptyIndexNames, emptyIndexKeys, &ec); |
| 79 } |
| 80 |
| 81 void RendererWebIDBObjectStoreImpl::putWithIndexKeys( |
| 82 const WebSerializedScriptValue& value, |
| 83 const WebIDBKey& key, |
| 84 PutMode put_mode, |
| 85 WebIDBCallbacks* callbacks, |
| 86 const WebIDBTransaction& transaction, |
| 87 const WebVector<WebString>& indexNames, |
| 88 const WebVector<WebVector<WebIDBKey> >& indexKeys, |
| 89 WebExceptionCode& ec) { |
| 90 IndexedDBDispatcher* dispatcher = |
| 91 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 70 dispatcher->RequestIDBObjectStorePut( | 92 dispatcher->RequestIDBObjectStorePut( |
| 71 SerializedScriptValue(value), content::IndexedDBKey(key), | 93 SerializedScriptValue(value), IndexedDBKey(key), |
| 72 put_mode, callbacks, idb_object_store_id_, transaction, &ec); | 94 put_mode, callbacks, idb_object_store_id_, transaction, |
| 95 indexNames, indexKeys, &ec); |
| 73 } | 96 } |
| 74 | 97 |
| 75 void RendererWebIDBObjectStoreImpl::deleteFunction( | 98 void RendererWebIDBObjectStoreImpl::deleteFunction( |
| 76 const WebIDBKeyRange& key_range, | 99 const WebIDBKeyRange& key_range, |
| 77 WebIDBCallbacks* callbacks, | 100 WebIDBCallbacks* callbacks, |
| 78 const WebIDBTransaction& transaction, | 101 const WebIDBTransaction& transaction, |
| 79 WebExceptionCode& ec) { | 102 WebExceptionCode& ec) { |
| 80 IndexedDBDispatcher* dispatcher = | 103 IndexedDBDispatcher* dispatcher = |
| 81 IndexedDBDispatcher::ThreadSpecificInstance(); | 104 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 82 dispatcher->RequestIDBObjectStoreDelete( | 105 dispatcher->RequestIDBObjectStoreDelete( |
| 83 content::IndexedDBKeyRange(key_range), callbacks, idb_object_store_id_, | 106 IndexedDBKeyRange(key_range), callbacks, idb_object_store_id_, |
| 84 transaction, &ec); | 107 transaction, &ec); |
| 85 } | 108 } |
| 86 | 109 |
| 87 void RendererWebIDBObjectStoreImpl::clear( | 110 void RendererWebIDBObjectStoreImpl::clear( |
| 88 WebIDBCallbacks* callbacks, | 111 WebIDBCallbacks* callbacks, |
| 89 const WebIDBTransaction& transaction, | 112 const WebIDBTransaction& transaction, |
| 90 WebExceptionCode& ec) { | 113 WebExceptionCode& ec) { |
| 91 IndexedDBDispatcher* dispatcher = | 114 IndexedDBDispatcher* dispatcher = |
| 92 IndexedDBDispatcher::ThreadSpecificInstance(); | 115 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 93 dispatcher->RequestIDBObjectStoreClear( | 116 dispatcher->RequestIDBObjectStoreClear( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 const WebIDBKeyRange& idb_key_range, | 178 const WebIDBKeyRange& idb_key_range, |
| 156 WebIDBCallbacks* callbacks, | 179 WebIDBCallbacks* callbacks, |
| 157 const WebIDBTransaction& transaction, | 180 const WebIDBTransaction& transaction, |
| 158 WebExceptionCode& ec) { | 181 WebExceptionCode& ec) { |
| 159 IndexedDBDispatcher* dispatcher = | 182 IndexedDBDispatcher* dispatcher = |
| 160 IndexedDBDispatcher::ThreadSpecificInstance(); | 183 IndexedDBDispatcher::ThreadSpecificInstance(); |
| 161 dispatcher->RequestIDBObjectStoreCount( | 184 dispatcher->RequestIDBObjectStoreCount( |
| 162 idb_key_range, callbacks, idb_object_store_id_, | 185 idb_key_range, callbacks, idb_object_store_id_, |
| 163 transaction, &ec); | 186 transaction, &ec); |
| 164 } | 187 } |
| OLD | NEW |