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

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

Issue 1135373002: Updated NetLog::ParametersCallback & all related calbacks returning value as scoped_ptr<base::Value… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/filter/filter.cc ('k') | net/ftp/ftp_ctrl_response_buffer.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/sdch_filter.h" 5 #include "net/filter/sdch_filter.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <limits.h> 8 #include <limits.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 case RESPONSE_ENCODING_LIE: 83 case RESPONSE_ENCODING_LIE:
84 cause_string = "ENCODING_LIE"; 84 cause_string = "ENCODING_LIE";
85 break; 85 break;
86 case RESPONSE_MAX: 86 case RESPONSE_MAX:
87 cause_string = "<Error: max enum value>"; 87 cause_string = "<Error: max enum value>";
88 break; 88 break;
89 } 89 }
90 return cause_string; 90 return cause_string;
91 } 91 }
92 92
93 base::Value* NetLogSdchResponseCorruptionDetectionCallback( 93 scoped_ptr<base::Value> NetLogSdchResponseCorruptionDetectionCallback(
94 ResponseCorruptionDetectionCause cause, 94 ResponseCorruptionDetectionCause cause,
95 bool cached, 95 bool cached,
96 NetLogCaptureMode capture_mode) { 96 NetLogCaptureMode capture_mode) {
97 base::DictionaryValue* dict = new base::DictionaryValue(); 97 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
98 dict->SetString("cause", ResponseCorruptionDetectionCauseToString(cause)); 98 dict->SetString("cause", ResponseCorruptionDetectionCauseToString(cause));
99 dict->SetBoolean("cached", cached); 99 dict->SetBoolean("cached", cached);
100 return dict; 100 return dict.Pass();
101 } 101 }
102 102
103 } // namespace 103 } // namespace
104 104
105 SdchFilter::SdchFilter(FilterType type, const FilterContext& filter_context) 105 SdchFilter::SdchFilter(FilterType type, const FilterContext& filter_context)
106 : Filter(type), 106 : Filter(type),
107 filter_context_(filter_context), 107 filter_context_(filter_context),
108 decoding_status_(DECODING_UNINITIALIZED), 108 decoding_status_(DECODING_UNINITIALIZED),
109 dictionary_hash_(), 109 dictionary_hash_(),
110 dictionary_hash_is_plausible_(false), 110 dictionary_hash_is_plausible_(false),
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // caches the histogram name based on the call site. 333 // caches the histogram name based on the call site.
334 if (filter_context_.IsCachedContent()) { 334 if (filter_context_.IsCachedContent()) {
335 UMA_HISTOGRAM_ENUMERATION( 335 UMA_HISTOGRAM_ENUMERATION(
336 "Sdch3.ResponseCorruptionDetection.Cached", cause, RESPONSE_MAX); 336 "Sdch3.ResponseCorruptionDetection.Cached", cause, RESPONSE_MAX);
337 } else { 337 } else {
338 UMA_HISTOGRAM_ENUMERATION( 338 UMA_HISTOGRAM_ENUMERATION(
339 "Sdch3.ResponseCorruptionDetection.Uncached", cause, RESPONSE_MAX); 339 "Sdch3.ResponseCorruptionDetection.Uncached", cause, RESPONSE_MAX);
340 } 340 }
341 filter_context_.GetNetLog().AddEvent( 341 filter_context_.GetNetLog().AddEvent(
342 NetLog::TYPE_SDCH_RESPONSE_CORRUPTION_DETECTION, 342 NetLog::TYPE_SDCH_RESPONSE_CORRUPTION_DETECTION,
343 base::Bind(&NetLogSdchResponseCorruptionDetectionCallback, cause, 343 base::Bind(NetLogSdchResponseCorruptionDetectionCallback, cause,
344 filter_context_.IsCachedContent())); 344 filter_context_.IsCachedContent()));
345 345
346 if (decoding_status_ == PASS_THROUGH) { 346 if (decoding_status_ == PASS_THROUGH) {
347 dest_buffer_excess_ = dictionary_hash_; // Send what we scanned. 347 dest_buffer_excess_ = dictionary_hash_; // Send what we scanned.
348 } else { 348 } else {
349 // This is where we try to do the expensive meta-refresh. 349 // This is where we try to do the expensive meta-refresh.
350 if (std::string::npos == mime_type_.find("text/html")) { 350 if (std::string::npos == mime_type_.find("text/html")) {
351 // Since we can't do a meta-refresh (along with an exponential 351 // Since we can't do a meta-refresh (along with an exponential
352 // backoff), we'll just make sure this NEVER happens again. 352 // backoff), we'll just make sure this NEVER happens again.
353 SdchProblemCode problem = (filter_context_.IsCachedContent() 353 SdchProblemCode problem = (filter_context_.IsCachedContent()
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 dest_buffer_excess_.clear(); 556 dest_buffer_excess_.clear();
557 dest_buffer_excess_index_ = 0; 557 dest_buffer_excess_index_ = 0;
558 } 558 }
559 return amount; 559 return amount;
560 } 560 }
561 561
562 void SdchFilter::LogSdchProblem(SdchProblemCode problem) { 562 void SdchFilter::LogSdchProblem(SdchProblemCode problem) {
563 SdchManager::SdchErrorRecovery(problem); 563 SdchManager::SdchErrorRecovery(problem);
564 filter_context_.GetNetLog().AddEvent( 564 filter_context_.GetNetLog().AddEvent(
565 NetLog::TYPE_SDCH_DECODING_ERROR, 565 NetLog::TYPE_SDCH_DECODING_ERROR,
566 base::Bind(&NetLogSdchResourceProblemCallback, problem)); 566 base::Bind(NetLogSdchResourceProblemCallback, problem));
567 } 567 }
568 568
569 } // namespace net 569 } // namespace net
OLDNEW
« no previous file with comments | « net/filter/filter.cc ('k') | net/ftp/ftp_ctrl_response_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698