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

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

Issue 711753003: Pin dictionaries from being deleted while request is outstanding. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporated comments; fixed try job errors. Created 6 years, 1 month 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
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 // 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 std::string dictionary_hash_; 82 std::string dictionary_hash_;
83 83
84 // After assembling an entire dictionary hash (the first 9 bytes of the 84 // After assembling an entire dictionary hash (the first 9 bytes of the
85 // sdch payload, we check to see if it is plausible, meaning it has a null 85 // sdch payload, we check to see if it is plausible, meaning it has a null
86 // termination, and has 8 characters that are possible in a net-safe base64 86 // termination, and has 8 characters that are possible in a net-safe base64
87 // encoding. If the hash is not plausible, then the payload is probably not 87 // encoding. If the hash is not plausible, then the payload is probably not
88 // an SDCH encoded bundle, and various error recovery strategies can be 88 // an SDCH encoded bundle, and various error recovery strategies can be
89 // attempted. 89 // attempted.
90 bool dictionary_hash_is_plausible_; 90 bool dictionary_hash_is_plausible_;
91 91
92 // We hold an in-memory copy of the dictionary during the entire decoding, as 92 // Validity of this pointer is guaranteed by either the FilterContext holding
93 // it is used directly by the VC-DIFF decoding system. 93 // a containing SdchManager::DictionarySet, or this object holding a
94 // That char* data is part of the dictionary_ we hold a reference to. 94 // container in |unexpected_dictionary_handle_| below.
95 scoped_refptr<SdchManager::Dictionary> dictionary_; 95 const SdchManager::Dictionary *dictionary_;
96 96
97 // We keep a copy of the URLRequestContext for use in the destructor, (at 97 // We keep a copy of the URLRequestContext for use in the destructor, (at
98 // which point GetURLRequestContext() will likely return null because of 98 // which point GetURLRequestContext() will likely return null because of
99 // the disassociation of the URLRequest from the URLRequestJob). This is 99 // the disassociation of the URLRequest from the URLRequestJob). This is
100 // safe because the URLRequestJob (and any filters) are guaranteed to be 100 // safe because the URLRequestJob (and any filters) are guaranteed to be
101 // deleted before the URLRequestContext is destroyed. 101 // deleted before the URLRequestContext is destroyed.
102 const URLRequestContext* const url_request_context_; 102 const URLRequestContext* const url_request_context_;
103 103
104 // The decoder may demand a larger output buffer than the target of 104 // The decoder may demand a larger output buffer than the target of
105 // ReadFilteredData so we buffer the excess output between calls. 105 // ReadFilteredData so we buffer the excess output between calls.
(...skipping 13 matching lines...) Expand all
119 bool possible_pass_through_; 119 bool possible_pass_through_;
120 120
121 // The URL that is currently being filtered. 121 // The URL that is currently being filtered.
122 // This is used to restrict use of a dictionary to a specific URL or path. 122 // This is used to restrict use of a dictionary to a specific URL or path.
123 GURL url_; 123 GURL url_;
124 124
125 // To facilitate error recovery, allow filter to know if content is text/html 125 // To facilitate error recovery, allow filter to know if content is text/html
126 // by checking within this mime type (we may do a meta-refresh via html). 126 // by checking within this mime type (we may do a meta-refresh via html).
127 std::string mime_type_; 127 std::string mime_type_;
128 128
129 // If the response was encoded with a dictionary different than those
130 // advertised (e.g. a cached response using an old dictionary), this
131 // variable preserves that dictionary from deletion during decoding.
132 scoped_ptr<SdchManager::DictionarySet> unexpected_dictionary_handle_;
133
129 DISALLOW_COPY_AND_ASSIGN(SdchFilter); 134 DISALLOW_COPY_AND_ASSIGN(SdchFilter);
130 }; 135 };
131 136
132 } // namespace net 137 } // namespace net
133 138
134 #endif // NET_FILTER_SDCH_FILTER_H_ 139 #endif // NET_FILTER_SDCH_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698