OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/gfx/icc_profile.h" | 5 #include "ui/gfx/icc_profile.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/containers/mru_cache.h" | 9 #include "base/containers/mru_cache.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 struct Cache { | 32 struct Cache { |
33 Cache() : id_to_icc_profile_mru(kMaxCachedICCProfiles) {} | 33 Cache() : id_to_icc_profile_mru(kMaxCachedICCProfiles) {} |
34 ~Cache() {} | 34 ~Cache() {} |
35 | 35 |
36 // Start from-ICC-data IDs at the end of the hard-coded test id list above. | 36 // Start from-ICC-data IDs at the end of the hard-coded test id list above. |
37 uint64_t next_unused_id = 10; | 37 uint64_t next_unused_id = 10; |
38 base::MRUCache<uint64_t, ICCProfile> id_to_icc_profile_mru; | 38 base::MRUCache<uint64_t, ICCProfile> id_to_icc_profile_mru; |
39 base::Lock lock; | 39 base::Lock lock; |
40 }; | 40 }; |
41 static base::LazyInstance<Cache> g_cache; | 41 static base::LazyInstance<Cache>::DestructorAtExit g_cache = |
| 42 LAZY_INSTANCE_INITIALIZER; |
42 | 43 |
43 } // namespace | 44 } // namespace |
44 | 45 |
45 ICCProfile::ICCProfile() = default; | 46 ICCProfile::ICCProfile() = default; |
46 ICCProfile::ICCProfile(ICCProfile&& other) = default; | 47 ICCProfile::ICCProfile(ICCProfile&& other) = default; |
47 ICCProfile::ICCProfile(const ICCProfile& other) = default; | 48 ICCProfile::ICCProfile(const ICCProfile& other) = default; |
48 ICCProfile& ICCProfile::operator=(ICCProfile&& other) = default; | 49 ICCProfile& ICCProfile::operator=(ICCProfile&& other) = default; |
49 ICCProfile& ICCProfile::operator=(const ICCProfile& other) = default; | 50 ICCProfile& ICCProfile::operator=(const ICCProfile& other) = default; |
50 ICCProfile::~ICCProfile() = default; | 51 ICCProfile::~ICCProfile() = default; |
51 | 52 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 cache.id_to_icc_profile_mru.Put(id_, *this); | 210 cache.id_to_icc_profile_mru.Put(id_, *this); |
210 } | 211 } |
211 } | 212 } |
212 | 213 |
213 // static | 214 // static |
214 bool ICCProfile::IsValidProfileLength(size_t length) { | 215 bool ICCProfile::IsValidProfileLength(size_t length) { |
215 return length >= kMinProfileLength && length <= kMaxProfileLength; | 216 return length >= kMinProfileLength && length <= kMaxProfileLength; |
216 } | 217 } |
217 | 218 |
218 } // namespace gfx | 219 } // namespace gfx |
OLD | NEW |