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 "content/renderer/fetchers/resource_fetcher_impl.h" | 5 #include "content/renderer/fetchers/resource_fetcher_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 void didReceiveCachedMetadata(blink::WebURLLoader* loader, | 80 void didReceiveCachedMetadata(blink::WebURLLoader* loader, |
81 const char* data, | 81 const char* data, |
82 int data_length) override { | 82 int data_length) override { |
83 DCHECK(!completed_); | 83 DCHECK(!completed_); |
84 DCHECK_GT(data_length, 0); | 84 DCHECK_GT(data_length, 0); |
85 } | 85 } |
86 void didReceiveData(blink::WebURLLoader* loader, | 86 void didReceiveData(blink::WebURLLoader* loader, |
87 const char* data, | 87 const char* data, |
88 int data_length, | 88 int data_length, |
89 int encoded_data_length, | 89 int encoded_data_length) override { |
90 int encoded_body_length) override { | |
91 DCHECK(!completed_); | 90 DCHECK(!completed_); |
92 DCHECK_GT(data_length, 0); | 91 DCHECK_GT(data_length, 0); |
93 | 92 |
94 data_.append(data, data_length); | 93 data_.append(data, data_length); |
95 } | 94 } |
96 void didFinishLoading(blink::WebURLLoader* loader, | 95 void didFinishLoading(blink::WebURLLoader* loader, |
97 double finishTime, | 96 double finishTime, |
98 int64_t total_encoded_data_length) override { | 97 int64_t total_encoded_data_length, |
| 98 int64_t total_encoded_body_length) override { |
99 DCHECK(!completed_); | 99 DCHECK(!completed_); |
100 | 100 |
101 OnLoadCompleteInternal(LOAD_SUCCEEDED); | 101 OnLoadCompleteInternal(LOAD_SUCCEEDED); |
102 } | 102 } |
103 void didFail(blink::WebURLLoader* loader, | 103 void didFail(blink::WebURLLoader* loader, |
104 const blink::WebURLError& error, | 104 const blink::WebURLError& error, |
105 int64_t total_encoded_data_length) override { | 105 int64_t total_encoded_data_length, |
| 106 int64_t total_encoded_body_length) override { |
106 OnLoadCompleteInternal(LOAD_FAILED); | 107 OnLoadCompleteInternal(LOAD_FAILED); |
107 } | 108 } |
108 | 109 |
109 private: | 110 private: |
110 ResourceFetcherImpl* parent_; | 111 ResourceFetcherImpl* parent_; |
111 | 112 |
112 // Set to true once the request is complete. | 113 // Set to true once the request is complete. |
113 bool completed_; | 114 bool completed_; |
114 | 115 |
115 // Buffer to hold the content from the server. | 116 // Buffer to hold the content from the server. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 void ResourceFetcherImpl::OnLoadComplete() { | 212 void ResourceFetcherImpl::OnLoadComplete() { |
212 timeout_timer_.Stop(); | 213 timeout_timer_.Stop(); |
213 } | 214 } |
214 | 215 |
215 void ResourceFetcherImpl::Cancel() { | 216 void ResourceFetcherImpl::Cancel() { |
216 loader_->cancel(); | 217 loader_->cancel(); |
217 client_->Cancel(); | 218 client_->Cancel(); |
218 } | 219 } |
219 | 220 |
220 } // namespace content | 221 } // namespace content |
OLD | NEW |