| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/filter/filter_source_stream.h" | 5 #include "net/filter/filter_source_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 int consumed_bytes = 0; | 129 int consumed_bytes = 0; |
| 130 int bytes_output = FilterData(output_buffer_.get(), output_buffer_size_, | 130 int bytes_output = FilterData(output_buffer_.get(), output_buffer_size_, |
| 131 drainable_input_buffer_.get(), | 131 drainable_input_buffer_.get(), |
| 132 drainable_input_buffer_->BytesRemaining(), | 132 drainable_input_buffer_->BytesRemaining(), |
| 133 &consumed_bytes, upstream_end_reached_); | 133 &consumed_bytes, upstream_end_reached_); |
| 134 DCHECK_LE(consumed_bytes, drainable_input_buffer_->BytesRemaining()); | 134 DCHECK_LE(consumed_bytes, drainable_input_buffer_->BytesRemaining()); |
| 135 DCHECK(bytes_output != 0 || | 135 DCHECK(bytes_output != 0 || |
| 136 consumed_bytes == drainable_input_buffer_->BytesRemaining()); | 136 consumed_bytes == drainable_input_buffer_->BytesRemaining()); |
| 137 | 137 |
| 138 if (bytes_output == ERR_CONTENT_DECODING_FAILED) { | 138 if (bytes_output == ERR_CONTENT_DECODING_FAILED) { |
| 139 UMA_HISTOGRAM_ENUMERATION("Net.ContentDecodingFailed.FilterType", type(), | 139 UMA_HISTOGRAM_ENUMERATION("Net.ContentDecodingFailed2.FilterType", type(), |
| 140 TYPE_MAX); | 140 TYPE_MAX); |
| 141 } | 141 } |
| 142 // FilterData() is not allowed to return ERR_IO_PENDING. | 142 // FilterData() is not allowed to return ERR_IO_PENDING. |
| 143 DCHECK_NE(ERR_IO_PENDING, bytes_output); | 143 DCHECK_NE(ERR_IO_PENDING, bytes_output); |
| 144 | 144 |
| 145 if (consumed_bytes > 0) | 145 if (consumed_bytes > 0) |
| 146 drainable_input_buffer_->DidConsume(consumed_bytes); | 146 drainable_input_buffer_->DidConsume(consumed_bytes); |
| 147 | 147 |
| 148 // Received data or encountered an error. | 148 // Received data or encountered an error. |
| 149 if (bytes_output != 0) | 149 if (bytes_output != 0) |
| (...skipping 17 matching lines...) Expand all Loading... |
| 167 output_buffer_size_ = 0; | 167 output_buffer_size_ = 0; |
| 168 | 168 |
| 169 base::ResetAndReturn(&callback_).Run(rv); | 169 base::ResetAndReturn(&callback_).Run(rv); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool FilterSourceStream::NeedMoreData() const { | 172 bool FilterSourceStream::NeedMoreData() const { |
| 173 return !upstream_end_reached_; | 173 return !upstream_end_reached_; |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace net | 176 } // namespace net |
| OLD | NEW |