| 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_ |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/timer.h" | 17 #include "base/timer.h" |
| 18 #include "net/base/completion_callback.h" | 18 #include "net/base/completion_callback.h" |
| 19 #include "net/base/net_export.h" | 19 #include "net/base/net_export.h" |
| 20 | 20 |
| 21 namespace base { |
| 21 class FilePath; | 22 class FilePath; |
| 22 | |
| 23 namespace base { | |
| 24 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
| 25 class SequencedWorkerPool; | 24 class SequencedWorkerPool; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace net { | 27 namespace net { |
| 29 | 28 |
| 30 class HttpCache; | 29 class HttpCache; |
| 31 class HttpResponseInfo; | 30 class HttpResponseInfo; |
| 32 class InfiniteCache; | 31 class InfiniteCache; |
| 33 struct HttpRequestInfo; | 32 struct HttpRequestInfo; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // backend storage. | 72 // backend storage. |
| 74 class NET_EXPORT_PRIVATE InfiniteCache | 73 class NET_EXPORT_PRIVATE InfiniteCache |
| 75 : public base::SupportsWeakPtr<InfiniteCache> { | 74 : public base::SupportsWeakPtr<InfiniteCache> { |
| 76 public: | 75 public: |
| 77 InfiniteCache(); | 76 InfiniteCache(); |
| 78 ~InfiniteCache(); | 77 ~InfiniteCache(); |
| 79 | 78 |
| 80 // Initializes this object to start tracking requests. |path| is the location | 79 // Initializes this object to start tracking requests. |path| is the location |
| 81 // of the file to use to store data; it can be empty, in which case the data | 80 // of the file to use to store data; it can be empty, in which case the data |
| 82 // will not be persisted to disk. | 81 // will not be persisted to disk. |
| 83 void Init(const FilePath& path); | 82 void Init(const base::FilePath& path); |
| 84 | 83 |
| 85 InfiniteCacheTransaction* CreateInfiniteCacheTransaction(); | 84 InfiniteCacheTransaction* CreateInfiniteCacheTransaction(); |
| 86 | 85 |
| 87 // Removes all data for this experiment. Returns a net error code. | 86 // Removes all data for this experiment. Returns a net error code. |
| 88 int DeleteData(const CompletionCallback& callback); | 87 int DeleteData(const CompletionCallback& callback); |
| 89 | 88 |
| 90 // Removes requests between |initial_time| and |end_time|. | 89 // Removes requests between |initial_time| and |end_time|. |
| 91 int DeleteDataBetween(base::Time initial_time, | 90 int DeleteDataBetween(base::Time initial_time, |
| 92 base::Time end_time, | 91 base::Time end_time, |
| 93 const CompletionCallback& callback); | 92 const CompletionCallback& callback); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 113 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 112 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
| 114 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 113 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
| 115 base::RepeatingTimer<InfiniteCache> timer_; | 114 base::RepeatingTimer<InfiniteCache> timer_; |
| 116 | 115 |
| 117 DISALLOW_COPY_AND_ASSIGN(InfiniteCache); | 116 DISALLOW_COPY_AND_ASSIGN(InfiniteCache); |
| 118 }; | 117 }; |
| 119 | 118 |
| 120 } // namespace net | 119 } // namespace net |
| 121 | 120 |
| 122 #endif // NET_HTTP_INFINITE_CACHE_H_ | 121 #endif // NET_HTTP_INFINITE_CACHE_H_ |
| OLD | NEW |