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 #include "net/tools/quic/quic_in_memory_cache.h" | 5 #include "net/tools/quic/quic_in_memory_cache.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 | 9 |
10 using base::FilePath; | 10 using base::FilePath; |
11 using base::StringPiece; | 11 using base::StringPiece; |
12 using file_util::FileEnumerator; | 12 using file_util::FileEnumerator; |
13 using std::string; | 13 using std::string; |
14 | 14 |
15 // Specifies the directory used during QuicInMemoryCache | 15 // Specifies the directory used during QuicInMemoryCache |
16 // construction to seed the cache. Cache directory can be | 16 // construction to seed the cache. Cache directory can be |
17 // generated using `wget -p --save-headers <url> | 17 // generated using `wget -p --save-headers <url> |
18 string FLAGS_quic_in_memory_cache_dir; | 18 string FLAGS_quic_in_memory_cache_dir; |
19 | 19 |
20 namespace net { | 20 namespace net { |
| 21 namespace tools { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // BalsaVisitor implementation (glue) which caches response bodies. | 25 // BalsaVisitor implementation (glue) which caches response bodies. |
25 class CachingBalsaVisitor : public BalsaVisitorInterface { | 26 class CachingBalsaVisitor : public BalsaVisitorInterface { |
26 public: | 27 public: |
27 CachingBalsaVisitor() : done_framing_(false) {} | 28 CachingBalsaVisitor() : done_framing_(false) {} |
28 virtual void ProcessBodyData(const char* input, size_t size) { | 29 virtual void ProcessBodyData(const char* input, size_t size) { |
29 AppendToBody(input, size); | 30 AppendToBody(input, size); |
30 } | 31 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 180 |
180 QuicInMemoryCache::~QuicInMemoryCache() { | 181 QuicInMemoryCache::~QuicInMemoryCache() { |
181 STLDeleteValues(&responses_); | 182 STLDeleteValues(&responses_); |
182 } | 183 } |
183 | 184 |
184 string QuicInMemoryCache::GetKey(const BalsaHeaders& request_headers) const { | 185 string QuicInMemoryCache::GetKey(const BalsaHeaders& request_headers) const { |
185 return request_headers.GetHeader("host").as_string() + | 186 return request_headers.GetHeader("host").as_string() + |
186 request_headers.request_uri().as_string(); | 187 request_headers.request_uri().as_string(); |
187 } | 188 } |
188 | 189 |
| 190 } // namespace tools |
189 } // namespace net | 191 } // namespace net |
OLD | NEW |