| Index: net/filter/sdch_filter.cc
|
| diff --git a/net/filter/sdch_filter.cc b/net/filter/sdch_filter.cc
|
| index 55d9b4c6bd984c4934df7472e17c3b1b2ecc2faf..711e19ec8c6ba70ef168a9905fc1db6674583a5b 100644
|
| --- a/net/filter/sdch_filter.cc
|
| +++ b/net/filter/sdch_filter.cc
|
| @@ -52,8 +52,9 @@ SdchFilter::~SdchFilter() {
|
| // Note this will "wear off" quickly enough, and is just meant to assure
|
| // in some rare case that the user is not stuck.
|
| SdchManager::BlacklistDomain(url_);
|
| - UMA_HISTOGRAM_COUNTS("Sdch3.PartialBytesIn",
|
| - static_cast<int>(filter_context_.GetByteReadCount()));
|
| + UMA_HISTOGRAM_COUNTS(
|
| + "Sdch3.PartialBytesIn",
|
| + static_cast<int>(filter_context_.GetByteReadCount()));
|
| UMA_HISTOGRAM_COUNTS("Sdch3.PartialVcdiffIn", source_bytes_);
|
| UMA_HISTOGRAM_COUNTS("Sdch3.PartialVcdiffOut", output_bytes_);
|
| }
|
| @@ -63,7 +64,7 @@ SdchFilter::~SdchFilter() {
|
| // Filter chaining error, or premature teardown.
|
| SdchManager::SdchErrorRecovery(SdchManager::UNFLUSHED_CONTENT);
|
| UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedBytesIn",
|
| - static_cast<int>(filter_context_.GetByteReadCount()));
|
| + static_cast<int>(filter_context_.GetByteReadCount()));
|
| UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedBufferSize",
|
| dest_buffer_excess_.size());
|
| UMA_HISTOGRAM_COUNTS("Sdch3.UnflushedVcdiffIn", source_bytes_);
|
| @@ -80,9 +81,10 @@ SdchFilter::~SdchFilter() {
|
| switch (decoding_status_) {
|
| case DECODING_IN_PROGRESS: {
|
| if (output_bytes_)
|
| - UMA_HISTOGRAM_PERCENTAGE("Sdch3.Network_Decode_Ratio_a",
|
| - static_cast<int>(
|
| - (filter_context_.GetByteReadCount() * 100) / output_bytes_));
|
| + UMA_HISTOGRAM_PERCENTAGE(
|
| + "Sdch3.Network_Decode_Ratio_a",
|
| + static_cast<int>((filter_context_.GetByteReadCount() * 100) /
|
| + output_bytes_));
|
| UMA_HISTOGRAM_COUNTS("Sdch3.Network_Decode_Bytes_VcdiffOut_a",
|
| output_bytes_);
|
| filter_context_.RecordPacketStats(FilterContext::SDCH_DECODE);
|
| @@ -129,16 +131,16 @@ bool SdchFilter::InitDecoding(Filter::FilterType filter_type) {
|
|
|
| #ifndef NDEBUG
|
| static const char* kDecompressionErrorHtml =
|
| - "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0\"></head>"
|
| - "<div style=\"position:fixed;top:0;left:0;width:100%;border-width:thin;"
|
| - "border-color:black;border-style:solid;text-align:left;font-family:arial;"
|
| - "font-size:10pt;foreground-color:black;background-color:white\">"
|
| - "An error occurred. This page will be reloaded shortly. "
|
| - "Or press the \"reload\" button now to reload it immediately."
|
| - "</div>";
|
| + "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0\"></head>"
|
| + "<div style=\"position:fixed;top:0;left:0;width:100%;border-width:thin;"
|
| + "border-color:black;border-style:solid;text-align:left;font-family:arial;"
|
| + "font-size:10pt;foreground-color:black;background-color:white\">"
|
| + "An error occurred. This page will be reloaded shortly. "
|
| + "Or press the \"reload\" button now to reload it immediately."
|
| + "</div>";
|
| #else
|
| static const char* kDecompressionErrorHtml =
|
| - "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0\"></head>";
|
| + "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"0\"></head>";
|
| #endif
|
|
|
| Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
|
| @@ -174,8 +176,8 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
|
| decoding_status_ = PASS_THROUGH;
|
| } else if (filter_context_.GetResponseCode() != 200) {
|
| // We need to meta-refresh, with SDCH disabled.
|
| - } else if (filter_context_.IsCachedContent()
|
| - && !dictionary_hash_is_plausible_) {
|
| + } else if (filter_context_.IsCachedContent() &&
|
| + !dictionary_hash_is_plausible_) {
|
| // We must have hit the back button, and gotten content that was fetched
|
| // before we *really* advertised SDCH and a dictionary.
|
| SdchManager::SdchErrorRecovery(SdchManager::PASS_THROUGH_OLD_CACHED);
|
| @@ -288,7 +290,7 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
|
| return FILTER_NEED_MORE_DATA;
|
|
|
| bool ret = vcdiff_streaming_decoder_->DecodeChunk(
|
| - next_stream_data_, stream_data_len_, &dest_buffer_excess_);
|
| + next_stream_data_, stream_data_len_, &dest_buffer_excess_);
|
| // Assume all data was used in decoding.
|
| next_stream_data_ = NULL;
|
| source_bytes_ += stream_data_len_;
|
| @@ -306,7 +308,7 @@ Filter::FilterStatus SdchFilter::ReadFilteredData(char* dest_buffer,
|
| dest_buffer += amount;
|
| available_space -= amount;
|
| if (0 == available_space && !dest_buffer_excess_.empty())
|
| - return FILTER_OK;
|
| + return FILTER_OK;
|
| return FILTER_NEED_MORE_DATA;
|
| }
|
|
|
| @@ -336,9 +338,10 @@ Filter::FilterStatus SdchFilter::InitializeDictionary() {
|
|
|
| SdchManager::Dictionary* dictionary = NULL;
|
| if ('\0' == dictionary_hash_[kServerIdLength - 1])
|
| - SdchManager::Global()->GetVcdiffDictionary(std::string(dictionary_hash_, 0,
|
| - kServerIdLength - 1),
|
| - url_, &dictionary);
|
| + SdchManager::Global()->GetVcdiffDictionary(
|
| + std::string(dictionary_hash_, 0, kServerIdLength - 1),
|
| + url_,
|
| + &dictionary);
|
| else
|
| dictionary_hash_is_plausible_ = false;
|
|
|
| @@ -373,9 +376,10 @@ int SdchFilter::OutputBufferExcess(char* const dest_buffer,
|
| if (dest_buffer_excess_.empty())
|
| return 0;
|
| DCHECK(dest_buffer_excess_.size() > dest_buffer_excess_index_);
|
| - size_t amount = std::min(available_space,
|
| - dest_buffer_excess_.size() - dest_buffer_excess_index_);
|
| - memcpy(dest_buffer, dest_buffer_excess_.data() + dest_buffer_excess_index_,
|
| + size_t amount = std::min(
|
| + available_space, dest_buffer_excess_.size() - dest_buffer_excess_index_);
|
| + memcpy(dest_buffer,
|
| + dest_buffer_excess_.data() + dest_buffer_excess_index_,
|
| amount);
|
| dest_buffer_excess_index_ += amount;
|
| if (dest_buffer_excess_.size() <= dest_buffer_excess_index_) {
|
|
|