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

Side by Side Diff: content/child/indexed_db/webidbcursor_impl.cc

Issue 924033003: IndexedDB: Ensure that blobs in unused prefetches are acked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tweak store name Created 5 years, 10 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
OLDNEW
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 <string>
7 #include <vector> 8 #include <vector>
8 9
9 #include "content/child/indexed_db/indexed_db_dispatcher.h" 10 #include "content/child/indexed_db/indexed_db_dispatcher.h"
10 #include "content/child/indexed_db/indexed_db_key_builders.h" 11 #include "content/child/indexed_db/indexed_db_key_builders.h"
11 #include "content/child/thread_safe_sender.h" 12 #include "content/child/thread_safe_sender.h"
12 #include "content/common/indexed_db/indexed_db_messages.h" 13 #include "content/common/indexed_db/indexed_db_messages.h"
13 14
14 using blink::WebData; 15 using blink::WebData;
15 using blink::WebIDBCallbacks; 16 using blink::WebIDBCallbacks;
16 using blink::WebIDBKey; 17 using blink::WebIDBKey;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 188
188 void WebIDBCursorImpl::ResetPrefetchCache() { 189 void WebIDBCursorImpl::ResetPrefetchCache() {
189 continue_count_ = 0; 190 continue_count_ = 0;
190 prefetch_amount_ = kMinPrefetchAmount; 191 prefetch_amount_ = kMinPrefetchAmount;
191 192
192 if (!prefetch_keys_.size()) { 193 if (!prefetch_keys_.size()) {
193 // No prefetch cache, so no need to reset the cursor in the back-end. 194 // No prefetch cache, so no need to reset the cursor in the back-end.
194 return; 195 return;
195 } 196 }
196 197
198 // Ack any unused blobs.
199 std::vector<std::string> uuids;
200 for (const auto& blobs : prefetch_blob_info_) {
201 for (size_t i = 0, size = blobs.size(); i < size; ++i)
202 uuids.push_back(blobs[i].uuid().latin1());
203 }
204 if (!uuids.empty())
205 thread_safe_sender_->Send(new IndexedDBHostMsg_AckReceivedBlobs(uuids));
206
207 // Reset the back-end cursor.
197 IndexedDBDispatcher* dispatcher = 208 IndexedDBDispatcher* dispatcher =
198 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); 209 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
199 dispatcher->RequestIDBCursorPrefetchReset( 210 dispatcher->RequestIDBCursorPrefetchReset(
200 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_); 211 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_);
212
213 // Reset the prefetch cache.
201 prefetch_keys_.clear(); 214 prefetch_keys_.clear();
202 prefetch_primary_keys_.clear(); 215 prefetch_primary_keys_.clear();
203 prefetch_values_.clear(); 216 prefetch_values_.clear();
204 prefetch_blob_info_.clear(); 217 prefetch_blob_info_.clear();
205 218
206 pending_onsuccess_callbacks_ = 0; 219 pending_onsuccess_callbacks_ = 0;
207 } 220 }
208 221
209 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/indexed_db/indexed_db_browsertest.cc ('k') | content/test/data/indexeddb/blob_did_ack_prefetch.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698