| 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/webidbcursor_impl.h" | 5 #include "content/child/indexed_db/webidbcursor_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> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 callbacks->onSuccess(WebIDBKeyBuilder::Build(key), | 181 callbacks->onSuccess(WebIDBKeyBuilder::Build(key), |
| 182 WebIDBKeyBuilder::Build(primary_key), value); | 182 WebIDBKeyBuilder::Build(primary_key), value); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void WebIDBCursorImpl::ResetPrefetchCache() { | 185 void WebIDBCursorImpl::ResetPrefetchCache() { |
| 186 continue_count_ = 0; | 186 continue_count_ = 0; |
| 187 prefetch_amount_ = kMinPrefetchAmount; | 187 prefetch_amount_ = kMinPrefetchAmount; |
| 188 | 188 |
| 189 if (!prefetch_keys_.size()) { | 189 if (prefetch_keys_.empty()) { |
| 190 // No prefetch cache, so no need to reset the cursor in the back-end. | 190 // No prefetch cache, so no need to reset the cursor in the back-end. |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Ack any unused blobs. | 194 // Ack any unused blobs. |
| 195 std::vector<std::string> uuids; | 195 std::vector<std::string> uuids; |
| 196 for (const auto& value : prefetch_values_) { | 196 for (const auto& value : prefetch_values_) { |
| 197 for (size_t i = 0, size = value.webBlobInfo.size(); i < size; ++i) | 197 for (size_t i = 0, size = value.webBlobInfo.size(); i < size; ++i) |
| 198 uuids.push_back(value.webBlobInfo[i].uuid().latin1()); | 198 uuids.push_back(value.webBlobInfo[i].uuid().latin1()); |
| 199 } | 199 } |
| 200 if (!uuids.empty()) | 200 if (!uuids.empty()) |
| 201 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(uuids)); | 201 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(uuids)); |
| 202 | 202 |
| 203 // Reset the back-end cursor. | 203 // Reset the back-end cursor. |
| 204 IndexedDBDispatcher* dispatcher = | 204 IndexedDBDispatcher* dispatcher = |
| 205 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 205 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 206 dispatcher->RequestIDBCursorPrefetchReset( | 206 dispatcher->RequestIDBCursorPrefetchReset( |
| 207 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_); | 207 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_); |
| 208 | 208 |
| 209 // Reset the prefetch cache. | 209 // Reset the prefetch cache. |
| 210 prefetch_keys_.clear(); | 210 prefetch_keys_.clear(); |
| 211 prefetch_primary_keys_.clear(); | 211 prefetch_primary_keys_.clear(); |
| 212 prefetch_values_.clear(); | 212 prefetch_values_.clear(); |
| 213 | 213 |
| 214 pending_onsuccess_callbacks_ = 0; | 214 pending_onsuccess_callbacks_ = 0; |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace content | 217 } // namespace content |
| OLD | NEW |