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

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

Issue 18346006: Update OS X to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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 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/proxy_webidbcursor_impl.h" 5 #include "content/child/indexed_db/proxy_webidbcursor_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "content/child/thread_safe_sender.h" 9 #include "content/child/thread_safe_sender.h"
10 #include "content/child/indexed_db/indexed_db_dispatcher.h" 10 #include "content/child/indexed_db/indexed_db_dispatcher.h"
(...skipping 20 matching lines...) Expand all
31 // object since inside WebKit, they hold a reference to the object which owns 31 // object since inside WebKit, they hold a reference to the object which owns
32 // this object. But, if that ever changed, then we'd need to invalidate 32 // this object. But, if that ever changed, then we'd need to invalidate
33 // any such pointers. 33 // any such pointers.
34 34
35 if (ipc_cursor_id_ != kInvalidCursorId) { 35 if (ipc_cursor_id_ != kInvalidCursorId) {
36 // Invalid ID used in tests to avoid really sending this message. 36 // Invalid ID used in tests to avoid really sending this message.
37 thread_safe_sender_->Send( 37 thread_safe_sender_->Send(
38 new IndexedDBHostMsg_CursorDestroyed(ipc_cursor_id_)); 38 new IndexedDBHostMsg_CursorDestroyed(ipc_cursor_id_));
39 } 39 }
40 IndexedDBDispatcher* dispatcher = 40 IndexedDBDispatcher* dispatcher =
41 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); 41 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
42 dispatcher->CursorDestroyed(ipc_cursor_id_); 42 dispatcher->CursorDestroyed(ipc_cursor_id_);
43 } 43 }
44 44
45 void RendererWebIDBCursorImpl::advance(unsigned long count, 45 void RendererWebIDBCursorImpl::advance(unsigned long count,
46 WebIDBCallbacks* callbacks_ptr) { 46 WebIDBCallbacks* callbacks_ptr) {
47 IndexedDBDispatcher* dispatcher = 47 IndexedDBDispatcher* dispatcher =
48 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); 48 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
49 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 49 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
50 ResetPrefetchCache(); 50 ResetPrefetchCache();
51 dispatcher->RequestIDBCursorAdvance( 51 dispatcher->RequestIDBCursorAdvance(
52 count, callbacks.release(), ipc_cursor_id_); 52 count, callbacks.release(), ipc_cursor_id_);
53 } 53 }
54 54
55 void RendererWebIDBCursorImpl::continueFunction( 55 void RendererWebIDBCursorImpl::continueFunction(
56 const WebIDBKey& key, 56 const WebIDBKey& key,
57 WebIDBCallbacks* callbacks_ptr) { 57 WebIDBCallbacks* callbacks_ptr) {
58 IndexedDBDispatcher* dispatcher = 58 IndexedDBDispatcher* dispatcher =
59 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); 59 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
60 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 60 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
61 61
62 if (key.type() == WebIDBKey::NullType) { 62 if (key.type() == WebIDBKey::NullType) {
63 // No key, so this would qualify for a prefetch. 63 // No key, so this would qualify for a prefetch.
64 ++continue_count_; 64 ++continue_count_;
65 65
66 if (!prefetch_keys_.empty()) { 66 if (!prefetch_keys_.empty()) {
67 // We have a prefetch cache, so serve the result from that. 67 // We have a prefetch cache, so serve the result from that.
68 CachedContinue(callbacks.get()); 68 CachedContinue(callbacks.get());
69 return; 69 return;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 void RendererWebIDBCursorImpl::ResetPrefetchCache() { 140 void RendererWebIDBCursorImpl::ResetPrefetchCache() {
141 continue_count_ = 0; 141 continue_count_ = 0;
142 prefetch_amount_ = kMinPrefetchAmount; 142 prefetch_amount_ = kMinPrefetchAmount;
143 143
144 if (!prefetch_keys_.size()) { 144 if (!prefetch_keys_.size()) {
145 // No prefetch cache, so no need to reset the cursor in the back-end. 145 // No prefetch cache, so no need to reset the cursor in the back-end.
146 return; 146 return;
147 } 147 }
148 148
149 IndexedDBDispatcher* dispatcher = 149 IndexedDBDispatcher* dispatcher =
150 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_); 150 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get());
151 dispatcher->RequestIDBCursorPrefetchReset( 151 dispatcher->RequestIDBCursorPrefetchReset(
152 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_); 152 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_);
153 prefetch_keys_.clear(); 153 prefetch_keys_.clear();
154 prefetch_primary_keys_.clear(); 154 prefetch_primary_keys_.clear();
155 prefetch_values_.clear(); 155 prefetch_values_.clear();
156 156
157 pending_onsuccess_callbacks_ = 0; 157 pending_onsuccess_callbacks_ = 0;
158 } 158 }
159 159
160 } // namespace content 160 } // namespace content
OLDNEW
« no previous file with comments | « content/child/indexed_db/indexed_db_message_filter.cc ('k') | content/child/indexed_db/proxy_webidbcursor_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698