| 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/http/infinite_cache.h" | 5 #include "net/http/infinite_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/rand_util.h" | 21 #include "base/rand_util.h" |
| 22 #include "base/sha1.h" | 22 #include "base/sha1.h" |
| 23 #include "base/time.h" | 23 #include "base/time.h" |
| 24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
| 25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 26 #include "net/http/http_cache_transaction.h" | 26 #include "net/http/http_cache_transaction.h" |
| 27 #include "net/http/http_request_info.h" | 27 #include "net/http/http_request_info.h" |
| 28 #include "net/http/http_response_headers.h" | 28 #include "net/http/http_response_headers.h" |
| 29 #include "net/http/http_response_info.h" | 29 #include "net/http/http_response_info.h" |
| 30 #include "net/http/http_util.h" | 30 #include "net/http/http_util.h" |
| 31 |
| 32 #if defined(USE_SYSTEM_ZLIB) |
| 33 #include <zlib.h> |
| 34 #else |
| 31 #include "third_party/zlib/zlib.h" | 35 #include "third_party/zlib/zlib.h" |
| 36 #endif |
| 32 | 37 |
| 33 using base::PlatformFile; | 38 using base::PlatformFile; |
| 34 using base::Time; | 39 using base::Time; |
| 35 using base::TimeDelta; | 40 using base::TimeDelta; |
| 36 | 41 |
| 37 namespace { | 42 namespace { |
| 38 | 43 |
| 39 // Flags to use with a particular resource. | 44 // Flags to use with a particular resource. |
| 40 enum Flags { | 45 enum Flags { |
| 41 NO_CACHE = 1 << 0, | 46 NO_CACHE = 1 << 0, |
| (...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 int InfiniteCache::FlushDataForTest(const CompletionCallback& callback) { | 1090 int InfiniteCache::FlushDataForTest(const CompletionCallback& callback) { |
| 1086 DCHECK(worker_); | 1091 DCHECK(worker_); |
| 1087 int* result = new int; | 1092 int* result = new int; |
| 1088 task_runner_->PostTaskAndReply( | 1093 task_runner_->PostTaskAndReply( |
| 1089 FROM_HERE, base::Bind(&InfiniteCache::Worker::Flush, worker_, result), | 1094 FROM_HERE, base::Bind(&InfiniteCache::Worker::Flush, worker_, result), |
| 1090 base::Bind(&OnComplete, callback, base::Owned(result))); | 1095 base::Bind(&OnComplete, callback, base::Owned(result))); |
| 1091 return net::ERR_IO_PENDING; | 1096 return net::ERR_IO_PENDING; |
| 1092 } | 1097 } |
| 1093 | 1098 |
| 1094 } // namespace net | 1099 } // namespace net |
| OLD | NEW |