| 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 // This is the interface of a simulated infinite cache. The purpose of this | 5 // This is the interface of a simulated infinite cache. The purpose of this |
| 6 // code is to evaluate the performance of an HTTP cache that is not constrained | 6 // code is to evaluate the performance of an HTTP cache that is not constrained |
| 7 // to evict resources. | 7 // to evict resources. |
| 8 | 8 |
| 9 #ifndef NET_HTTP_INFINITE_CACHE_H_ | 9 #ifndef NET_HTTP_INFINITE_CACHE_H_ |
| 10 #define NET_HTTP_INFINITE_CACHE_H_ | 10 #define NET_HTTP_INFINITE_CACHE_H_ |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void OnResponseReceived(const HttpResponseInfo* response); | 47 void OnResponseReceived(const HttpResponseInfo* response); |
| 48 | 48 |
| 49 // Called when the response data is received from the network. | 49 // Called when the response data is received from the network. |
| 50 void OnDataRead(const char* data, int data_len); | 50 void OnDataRead(const char* data, int data_len); |
| 51 | 51 |
| 52 // Called when the resource is marked as truncated by the HttpCache. | 52 // Called when the resource is marked as truncated by the HttpCache. |
| 53 void OnTruncatedResponse(); | 53 void OnTruncatedResponse(); |
| 54 | 54 |
| 55 // Called when the resource is served from the cache, so OnDataRead will not | 55 // Called when the resource is served from the cache, so OnDataRead will not |
| 56 // be called for this request. | 56 // be called for this request. |
| 57 void OnServedFromCache(); | 57 void OnServedFromCache(const HttpResponseInfo* response); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 friend class InfiniteCache; | 60 friend class InfiniteCache; |
| 61 struct ResourceData; | 61 struct ResourceData; |
| 62 void Finish(); | 62 void Finish(); |
| 63 | 63 |
| 64 base::WeakPtr<InfiniteCache> cache_; | 64 base::WeakPtr<InfiniteCache> cache_; |
| 65 scoped_ptr<ResourceData> resource_data_; | 65 scoped_ptr<ResourceData> resource_data_; |
| 66 bool must_doom_entry_; | 66 bool must_doom_entry_; |
| 67 DISALLOW_COPY_AND_ASSIGN(InfiniteCacheTransaction); | 67 DISALLOW_COPY_AND_ASSIGN(InfiniteCacheTransaction); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 111 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
| 112 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 112 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 113 base::RepeatingTimer<InfiniteCache> timer_; | 113 base::RepeatingTimer<InfiniteCache> timer_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(InfiniteCache); | 115 DISALLOW_COPY_AND_ASSIGN(InfiniteCache); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace net | 118 } // namespace net |
| 119 | 119 |
| 120 #endif // NET_HTTP_INFINITE_CACHE_H_ | 120 #endif // NET_HTTP_INFINITE_CACHE_H_ |
| OLD | NEW |