| 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 <limits.h> | 5 #include <limits.h> |
| 6 #include <ctype.h> | 6 #include <ctype.h> |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/histogram.h" | 10 #include "base/histogram.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 dest_buffer_excess_index_(0), | 24 dest_buffer_excess_index_(0), |
| 25 source_bytes_(0), | 25 source_bytes_(0), |
| 26 output_bytes_(0), | 26 output_bytes_(0), |
| 27 possible_pass_through_(false) { | 27 possible_pass_through_(false) { |
| 28 } | 28 } |
| 29 | 29 |
| 30 SdchFilter::~SdchFilter() { | 30 SdchFilter::~SdchFilter() { |
| 31 static int filter_use_count = 0; | 31 static int filter_use_count = 0; |
| 32 ++filter_use_count; | 32 ++filter_use_count; |
| 33 if (META_REFRESH_RECOVERY == decoding_status_) { | 33 if (META_REFRESH_RECOVERY == decoding_status_) { |
| 34 UMA_HISTOGRAM_COUNTS(L"Sdch.FilterUseBeforeDisabling", filter_use_count); | 34 UMA_HISTOGRAM_COUNTS("Sdch.FilterUseBeforeDisabling", filter_use_count); |
| 35 } | 35 } |
| 36 | 36 |
| 37 if (vcdiff_streaming_decoder_.get()) { | 37 if (vcdiff_streaming_decoder_.get()) { |
| 38 if (!vcdiff_streaming_decoder_->FinishDecoding()) { | 38 if (!vcdiff_streaming_decoder_->FinishDecoding()) { |
| 39 decoding_status_ = DECODING_ERROR; | 39 decoding_status_ = DECODING_ERROR; |
| 40 SdchManager::SdchErrorRecovery(SdchManager::INCOMPLETE_SDCH_CONTENT); | 40 SdchManager::SdchErrorRecovery(SdchManager::INCOMPLETE_SDCH_CONTENT); |
| 41 // Make it possible for the user to hit reload, and get non-sdch content. | 41 // Make it possible for the user to hit reload, and get non-sdch content. |
| 42 // Note this will "wear off" quickly enough, and is just meant to assure | 42 // Note this will "wear off" quickly enough, and is just meant to assure |
| 43 // in some rare case that the user is not stuck. | 43 // in some rare case that the user is not stuck. |
| 44 SdchManager::BlacklistDomain(url()); | 44 SdchManager::BlacklistDomain(url()); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 if (!was_cached() | 48 if (!was_cached() |
| 49 && base::Time() != connect_time() | 49 && base::Time() != connect_time() |
| 50 && read_times_.size() > 0) { | 50 && read_times_.size() > 0) { |
| 51 base::TimeDelta duration = read_times_.back() - connect_time(); | 51 base::TimeDelta duration = read_times_.back() - connect_time(); |
| 52 // We clip our logging at 10 minutes to prevent anamolous data from being | 52 // We clip our logging at 10 minutes to prevent anamolous data from being |
| 53 // considered (per suggestion from Jake Brutlag). | 53 // considered (per suggestion from Jake Brutlag). |
| 54 if (10 >= duration.InMinutes()) { | 54 if (10 >= duration.InMinutes()) { |
| 55 if (DECODING_IN_PROGRESS == decoding_status_) { | 55 if (DECODING_IN_PROGRESS == decoding_status_) { |
| 56 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Decode_Latency_F", duration, | 56 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Decode_Latency_F", duration, |
| 57 base::TimeDelta::FromMilliseconds(20), | 57 base::TimeDelta::FromMilliseconds(20), |
| 58 base::TimeDelta::FromMinutes(10), 100); | 58 base::TimeDelta::FromMinutes(10), 100); |
| 59 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Decode_1st_To_Last", | 59 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Decode_1st_To_Last", |
| 60 read_times_.back() - read_times_[0], | 60 read_times_.back() - read_times_[0], |
| 61 base::TimeDelta::FromMilliseconds(20), | 61 base::TimeDelta::FromMilliseconds(20), |
| 62 base::TimeDelta::FromMinutes(10), 100); | 62 base::TimeDelta::FromMinutes(10), 100); |
| 63 if (read_times_.size() > 3) { | 63 if (read_times_.size() > 3) { |
| 64 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Decode_3rd_To_4th", | 64 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Decode_3rd_To_4th", |
| 65 read_times_[3] - read_times_[2], | 65 read_times_[3] - read_times_[2], |
| 66 base::TimeDelta::FromMilliseconds(10), | 66 base::TimeDelta::FromMilliseconds(10), |
| 67 base::TimeDelta::FromSeconds(3), 100); | 67 base::TimeDelta::FromSeconds(3), 100); |
| 68 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Decode_2nd_To_3rd", | 68 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Decode_2nd_To_3rd", |
| 69 read_times_[2] - read_times_[1], | 69 read_times_[2] - read_times_[1], |
| 70 base::TimeDelta::FromMilliseconds(10), | 70 base::TimeDelta::FromMilliseconds(10), |
| 71 base::TimeDelta::FromSeconds(3), 100); | 71 base::TimeDelta::FromSeconds(3), 100); |
| 72 } | 72 } |
| 73 UMA_HISTOGRAM_COUNTS_100(L"Sdch.Network_Decode_Reads", | 73 UMA_HISTOGRAM_COUNTS_100("Sdch.Network_Decode_Reads", |
| 74 read_times_.size()); | 74 read_times_.size()); |
| 75 UMA_HISTOGRAM_COUNTS(L"Sdch.Network_Decode_Bytes_Read", output_bytes_); | 75 UMA_HISTOGRAM_COUNTS("Sdch.Network_Decode_Bytes_Read", output_bytes_); |
| 76 } else if (PASS_THROUGH == decoding_status_) { | 76 } else if (PASS_THROUGH == decoding_status_) { |
| 77 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Pass-through_Latency_F", | 77 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Pass-through_Latency_F", |
| 78 duration, | 78 duration, |
| 79 base::TimeDelta::FromMilliseconds(20), | 79 base::TimeDelta::FromMilliseconds(20), |
| 80 base::TimeDelta::FromMinutes(10), 100); | 80 base::TimeDelta::FromMinutes(10), 100); |
| 81 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Pass-through_1st_To_Last", | 81 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Pass-through_1st_To_Last", |
| 82 read_times_.back() - read_times_[0], | 82 read_times_.back() - read_times_[0], |
| 83 base::TimeDelta::FromMilliseconds(20), | 83 base::TimeDelta::FromMilliseconds(20), |
| 84 base::TimeDelta::FromMinutes(10), 100); | 84 base::TimeDelta::FromMinutes(10), 100); |
| 85 if (read_times_.size() > 3) { | 85 if (read_times_.size() > 3) { |
| 86 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Pass-through_3rd_To_4th", | 86 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Pass-through_3rd_To_4th", |
| 87 read_times_[3] - read_times_[2], | 87 read_times_[3] - read_times_[2], |
| 88 base::TimeDelta::FromMilliseconds(10), | 88 base::TimeDelta::FromMilliseconds(10), |
| 89 base::TimeDelta::FromSeconds(3), 100); | 89 base::TimeDelta::FromSeconds(3), 100); |
| 90 UMA_HISTOGRAM_CLIPPED_TIMES(L"Sdch.Network_Pass-through_2nd_To_3rd", | 90 UMA_HISTOGRAM_CLIPPED_TIMES("Sdch.Network_Pass-through_2nd_To_3rd", |
| 91 read_times_[2] - read_times_[1], | 91 read_times_[2] - read_times_[1], |
| 92 base::TimeDelta::FromMilliseconds(10), | 92 base::TimeDelta::FromMilliseconds(10), |
| 93 base::TimeDelta::FromSeconds(3), 100); | 93 base::TimeDelta::FromSeconds(3), 100); |
| 94 } | 94 } |
| 95 UMA_HISTOGRAM_COUNTS_100(L"Sdch.Network_Pass-through_Reads", | 95 UMA_HISTOGRAM_COUNTS_100("Sdch.Network_Pass-through_Reads", |
| 96 read_times_.size()); | 96 read_times_.size()); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 if (dictionary_) | 101 if (dictionary_) |
| 102 dictionary_->Release(); | 102 dictionary_->Release(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool SdchFilter::InitDecoding(Filter::FilterType filter_type) { | 105 bool SdchFilter::InitDecoding(Filter::FilterType filter_type) { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_, | 320 memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_, |
| 321 amount); | 321 amount); |
| 322 dest_buffer_excess_index_ += amount; | 322 dest_buffer_excess_index_ += amount; |
| 323 if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) { | 323 if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) { |
| 324 DCHECK(dest_buffer_excess_.size() == dest_buffer_excess_index_); | 324 DCHECK(dest_buffer_excess_.size() == dest_buffer_excess_index_); |
| 325 dest_buffer_excess_.clear(); | 325 dest_buffer_excess_.clear(); |
| 326 dest_buffer_excess_index_ = 0; | 326 dest_buffer_excess_index_ = 0; |
| 327 } | 327 } |
| 328 return amount; | 328 return amount; |
| 329 } | 329 } |
| OLD | NEW |