| 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/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" |
| 11 #include "content/child/indexed_db/indexed_db_key_builders.h" | 11 #include "content/child/indexed_db/indexed_db_key_builders.h" |
| 12 #include "content/common/indexed_db/indexed_db_messages.h" | 12 #include "content/common/indexed_db/indexed_db_messages.h" |
| 13 | 13 |
| 14 using WebKit::WebData; | 14 using blink::WebData; |
| 15 using WebKit::WebIDBCallbacks; | 15 using blink::WebIDBCallbacks; |
| 16 using WebKit::WebIDBKey; | 16 using blink::WebIDBKey; |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 RendererWebIDBCursorImpl::RendererWebIDBCursorImpl( | 20 RendererWebIDBCursorImpl::RendererWebIDBCursorImpl( |
| 21 int32 ipc_cursor_id, | 21 int32 ipc_cursor_id, |
| 22 ThreadSafeSender* thread_safe_sender) | 22 ThreadSafeSender* thread_safe_sender) |
| 23 : ipc_cursor_id_(ipc_cursor_id), | 23 : ipc_cursor_id_(ipc_cursor_id), |
| 24 continue_count_(0), | 24 continue_count_(0), |
| 25 used_prefetches_(0), | 25 used_prefetches_(0), |
| 26 pending_onsuccess_callbacks_(0), | 26 pending_onsuccess_callbacks_(0), |
| (...skipping 26 matching lines...) Expand all Loading... |
| 53 count, callbacks.release(), ipc_cursor_id_); | 53 count, callbacks.release(), ipc_cursor_id_); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void RendererWebIDBCursorImpl::continueFunction( | 56 void RendererWebIDBCursorImpl::continueFunction( |
| 57 const WebIDBKey& key, | 57 const WebIDBKey& key, |
| 58 WebIDBCallbacks* callbacks_ptr) { | 58 WebIDBCallbacks* callbacks_ptr) { |
| 59 IndexedDBDispatcher* dispatcher = | 59 IndexedDBDispatcher* dispatcher = |
| 60 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); | 60 IndexedDBDispatcher::ThreadSpecificInstance(thread_safe_sender_.get()); |
| 61 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); | 61 scoped_ptr<WebIDBCallbacks> callbacks(callbacks_ptr); |
| 62 | 62 |
| 63 if (key.keyType() == WebKit::WebIDBKeyTypeNull) { | 63 if (key.keyType() == blink::WebIDBKeyTypeNull) { |
| 64 // No key, so this would qualify for a prefetch. | 64 // No key, so this would qualify for a prefetch. |
| 65 ++continue_count_; | 65 ++continue_count_; |
| 66 | 66 |
| 67 if (!prefetch_keys_.empty()) { | 67 if (!prefetch_keys_.empty()) { |
| 68 // We have a prefetch cache, so serve the result from that. | 68 // We have a prefetch cache, so serve the result from that. |
| 69 CachedContinue(callbacks.get()); | 69 CachedContinue(callbacks.get()); |
| 70 return; | 70 return; |
| 71 } | 71 } |
| 72 | 72 |
| 73 if (continue_count_ > kPrefetchContinueThreshold) { | 73 if (continue_count_ > kPrefetchContinueThreshold) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 dispatcher->RequestIDBCursorPrefetchReset( | 152 dispatcher->RequestIDBCursorPrefetchReset( |
| 153 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_); | 153 used_prefetches_, prefetch_keys_.size(), ipc_cursor_id_); |
| 154 prefetch_keys_.clear(); | 154 prefetch_keys_.clear(); |
| 155 prefetch_primary_keys_.clear(); | 155 prefetch_primary_keys_.clear(); |
| 156 prefetch_values_.clear(); | 156 prefetch_values_.clear(); |
| 157 | 157 |
| 158 pending_onsuccess_callbacks_ = 0; | 158 pending_onsuccess_callbacks_ = 0; |
| 159 } | 159 } |
| 160 | 160 |
| 161 } // namespace content | 161 } // namespace content |
| OLD | NEW |