OLD | NEW |
---|---|
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 #include "net/sdch/sdch_owner.h" | 5 #include "net/sdch/sdch_owner.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 // of |fetcher_|. | 85 // of |fetcher_|. |
86 base::Unretained(this))), | 86 base::Unretained(this))), |
87 total_dictionary_bytes_(0), | 87 total_dictionary_bytes_(0), |
88 clock_(new base::DefaultClock), | 88 clock_(new base::DefaultClock), |
89 max_total_dictionary_size_(kMaxTotalDictionarySize), | 89 max_total_dictionary_size_(kMaxTotalDictionarySize), |
90 min_space_for_dictionary_fetch_(kMinSpaceForDictionaryFetch), | 90 min_space_for_dictionary_fetch_(kMinSpaceForDictionaryFetch), |
91 #if defined(OS_CHROMEOS) | 91 #if defined(OS_CHROMEOS) |
92 // For debugging http://crbug.com/454198; remove when resolved. | 92 // For debugging http://crbug.com/454198; remove when resolved. |
93 destroyed_(0), | 93 destroyed_(0), |
94 #endif | 94 #endif |
95 memory_pressure_listener_( | 95 #if 0 |
96 // Remove memory_pressure_listener_ to investigate http://crbug.com/447208 | |
97 memory_pressure_listener_(new base::MemoryPressureListener( | |
96 base::Bind(&SdchOwner::OnMemoryPressure, | 98 base::Bind(&SdchOwner::OnMemoryPressure, |
97 // Because |memory_pressure_listener_| is owned by | 99 // Because |memory_pressure_listener_| is owned by |
98 // SdchOwner, the SdchOwner object will be available | 100 // SdchOwner, the SdchOwner object will be available |
99 // for the lifetime of |memory_pressure_listener_|. | 101 // for the lifetime of |memory_pressure_listener_|. |
100 base::Unretained(this))) { | 102 base::Unretained(this)))) { |
103 #else | |
104 memory_pressure_listener_(nullptr) { | |
105 #endif | |
davidben
2015/02/27 23:29:34
Since we'd presumably flip this back from a scoped
| |
101 #if defined(OS_CHROMEOS) | 106 #if defined(OS_CHROMEOS) |
102 // For debugging http://crbug.com/454198; remove when resolved. | 107 // For debugging http://crbug.com/454198; remove when resolved. |
103 CHECK(clock_.get()); | 108 CHECK(clock_.get()); |
104 #endif | 109 #endif |
105 manager_->AddObserver(this); | 110 manager_->AddObserver(this); |
106 } | 111 } |
107 | 112 |
108 SdchOwner::~SdchOwner() { | 113 SdchOwner::~SdchOwner() { |
109 #if defined(OS_CHROMEOS) | 114 #if defined(OS_CHROMEOS) |
110 // For debugging http://crbug.com/454198; remove when resolved. | 115 // For debugging http://crbug.com/454198; remove when resolved. |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
312 RecordDictionaryEviction(it->second.use_count, | 317 RecordDictionaryEviction(it->second.use_count, |
313 DICTIONARY_FATE_EVICT_FOR_MEMORY); | 318 DICTIONARY_FATE_EVICT_FOR_MEMORY); |
314 } | 319 } |
315 | 320 |
316 // TODO(rdsmith): Make a distinction between moderate and critical | 321 // TODO(rdsmith): Make a distinction between moderate and critical |
317 // memory pressure. | 322 // memory pressure. |
318 manager_->ClearData(); | 323 manager_->ClearData(); |
319 } | 324 } |
320 | 325 |
321 } // namespace net | 326 } // namespace net |
OLD | NEW |