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