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

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

Issue 10831138: Remove a ton of IPC from landing putWithIndexKeys (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Additional stuff found with lint Created 8 years, 4 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 (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_webidbcursor_impl.h" 5 #include "content/common/indexed_db/proxy_webidbcursor_impl.h"
6 6
7 #include <vector>
8
7 #include "content/common/child_thread.h" 9 #include "content/common/child_thread.h"
8 #include "content/common/indexed_db/indexed_db_messages.h" 10 #include "content/common/indexed_db/indexed_db_messages.h"
9 #include "content/common/indexed_db/indexed_db_dispatcher.h" 11 #include "content/common/indexed_db/indexed_db_dispatcher.h"
10 12
11 using content::IndexedDBKey; 13 using content::IndexedDBKey;
12 using content::SerializedScriptValue; 14 using content::SerializedScriptValue;
13 using WebKit::WebExceptionCode; 15 using WebKit::WebExceptionCode;
14 using WebKit::WebIDBCallbacks; 16 using WebKit::WebIDBCallbacks;
15 using WebKit::WebIDBKey; 17 using WebKit::WebIDBKey;
16 using WebKit::WebSerializedScriptValue; 18 using WebKit::WebSerializedScriptValue;
(...skipping 23 matching lines...) Expand all
40 } 42 }
41 43
42 WebIDBKey RendererWebIDBCursorImpl::primaryKey() const { 44 WebIDBKey RendererWebIDBCursorImpl::primaryKey() const {
43 return primary_key_; 45 return primary_key_;
44 } 46 }
45 47
46 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const { 48 WebSerializedScriptValue RendererWebIDBCursorImpl::value() const {
47 return value_; 49 return value_;
48 } 50 }
49 51
50 void RendererWebIDBCursorImpl::update(const WebSerializedScriptValue& value,
51 WebIDBCallbacks* callbacks,
52 WebExceptionCode& ec) {
53 IndexedDBDispatcher* dispatcher =
54 IndexedDBDispatcher::ThreadSpecificInstance();
55 dispatcher->RequestIDBCursorUpdate(
56 SerializedScriptValue(value), callbacks, idb_cursor_id_, &ec);
57 }
58
59 void RendererWebIDBCursorImpl::advance(unsigned long count, 52 void RendererWebIDBCursorImpl::advance(unsigned long count,
60 WebIDBCallbacks* callbacks_ptr, 53 WebIDBCallbacks* callbacks_ptr,
61 WebExceptionCode& ec) { 54 WebExceptionCode& ec) {
62 IndexedDBDispatcher* dispatcher = 55 IndexedDBDispatcher* dispatcher =
63 IndexedDBDispatcher::ThreadSpecificInstance(); 56 IndexedDBDispatcher::ThreadSpecificInstance();
64 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); 57 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr);
65 ResetPrefetchCache(); 58 ResetPrefetchCache();
66 dispatcher->RequestIDBCursorAdvance(count, callbacks.release(), 59 dispatcher->RequestIDBCursorAdvance(count, callbacks.release(),
67 idb_cursor_id_, &ec); 60 idb_cursor_id_, &ec);
68 } 61 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 prefetch_keys_.assign(keys.begin(), keys.end()); 136 prefetch_keys_.assign(keys.begin(), keys.end());
144 prefetch_primary_keys_.assign(primary_keys.begin(), primary_keys.end()); 137 prefetch_primary_keys_.assign(primary_keys.begin(), primary_keys.end());
145 prefetch_values_.assign(values.begin(), values.end()); 138 prefetch_values_.assign(values.begin(), values.end());
146 139
147 used_prefetches_ = 0; 140 used_prefetches_ = 0;
148 pending_onsuccess_callbacks_ = 0; 141 pending_onsuccess_callbacks_ = 0;
149 } 142 }
150 143
151 void RendererWebIDBCursorImpl::CachedContinue( 144 void RendererWebIDBCursorImpl::CachedContinue(
152 WebKit::WebIDBCallbacks* callbacks) { 145 WebKit::WebIDBCallbacks* callbacks) {
153 DCHECK(prefetch_keys_.size() > 0); 146 DCHECK_GT(prefetch_keys_.size(), 0ul);
154 DCHECK(prefetch_primary_keys_.size() == prefetch_keys_.size()); 147 DCHECK(prefetch_primary_keys_.size() == prefetch_keys_.size());
155 DCHECK(prefetch_values_.size() == prefetch_keys_.size()); 148 DCHECK(prefetch_values_.size() == prefetch_keys_.size());
156 149
157 key_ = prefetch_keys_.front(); 150 key_ = prefetch_keys_.front();
158 primary_key_ = prefetch_primary_keys_.front(); 151 primary_key_ = prefetch_primary_keys_.front();
159 value_ = prefetch_values_.front(); 152 value_ = prefetch_values_.front();
160 153
161 prefetch_keys_.pop_front(); 154 prefetch_keys_.pop_front();
162 prefetch_primary_keys_.pop_front(); 155 prefetch_primary_keys_.pop_front();
163 prefetch_values_.pop_front(); 156 prefetch_values_.pop_front();
(...skipping 16 matching lines...) Expand all
180 IndexedDBDispatcher::ThreadSpecificInstance(); 173 IndexedDBDispatcher::ThreadSpecificInstance();
181 dispatcher->RequestIDBCursorPrefetchReset(used_prefetches_, 174 dispatcher->RequestIDBCursorPrefetchReset(used_prefetches_,
182 prefetch_keys_.size(), 175 prefetch_keys_.size(),
183 idb_cursor_id_); 176 idb_cursor_id_);
184 prefetch_keys_.clear(); 177 prefetch_keys_.clear();
185 prefetch_primary_keys_.clear(); 178 prefetch_primary_keys_.clear();
186 prefetch_values_.clear(); 179 prefetch_values_.clear();
187 180
188 pending_onsuccess_callbacks_ = 0; 181 pending_onsuccess_callbacks_ = 0;
189 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698