| 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 #ifndef CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 5 #ifndef CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
| 6 #define CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 6 #define CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 virtual ~WebIDBCursorImpl(); | 31 virtual ~WebIDBCursorImpl(); |
| 32 | 32 |
| 33 virtual void advance(unsigned long count, blink::WebIDBCallbacks* callback); | 33 virtual void advance(unsigned long count, blink::WebIDBCallbacks* callback); |
| 34 virtual void continueFunction(const blink::WebIDBKey& key, | 34 virtual void continueFunction(const blink::WebIDBKey& key, |
| 35 blink::WebIDBCallbacks* callback); | 35 blink::WebIDBCallbacks* callback); |
| 36 virtual void continueFunction(const blink::WebIDBKey& key, | 36 virtual void continueFunction(const blink::WebIDBKey& key, |
| 37 const blink::WebIDBKey& primary_key, | 37 const blink::WebIDBKey& primary_key, |
| 38 blink::WebIDBCallbacks* callback); | 38 blink::WebIDBCallbacks* callback); |
| 39 virtual void postSuccessHandlerCallback(); | 39 virtual void postSuccessHandlerCallback(); |
| 40 | 40 |
| 41 void SetPrefetchData(const std::vector<IndexedDBKey>& keys, | 41 void SetPrefetchData( |
| 42 const std::vector<IndexedDBKey>& primary_keys, | 42 const std::vector<IndexedDBKey>& keys, |
| 43 const std::vector<blink::WebData>& values); | 43 const std::vector<IndexedDBKey>& primary_keys, |
| 44 const std::vector<blink::WebData>& values, |
| 45 const std::vector<blink::WebVector<blink::WebBlobInfo> >& blob_info); |
| 44 | 46 |
| 45 void CachedAdvance(unsigned long count, blink::WebIDBCallbacks* callbacks); | 47 void CachedAdvance(unsigned long count, blink::WebIDBCallbacks* callbacks); |
| 46 void CachedContinue(blink::WebIDBCallbacks* callbacks); | 48 void CachedContinue(blink::WebIDBCallbacks* callbacks); |
| 47 | 49 |
| 48 // This method is virtual so it can be overridden in unit tests. | 50 // This method is virtual so it can be overridden in unit tests. |
| 49 virtual void ResetPrefetchCache(); | 51 virtual void ResetPrefetchCache(); |
| 50 | 52 |
| 51 int64 transaction_id() const { return transaction_id_; } | 53 int64 transaction_id() const { return transaction_id_; } |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, CursorReset); | 56 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, CursorReset); |
| 55 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, CursorTransactionId); | 57 FRIEND_TEST_ALL_PREFIXES(IndexedDBDispatcherTest, CursorTransactionId); |
| 56 FRIEND_TEST_ALL_PREFIXES(WebIDBCursorImplTest, AdvancePrefetchTest); | 58 FRIEND_TEST_ALL_PREFIXES(WebIDBCursorImplTest, AdvancePrefetchTest); |
| 57 FRIEND_TEST_ALL_PREFIXES(WebIDBCursorImplTest, PrefetchReset); | 59 FRIEND_TEST_ALL_PREFIXES(WebIDBCursorImplTest, PrefetchReset); |
| 58 FRIEND_TEST_ALL_PREFIXES(WebIDBCursorImplTest, PrefetchTest); | 60 FRIEND_TEST_ALL_PREFIXES(WebIDBCursorImplTest, PrefetchTest); |
| 59 | 61 |
| 60 int32 ipc_cursor_id_; | 62 int32 ipc_cursor_id_; |
| 61 int64 transaction_id_; | 63 int64 transaction_id_; |
| 62 | 64 |
| 63 // Prefetch cache. | 65 // Prefetch cache. |
| 64 std::deque<IndexedDBKey> prefetch_keys_; | 66 std::deque<IndexedDBKey> prefetch_keys_; |
| 65 std::deque<IndexedDBKey> prefetch_primary_keys_; | 67 std::deque<IndexedDBKey> prefetch_primary_keys_; |
| 66 std::deque<blink::WebData> prefetch_values_; | 68 std::deque<blink::WebData> prefetch_values_; |
| 69 std::deque<blink::WebVector<blink::WebBlobInfo> > prefetch_blob_info_; |
| 67 | 70 |
| 68 // Number of continue calls that would qualify for a pre-fetch. | 71 // Number of continue calls that would qualify for a pre-fetch. |
| 69 int continue_count_; | 72 int continue_count_; |
| 70 | 73 |
| 71 // Number of items used from the last prefetch. | 74 // Number of items used from the last prefetch. |
| 72 int used_prefetches_; | 75 int used_prefetches_; |
| 73 | 76 |
| 74 // Number of onsuccess handlers we are waiting for. | 77 // Number of onsuccess handlers we are waiting for. |
| 75 int pending_onsuccess_callbacks_; | 78 int pending_onsuccess_callbacks_; |
| 76 | 79 |
| 77 // Number of items to request in next prefetch. | 80 // Number of items to request in next prefetch. |
| 78 int prefetch_amount_; | 81 int prefetch_amount_; |
| 79 | 82 |
| 80 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 83 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 81 | 84 |
| 82 enum { kInvalidCursorId = -1 }; | 85 enum { kInvalidCursorId = -1 }; |
| 83 enum { kPrefetchContinueThreshold = 2 }; | 86 enum { kPrefetchContinueThreshold = 2 }; |
| 84 enum { kMinPrefetchAmount = 5 }; | 87 enum { kMinPrefetchAmount = 5 }; |
| 85 enum { kMaxPrefetchAmount = 100 }; | 88 enum { kMaxPrefetchAmount = 100 }; |
| 86 }; | 89 }; |
| 87 | 90 |
| 88 } // namespace content | 91 } // namespace content |
| 89 | 92 |
| 90 #endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 93 #endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
| OLD | NEW |