| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/http_cache.h" | 5 #include "net/http/http_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 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "net/http/http_network_layer.h" | 29 #include "net/http/http_network_layer.h" |
| 30 #include "net/http/http_network_session.h" | 30 #include "net/http/http_network_session.h" |
| 31 #include "net/http/http_request_info.h" | 31 #include "net/http/http_request_info.h" |
| 32 #include "net/http/http_response_headers.h" | 32 #include "net/http/http_response_headers.h" |
| 33 #include "net/http/http_response_info.h" | 33 #include "net/http/http_response_info.h" |
| 34 #include "net/http/http_util.h" | 34 #include "net/http/http_util.h" |
| 35 #include "net/spdy/spdy_session_pool.h" | 35 #include "net/spdy/spdy_session_pool.h" |
| 36 | 36 |
| 37 namespace net { | 37 namespace net { |
| 38 | 38 |
| 39 HttpCache::DefaultBackend::DefaultBackend(CacheType type, |
| 40 const FilePath& path, |
| 41 int max_bytes, |
| 42 base::MessageLoopProxy* thread) |
| 43 : type_(type), |
| 44 path_(path), |
| 45 max_bytes_(max_bytes), |
| 46 thread_(thread) { |
| 47 } |
| 48 |
| 49 HttpCache::DefaultBackend::~DefaultBackend() {} |
| 50 |
| 51 // static |
| 52 HttpCache::BackendFactory* HttpCache::DefaultBackend::InMemory(int max_bytes) { |
| 53 return new DefaultBackend(MEMORY_CACHE, FilePath(), max_bytes, NULL); |
| 54 } |
| 55 |
| 39 int HttpCache::DefaultBackend::CreateBackend(disk_cache::Backend** backend, | 56 int HttpCache::DefaultBackend::CreateBackend(disk_cache::Backend** backend, |
| 40 CompletionCallback* callback) { | 57 CompletionCallback* callback) { |
| 41 DCHECK_GE(max_bytes_, 0); | 58 DCHECK_GE(max_bytes_, 0); |
| 42 return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true, | 59 return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true, |
| 43 thread_, backend, callback); | 60 thread_, backend, callback); |
| 44 } | 61 } |
| 45 | 62 |
| 46 //----------------------------------------------------------------------------- | 63 //----------------------------------------------------------------------------- |
| 47 | 64 |
| 48 HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* e) | 65 HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* e) |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 building_backend_ = false; | 1075 building_backend_ = false; |
| 1059 DeletePendingOp(pending_op); | 1076 DeletePendingOp(pending_op); |
| 1060 } | 1077 } |
| 1061 | 1078 |
| 1062 // The cache may be gone when we return from the callback. | 1079 // The cache may be gone when we return from the callback. |
| 1063 if (!item->DoCallback(result, backend)) | 1080 if (!item->DoCallback(result, backend)) |
| 1064 item->NotifyTransaction(result, NULL); | 1081 item->NotifyTransaction(result, NULL); |
| 1065 } | 1082 } |
| 1066 | 1083 |
| 1067 } // namespace net | 1084 } // namespace net |
| OLD | NEW |