| 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 19 matching lines...) Expand all Loading... |
| 30 virtual ~RendererWebIDBCursorImpl(); | 30 virtual ~RendererWebIDBCursorImpl(); |
| 31 | 31 |
| 32 virtual void advance(unsigned long count, blink::WebIDBCallbacks* callback); | 32 virtual void advance(unsigned long count, blink::WebIDBCallbacks* callback); |
| 33 virtual void continueFunction(const blink::WebIDBKey& key, | 33 virtual void continueFunction(const blink::WebIDBKey& key, |
| 34 blink::WebIDBCallbacks* callback); | 34 blink::WebIDBCallbacks* callback); |
| 35 virtual void continueFunction(const blink::WebIDBKey& key, | 35 virtual void continueFunction(const blink::WebIDBKey& key, |
| 36 const blink::WebIDBKey& primary_key, | 36 const blink::WebIDBKey& primary_key, |
| 37 blink::WebIDBCallbacks* callback); | 37 blink::WebIDBCallbacks* callback); |
| 38 virtual void postSuccessHandlerCallback(); | 38 virtual void postSuccessHandlerCallback(); |
| 39 | 39 |
| 40 void SetPrefetchData(const std::vector<IndexedDBKey>& keys, | 40 void SetPrefetchData( |
| 41 const std::vector<IndexedDBKey>& primary_keys, | 41 const std::vector<IndexedDBKey>& keys, |
| 42 const std::vector<blink::WebData>& values); | 42 const std::vector<IndexedDBKey>& primary_keys, |
| 43 const std::vector<blink::WebData>& values, |
| 44 const std::vector<blink::WebVector<blink::WebBlobInfo> >& blob_info); |
| 43 | 45 |
| 44 void CachedContinue(blink::WebIDBCallbacks* callbacks); | 46 void CachedContinue(blink::WebIDBCallbacks* callbacks); |
| 45 void ResetPrefetchCache(); | 47 void ResetPrefetchCache(); |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 FRIEND_TEST_ALL_PREFIXES(RendererWebIDBCursorImplTest, PrefetchTest); | 50 FRIEND_TEST_ALL_PREFIXES(RendererWebIDBCursorImplTest, PrefetchTest); |
| 49 | 51 |
| 50 int32 ipc_cursor_id_; | 52 int32 ipc_cursor_id_; |
| 51 | 53 |
| 52 // Prefetch cache. | 54 // Prefetch cache. |
| 53 std::deque<IndexedDBKey> prefetch_keys_; | 55 std::deque<IndexedDBKey> prefetch_keys_; |
| 54 std::deque<IndexedDBKey> prefetch_primary_keys_; | 56 std::deque<IndexedDBKey> prefetch_primary_keys_; |
| 55 std::deque<blink::WebData> prefetch_values_; | 57 std::deque<blink::WebData> prefetch_values_; |
| 58 std::deque<blink::WebVector<blink::WebBlobInfo> > prefetch_blob_info_; |
| 56 | 59 |
| 57 // Number of continue calls that would qualify for a pre-fetch. | 60 // Number of continue calls that would qualify for a pre-fetch. |
| 58 int continue_count_; | 61 int continue_count_; |
| 59 | 62 |
| 60 // Number of items used from the last prefetch. | 63 // Number of items used from the last prefetch. |
| 61 int used_prefetches_; | 64 int used_prefetches_; |
| 62 | 65 |
| 63 // Number of onsuccess handlers we are waiting for. | 66 // Number of onsuccess handlers we are waiting for. |
| 64 int pending_onsuccess_callbacks_; | 67 int pending_onsuccess_callbacks_; |
| 65 | 68 |
| 66 // Number of items to request in next prefetch. | 69 // Number of items to request in next prefetch. |
| 67 int prefetch_amount_; | 70 int prefetch_amount_; |
| 68 | 71 |
| 69 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 72 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 70 | 73 |
| 71 enum { kInvalidCursorId = -1 }; | 74 enum { kInvalidCursorId = -1 }; |
| 72 enum { kPrefetchContinueThreshold = 2 }; | 75 enum { kPrefetchContinueThreshold = 2 }; |
| 73 enum { kMinPrefetchAmount = 5 }; | 76 enum { kMinPrefetchAmount = 5 }; |
| 74 enum { kMaxPrefetchAmount = 100 }; | 77 enum { kMaxPrefetchAmount = 100 }; |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 } // namespace content | 80 } // namespace content |
| 78 | 81 |
| 79 #endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 82 #endif // CONTENT_CHILD_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
| OLD | NEW |