OLD | NEW |
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 #ifndef CONTENT_COMMON_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 5 #ifndef CONTENT_COMMON_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
6 #define CONTENT_COMMON_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 6 #define CONTENT_COMMON_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual void advance(unsigned long count, | 25 virtual void advance(unsigned long count, |
26 WebKit::WebIDBCallbacks* callback, | 26 WebKit::WebIDBCallbacks* callback, |
27 WebKit::WebExceptionCode& ec); | 27 WebKit::WebExceptionCode& ec); |
28 virtual void continueFunction(const WebKit::WebIDBKey& key, | 28 virtual void continueFunction(const WebKit::WebIDBKey& key, |
29 WebKit::WebIDBCallbacks* callback, | 29 WebKit::WebIDBCallbacks* callback, |
30 WebKit::WebExceptionCode& ec); | 30 WebKit::WebExceptionCode& ec); |
31 virtual void deleteFunction(WebKit::WebIDBCallbacks* callback, | 31 virtual void deleteFunction(WebKit::WebIDBCallbacks* callback, |
32 WebKit::WebExceptionCode& ec); | 32 WebKit::WebExceptionCode& ec); |
33 virtual void postSuccessHandlerCallback(); | 33 virtual void postSuccessHandlerCallback(); |
34 | 34 |
| 35 void SetPrefetchDataOld( |
| 36 const std::vector<IndexedDBKey>& keys, |
| 37 const std::vector<IndexedDBKey>& primary_keys, |
| 38 const std::vector<SerializedScriptValue>& values); |
35 void SetPrefetchData( | 39 void SetPrefetchData( |
36 const std::vector<IndexedDBKey>& keys, | 40 const std::vector<IndexedDBKey>& keys, |
37 const std::vector<IndexedDBKey>& primary_keys, | 41 const std::vector<IndexedDBKey>& primary_keys, |
38 const std::vector<SerializedScriptValue>& values); | 42 const std::vector<WebKit::WebData>& values); |
39 | 43 |
40 void CachedContinue(WebKit::WebIDBCallbacks* callbacks); | 44 void CachedContinue(WebKit::WebIDBCallbacks* callbacks); |
| 45 void CachedContinueOld(WebKit::WebIDBCallbacks* callbacks); |
41 void ResetPrefetchCache(); | 46 void ResetPrefetchCache(); |
42 | 47 |
43 private: | 48 private: |
44 int32 ipc_cursor_id_; | 49 int32 ipc_cursor_id_; |
45 | 50 |
46 // Prefetch cache. | 51 // Prefetch cache. |
47 std::deque<IndexedDBKey> prefetch_keys_; | 52 std::deque<IndexedDBKey> prefetch_keys_; |
48 std::deque<IndexedDBKey> prefetch_primary_keys_; | 53 std::deque<IndexedDBKey> prefetch_primary_keys_; |
49 std::deque<SerializedScriptValue> prefetch_values_; | 54 std::deque<WebKit::WebData> prefetch_values_; |
50 | 55 |
51 // Number of continue calls that would qualify for a pre-fetch. | 56 // Number of continue calls that would qualify for a pre-fetch. |
52 int continue_count_; | 57 int continue_count_; |
53 | 58 |
54 // Number of items used from the last prefetch. | 59 // Number of items used from the last prefetch. |
55 int used_prefetches_; | 60 int used_prefetches_; |
56 | 61 |
57 // Number of onsuccess handlers we are waiting for. | 62 // Number of onsuccess handlers we are waiting for. |
58 int pending_onsuccess_callbacks_; | 63 int pending_onsuccess_callbacks_; |
59 | 64 |
60 // Number of items to request in next prefetch. | 65 // Number of items to request in next prefetch. |
61 int prefetch_amount_; | 66 int prefetch_amount_; |
62 | 67 |
63 enum { kPrefetchContinueThreshold = 2 }; | 68 enum { kPrefetchContinueThreshold = 2 }; |
64 enum { kMinPrefetchAmount = 5 }; | 69 enum { kMinPrefetchAmount = 5 }; |
65 enum { kMaxPrefetchAmount = 100 }; | 70 enum { kMaxPrefetchAmount = 100 }; |
66 }; | 71 }; |
67 | 72 |
68 } // namespace content | 73 } // namespace content |
69 | 74 |
70 #endif // CONTENT_COMMON_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ | 75 #endif // CONTENT_COMMON_INDEXED_DB_PROXY_WEBIDBCURSOR_IMPL_H_ |
OLD | NEW |