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

Side by Side Diff: net/sdch/sdch_owner.h

Issue 1051353003: SDCH: add TimeWeightedMemoryUse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't reset clock 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 | « no previous file | net/sdch/sdch_owner.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 #ifndef NET_SDCH_SDCH_OWNER_H_ 5 #ifndef NET_SDCH_SDCH_OWNER_H_
6 #define NET_SDCH_SDCH_OWNER_H_ 6 #define NET_SDCH_SDCH_OWNER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 // Schedule loading of all dictionaries described in |persisted_info|. 110 // Schedule loading of all dictionaries described in |persisted_info|.
111 // Returns false and does not schedule a load if |persisted_info| has an 111 // Returns false and does not schedule a load if |persisted_info| has an
112 // unsupported version or no dictionaries key. Skips any dictionaries that are 112 // unsupported version or no dictionaries key. Skips any dictionaries that are
113 // malformed in |persisted_info|. 113 // malformed in |persisted_info|.
114 bool SchedulePersistedDictionaryLoads( 114 bool SchedulePersistedDictionaryLoads(
115 const base::DictionaryValue& persisted_info); 115 const base::DictionaryValue& persisted_info);
116 116
117 bool IsPersistingDictionaries() const; 117 bool IsPersistingDictionaries() const;
118 118
119 enum DictionaryFate {
120 // A Get-Dictionary header wasn't acted on.
121 DICTIONARY_FATE_GET_IGNORED = 1,
122
123 // A fetch was attempted, but failed.
124 // TODO(rdsmith): Actually record this case.
125 DICTIONARY_FATE_FETCH_FAILED = 2,
126
127 // A successful fetch was dropped on the floor, no space.
128 DICTIONARY_FATE_FETCH_IGNORED_NO_SPACE = 3,
129
130 // A successful fetch was refused by the SdchManager.
131 DICTIONARY_FATE_FETCH_MANAGER_REFUSED = 4,
132
133 // A dictionary was successfully added based on
134 // a Get-Dictionary header in a response.
135 DICTIONARY_FATE_ADD_RESPONSE_TRIGGERED = 5,
136
137 // A dictionary was evicted by an incoming dict.
138 DICTIONARY_FATE_EVICT_FOR_DICT = 6,
139
140 // A dictionary was evicted by memory pressure.
141 DICTIONARY_FATE_EVICT_FOR_MEMORY = 7,
142
143 // A dictionary was evicted on destruction.
144 DICTIONARY_FATE_EVICT_FOR_DESTRUCTION = 8,
145
146 // A dictionary was successfully added based on
147 // persistence from a previous browser revision.
148 DICTIONARY_FATE_ADD_PERSISTENCE_TRIGGERED = 9,
149
150 // A dictionary was unloaded on destruction, but is still present on disk.
151 DICTIONARY_FATE_UNLOAD_FOR_DESTRUCTION = 10,
152
153 DICTIONARY_FATE_MAX = 11
154 };
155
156 void RecordDictionaryFate(DictionaryFate fate);
157
158 // Record the lifetime memory use of a specified dictionary, identified by
159 // server hash.
160 void RecordDictionaryEvictionOrUnload(
161 const std::string& server_hash,
162 size_t size,
163 int use_count, DictionaryFate fate);
164
119 // For investigation of http://crbug.com/454198; remove when resolved. 165 // For investigation of http://crbug.com/454198; remove when resolved.
120 base::WeakPtr<net::SdchManager> manager_; 166 base::WeakPtr<net::SdchManager> manager_;
121 scoped_ptr<net::SdchDictionaryFetcher> fetcher_; 167 scoped_ptr<net::SdchDictionaryFetcher> fetcher_;
122 168
123 size_t total_dictionary_bytes_; 169 size_t total_dictionary_bytes_;
124 170
125 scoped_ptr<base::Clock> clock_; 171 scoped_ptr<base::Clock> clock_;
126 172
127 size_t max_total_dictionary_size_; 173 size_t max_total_dictionary_size_;
128 size_t min_space_for_dictionary_fetch_; 174 size_t min_space_for_dictionary_fetch_;
(...skipping 22 matching lines...) Expand all
151 197
152 WriteablePrefStore* pref_store_; 198 WriteablePrefStore* pref_store_;
153 199
154 // The use counts of dictionaries when they were loaded from the persistent 200 // The use counts of dictionaries when they were loaded from the persistent
155 // store, keyed by server hash. These are stored to avoid generating 201 // store, keyed by server hash. These are stored to avoid generating
156 // misleading ever-increasing use counts for dictionaries that are persisted, 202 // misleading ever-increasing use counts for dictionaries that are persisted,
157 // since the UMA histogram for use counts is only supposed to be since last 203 // since the UMA histogram for use counts is only supposed to be since last
158 // load. 204 // load.
159 std::map<std::string, int> use_counts_at_load_; 205 std::map<std::string, int> use_counts_at_load_;
160 206
207 // Load times for loaded dictionaries, keyed by server hash. These are used to
208 // track the durations that dictionaries are in memory.
209 std::map<std::string, base::Time> load_times_;
210
211 // Byte-seconds consumed by dictionaries that have been unloaded. These are
212 // stored for later uploading in the SdchOwner destructor.
213 std::vector<int64> consumed_byte_seconds_;
214
215 // Creation time for this SdchOwner object, used for reporting temporal memory
216 // pressure.
217 base::Time creation_time_;
218
161 DISALLOW_COPY_AND_ASSIGN(SdchOwner); 219 DISALLOW_COPY_AND_ASSIGN(SdchOwner);
162 }; 220 };
163 221
164 } // namespace net 222 } // namespace net
165 223
166 #endif // NET_SDCH_SDCH_OWNER_H_ 224 #endif // NET_SDCH_SDCH_OWNER_H_
OLDNEW
« no previous file with comments | « no previous file | net/sdch/sdch_owner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698