Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(686)

Side by Side Diff: net/filter/filter_source_stream.cc

Issue 2368433002: Add net::SdchSourceStream and net::SdchPolicyDelegate (Closed)
Patch Set: Fix histograms Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/sdch_manager.cc ('k') | net/filter/sdch_policy_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/base/sdch_manager.cc ('k') | net/filter/sdch_policy_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698