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

Side by Side Diff: net/base/sdch_filter.h

Issue 40319: Use filter context to track stats better in SDCH filtering (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « net/base/filter_unittest.cc ('k') | net/base/sdch_filter.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 (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 // SdchFilter applies open_vcdiff content decoding to a datastream. 5 // SdchFilter applies open_vcdiff content decoding to a datastream.
6 // This decoding uses a pre-cached dictionary of text fragments to decode 6 // This decoding uses a pre-cached dictionary of text fragments to decode
7 // (expand) the stream back to its original contents. 7 // (expand) the stream back to its original contents.
8 // 8 //
9 // This SdchFilter internally uses open_vcdiff/vcdec library to do decoding. 9 // This SdchFilter internally uses open_vcdiff/vcdec library to do decoding.
10 // 10 //
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 std::string dictionary_hash_; 77 std::string dictionary_hash_;
78 78
79 // After assembling an entire dictionary hash (the first 9 bytes of the 79 // After assembling an entire dictionary hash (the first 9 bytes of the
80 // sdch payload, we check to see if it is plausible, meaning it has a null 80 // sdch payload, we check to see if it is plausible, meaning it has a null
81 // termination, and has 8 characters that are possible in a net-safe base64 81 // termination, and has 8 characters that are possible in a net-safe base64
82 // encoding. If the hash is not plausible, then the payload is probably not 82 // encoding. If the hash is not plausible, then the payload is probably not
83 // an SDCH encoded bundle, and various error recovery strategies can be 83 // an SDCH encoded bundle, and various error recovery strategies can be
84 // attempted. 84 // attempted.
85 bool dictionary_hash_is_plausible_; 85 bool dictionary_hash_is_plausible_;
86 86
87 // We hold an in-memory copy of the dictionary during the entire decoding. 87 // We hold an in-memory copy of the dictionary during the entire decoding, as
88 // The char* data is embedded in a RefCounted dictionary_. 88 // it is used directly by the VC-DIFF decoding system.
89 SdchManager::Dictionary* dictionary_; 89 // That char* data is part of the dictionary_ we hold a reference to.
90 scoped_refptr<SdchManager::Dictionary> dictionary_;
90 91
91 // The decoder may demand a larger output buffer than the target of 92 // The decoder may demand a larger output buffer than the target of
92 // ReadFilteredData so we buffer the excess output between calls. 93 // ReadFilteredData so we buffer the excess output between calls.
93 std::string dest_buffer_excess_; 94 std::string dest_buffer_excess_;
94 // To avoid moving strings around too much, we save the index into 95 // To avoid moving strings around too much, we save the index into
95 // dest_buffer_excess_ that has the next byte to output. 96 // dest_buffer_excess_ that has the next byte to output.
96 size_t dest_buffer_excess_index_; 97 size_t dest_buffer_excess_index_;
97 98
98 // To get stats on activities, we keep track of source and target bytes. 99 // To get stats on activities, we keep track of source and target bytes.
99 // Visit about:histograms/Sdch to see histogram data. 100 // Visit about:histograms/Sdch to see histogram data.
100 size_t source_bytes_; 101 size_t source_bytes_;
101 size_t output_bytes_; 102 size_t output_bytes_;
102 103
103 // Record of chunk processing times for this filter. Used only for stats 104 // Record of chunk processing times for this filter. Used only for stats
104 // generations in histograms. 105 // generations in histograms.
105 std::vector<base::Time> read_times_; 106 std::vector<base::Time> read_times_;
106 107
107 // Error recovery in content type may add an sdch filter type, in which case 108 // Error recovery in content type may add an sdch filter type, in which case
108 // we should gracefully perform pass through if the format is incorrect, or 109 // we should gracefully perform pass through if the format is incorrect, or
109 // an applicable dictionary can't be found. 110 // an applicable dictionary can't be found.
110 bool possible_pass_through_; 111 bool possible_pass_through_;
111 112
113 // The URL that is currently being filtered.
114 // This is used to restrict use of a dictionary to a specific URL or path.
115 GURL url_;
116
117 // To facilitate histogramming by individual filters, we store the connect
118 // time for the corresponding HTTP transaction, as well as whether this time
119 // was recalled from a cached entry. The time is approximate, and may be
120 // bogus if the data was gotten from cache (i.e., it may be LOOOONG ago).
121 const base::Time connect_time_;
122 const bool was_cached_;
123
124 // To facilitate error recovery, allow filter to know if content is text/html
125 // by checking within this mime type (we may do a meta-refresh via html).
126 std::string mime_type_;
127
112 DISALLOW_COPY_AND_ASSIGN(SdchFilter); 128 DISALLOW_COPY_AND_ASSIGN(SdchFilter);
113 }; 129 };
114 130
115 #endif // NET_BASE_SDCH_FILTER_H_ 131 #endif // NET_BASE_SDCH_FILTER_H_
OLDNEW
« no previous file with comments | « net/base/filter_unittest.cc ('k') | net/base/sdch_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698