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

Side by Side Diff: ui/gfx/icc_profile.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 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
« no previous file with comments | « ui/gfx/font_list.cc ('k') | ui/gfx/icc_profile_win.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 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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/font_list.cc ('k') | ui/gfx/icc_profile_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698