OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/url_request/url_request_view_cache_job.h" | 5 #include "net/url_request/url_request_view_cache_job.h" |
6 | 6 |
7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "net/base/escape.h" | 8 #include "net/base/escape.h" |
9 #include "net/disk_cache/disk_cache.h" | 9 #include "net/disk_cache/disk_cache.h" |
10 #include "net/http/http_cache.h" | 10 #include "net/http/http_cache.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 result.push_back('\n'); | 80 result.push_back('\n'); |
81 } | 81 } |
82 result.append("</pre>"); | 82 result.append("</pre>"); |
83 } | 83 } |
84 | 84 |
85 for (int i = 0; i < 2; ++i) { | 85 for (int i = 0; i < 2; ++i) { |
86 result.append("<hr><pre>"); | 86 result.append("<hr><pre>"); |
87 | 87 |
88 int data_size = entry->GetDataSize(i); | 88 int data_size = entry->GetDataSize(i); |
89 | 89 |
90 char* data = new char[data_size]; | 90 scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(data_size); |
91 if (entry->ReadData(i, 0, data, data_size, NULL) == data_size) | 91 if (entry->ReadData(i, 0, buffer, data_size, NULL) == data_size) |
92 HexDump(data, data_size, &result); | 92 HexDump(buffer->data(), data_size, &result); |
93 | 93 |
94 result.append("</pre>"); | 94 result.append("</pre>"); |
95 } | 95 } |
96 | 96 |
97 return result; | 97 return result; |
98 } | 98 } |
99 | 99 |
100 static std::string FormatStatistics(disk_cache::Backend* disk_cache) { | 100 static std::string FormatStatistics(disk_cache::Backend* disk_cache) { |
101 std::vector<std::pair<std::string, std::string> > stats; | 101 std::vector<std::pair<std::string, std::string> > stats; |
102 disk_cache->GetStats(&stats); | 102 disk_cache->GetStats(&stats); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 return NULL; | 161 return NULL; |
162 | 162 |
163 net::HttpCache* http_cache = | 163 net::HttpCache* http_cache = |
164 request_->context()->http_transaction_factory()->GetCache(); | 164 request_->context()->http_transaction_factory()->GetCache(); |
165 if (!http_cache) | 165 if (!http_cache) |
166 return NULL; | 166 return NULL; |
167 | 167 |
168 return http_cache->disk_cache(); | 168 return http_cache->disk_cache(); |
169 } | 169 } |
170 | 170 |
OLD | NEW |