| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/indexed_db/webidbdatabase_impl.h" | 5 #include "content/child/indexed_db/webidbdatabase_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "content/child/indexed_db/indexed_db_dispatcher.h" | 12 #include "content/child/indexed_db/indexed_db_dispatcher.h" |
| 13 #include "content/child/indexed_db/indexed_db_key_builders.h" | 13 #include "content/child/indexed_db/indexed_db_key_builders.h" |
| 14 #include "content/child/thread_safe_sender.h" | 14 #include "content/child/thread_safe_sender.h" |
| 15 #include "content/child/worker_thread_registry.h" | 15 #include "content/child/worker_thread_registry.h" |
| 16 #include "content/common/indexed_db/indexed_db_messages.h" | 16 #include "content/common/indexed_db/indexed_db_messages.h" |
| 17 #include "third_party/WebKit/public/platform/WebBlobInfo.h" | 17 #include "third_party/WebKit/public/platform/WebBlobInfo.h" |
| 18 #include "third_party/WebKit/public/platform/WebString.h" | 18 #include "third_party/WebKit/public/platform/WebString.h" |
| 19 #include "third_party/WebKit/public/platform/WebVector.h" | 19 #include "third_party/WebKit/public/platform/WebVector.h" |
| 20 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h" | 20 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBKeyPath.h" |
| 21 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h" | 21 #include "third_party/WebKit/public/platform/modules/indexeddb/WebIDBMetadata.h" |
| 22 // #include "third_party/WebKit/Source/modules/indexeddb/IDBObserver.h" |
| 22 | 23 |
| 24 using blink::IDBObserver; |
| 23 using blink::WebBlobInfo; | 25 using blink::WebBlobInfo; |
| 24 using blink::WebIDBCallbacks; | 26 using blink::WebIDBCallbacks; |
| 25 using blink::WebIDBCursor; | 27 using blink::WebIDBCursor; |
| 26 using blink::WebIDBDatabase; | 28 using blink::WebIDBDatabase; |
| 27 using blink::WebIDBDatabaseCallbacks; | 29 using blink::WebIDBDatabaseCallbacks; |
| 28 using blink::WebIDBMetadata; | 30 using blink::WebIDBMetadata; |
| 29 using blink::WebIDBKey; | 31 using blink::WebIDBKey; |
| 30 using blink::WebIDBKeyPath; | 32 using blink::WebIDBKeyPath; |
| 31 using blink::WebIDBKeyRange; | 33 using blink::WebIDBKeyRange; |
| 32 using blink::WebString; | 34 using blink::WebString; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, | 95 dispatcher->RequestIDBDatabaseClose(ipc_database_id_, |
| 94 ipc_database_callbacks_id_); | 96 ipc_database_callbacks_id_); |
| 95 } | 97 } |
| 96 | 98 |
| 97 void WebIDBDatabaseImpl::versionChangeIgnored() { | 99 void WebIDBDatabaseImpl::versionChangeIgnored() { |
| 98 IndexedDBDispatcher* dispatcher = | 100 IndexedDBDispatcher* dispatcher = |
| 99 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 101 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 100 dispatcher->NotifyIDBDatabaseVersionChangeIgnored(ipc_database_id_); | 102 dispatcher->NotifyIDBDatabaseVersionChangeIgnored(ipc_database_id_); |
| 101 } | 103 } |
| 102 | 104 |
| 105 void WebIDBDatabaseImpl::observe(blink::IDBObserver* observer, |
| 106 long long transaction_id) { |
| 107 IndexedDBDispatcher* dispatcher = |
| 108 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 109 int32_t observer_id = |
| 110 dispatcher->AddIDBObserver(ipc_database_id_, transaction_id, observer); |
| 111 observers_id_.push_back(observer_id); |
| 112 } |
| 113 |
| 114 void WebIDBDatabaseImpl::unobserve(blink::IDBObserver* observer) { |
| 115 IndexedDBDispatcher* dispatcher = |
| 116 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 117 std::vector<int32_t> remove_observers = |
| 118 dispatcher->RemoveIDBObserver(ipc_database_id_, observer); |
| 119 // TODO(palakj): Remove id from observes_id_ |
| 120 } |
| 121 |
| 103 void WebIDBDatabaseImpl::get(long long transaction_id, | 122 void WebIDBDatabaseImpl::get(long long transaction_id, |
| 104 long long object_store_id, | 123 long long object_store_id, |
| 105 long long index_id, | 124 long long index_id, |
| 106 const WebIDBKeyRange& key_range, | 125 const WebIDBKeyRange& key_range, |
| 107 bool key_only, | 126 bool key_only, |
| 108 WebIDBCallbacks* callbacks) { | 127 WebIDBCallbacks* callbacks) { |
| 109 IndexedDBDispatcher* dispatcher = | 128 IndexedDBDispatcher* dispatcher = |
| 110 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 129 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 111 dispatcher->RequestIDBDatabaseGet(ipc_database_id_, | 130 dispatcher->RequestIDBDatabaseGet(ipc_database_id_, |
| 112 transaction_id, | 131 transaction_id, |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 310 |
| 292 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { | 311 void WebIDBDatabaseImpl::ackReceivedBlobs(const WebVector<WebString>& uuids) { |
| 293 DCHECK(uuids.size()); | 312 DCHECK(uuids.size()); |
| 294 std::vector<std::string> param(uuids.size()); | 313 std::vector<std::string> param(uuids.size()); |
| 295 for (size_t i = 0; i < uuids.size(); ++i) | 314 for (size_t i = 0; i < uuids.size(); ++i) |
| 296 param[i] = uuids[i].latin1().data(); | 315 param[i] = uuids[i].latin1().data(); |
| 297 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); | 316 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(param)); |
| 298 } | 317 } |
| 299 | 318 |
| 300 } // namespace content | 319 } // namespace content |
| OLD | NEW |