Chromium Code Reviews| Index: net/quic/quic_in_memory_cache.cc |
| diff --git a/net/quic/quic_in_memory_cache.cc b/net/quic/quic_in_memory_cache.cc |
| index 45d25b24e407759bd39de8a4fe923d6a2f759d43..02683d4ec2e4c3d38893df1d81e19cfa9c20cb5e 100644 |
| --- a/net/quic/quic_in_memory_cache.cc |
| +++ b/net/quic/quic_in_memory_cache.cc |
| @@ -4,7 +4,6 @@ |
| #include "net/quic/quic_in_memory_cache.h" |
| -#include "base/file_util.h" |
| #include "base/files/file_enumerator.h" |
| #include "base/stl_util.h" |
| #include "base/strings/string_number_conversions.h" |
| @@ -20,9 +19,9 @@ using std::string; |
| namespace net { |
| -namespace { |
| +FilePath g_quic_in_memory_cache_dir = FilePath(FILE_PATH_LITERAL("")); |
|
wtc
2014/06/18 02:04:46
Global objects are banned in Chromium. We can prob
dmziegler
2014/06/18 20:13:41
I've made it a FilePath::StringType.
In general,
|
| -const FilePath::CharType* g_quic_in_memory_cache_dir = FILE_PATH_LITERAL(""); |
| +namespace { |
| // BalsaVisitor implementation (glue) which caches response bodies. |
| class CachingBalsaVisitor : public NoOpBalsaVisitor { |
| @@ -132,15 +131,14 @@ void QuicInMemoryCache::ResetForTests() { |
| void QuicInMemoryCache::Initialize() { |
| // If there's no defined cache dir, we have no initialization to do. |
| - if (g_quic_in_memory_cache_dir[0] == '\0') { |
| + if (g_quic_in_memory_cache_dir.value().size() == 0) { |
| VLOG(1) << "No cache directory found. Skipping initialization."; |
| return; |
| } |
| VLOG(1) << "Attempting to initialize QuicInMemoryCache from directory: " |
| - << g_quic_in_memory_cache_dir; |
| + << g_quic_in_memory_cache_dir.value(); |
| - FilePath directory(g_quic_in_memory_cache_dir); |
| - base::FileEnumerator file_list(directory, |
| + base::FileEnumerator file_list(g_quic_in_memory_cache_dir, |
| true, |
| base::FileEnumerator::FILES); |
| @@ -185,7 +183,8 @@ void QuicInMemoryCache::Initialize() { |
| processed += file_contents.length(); |
| } |
| - StringPiece base = file.AsUTF8Unsafe(); |
| + string utf8File = file.AsUTF8Unsafe(); |
|
wtc
2014/06/18 02:04:46
Name this variable "utf8_file".
Actually you shou
dmziegler
2014/06/18 20:13:41
This would require more unnecessary copying, since
dmz
2014/06/19 20:06:28
Update: My next CL changes things anyway.
|
| + StringPiece base = utf8File; |
| if (response_headers.HasHeader("X-Original-Url")) { |
| base = response_headers.GetHeader("X-Original-Url"); |
| response_headers.RemoveAllOfHeader("X-Original-Url"); |