| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <windows.h> | 7 #include <windows.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 base::LazyInstance<base::Lock>::DestructorAtExit | 36 base::LazyInstance<base::Lock>::DestructorAtExit |
| 37 g_best_monitor_color_space_lock = LAZY_INSTANCE_INITIALIZER; | 37 g_best_monitor_color_space_lock = LAZY_INSTANCE_INITIALIZER; |
| 38 base::LazyInstance<gfx::ICCProfile>::DestructorAtExit | 38 base::LazyInstance<gfx::ICCProfile>::DestructorAtExit |
| 39 g_best_monitor_color_space = LAZY_INSTANCE_INITIALIZER; | 39 g_best_monitor_color_space = LAZY_INSTANCE_INITIALIZER; |
| 40 bool g_has_initialized_best_monitor_color_space = false; | 40 bool g_has_initialized_best_monitor_color_space = false; |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 ICCProfile ICCProfile::FromBestMonitor() { | 45 ICCProfile ICCProfile::FromBestMonitor() { |
| 46 if (HasForcedProfile()) |
| 47 return GetForcedProfile(); |
| 48 |
| 46 base::AutoLock lock(g_best_monitor_color_space_lock.Get()); | 49 base::AutoLock lock(g_best_monitor_color_space_lock.Get()); |
| 47 return g_best_monitor_color_space.Get(); | 50 return g_best_monitor_color_space.Get(); |
| 48 } | 51 } |
| 49 | 52 |
| 50 // static | 53 // static |
| 51 bool ICCProfile::CachedProfilesNeedUpdate() { | 54 bool ICCProfile::CachedProfilesNeedUpdate() { |
| 52 base::AutoLock lock(g_best_monitor_color_space_lock.Get()); | 55 base::AutoLock lock(g_best_monitor_color_space_lock.Get()); |
| 53 return !g_has_initialized_best_monitor_color_space; | 56 return !g_has_initialized_best_monitor_color_space; |
| 54 } | 57 } |
| 55 | 58 |
| 56 // static | 59 // static |
| 57 void ICCProfile::UpdateCachedProfilesOnBackgroundThread() { | 60 void ICCProfile::UpdateCachedProfilesOnBackgroundThread() { |
| 58 std::vector<char> icc_profile; | 61 std::vector<char> icc_profile; |
| 59 ReadBestMonitorICCProfile(&icc_profile); | 62 ReadBestMonitorICCProfile(&icc_profile); |
| 60 gfx::ICCProfile color_space = FromData( | 63 gfx::ICCProfile color_space = FromData( |
| 61 icc_profile.data(), icc_profile.size()); | 64 icc_profile.data(), icc_profile.size()); |
| 62 | 65 |
| 63 base::AutoLock lock(g_best_monitor_color_space_lock.Get()); | 66 base::AutoLock lock(g_best_monitor_color_space_lock.Get()); |
| 64 g_best_monitor_color_space.Get() = color_space; | 67 g_best_monitor_color_space.Get() = color_space; |
| 65 g_has_initialized_best_monitor_color_space = true; | 68 g_has_initialized_best_monitor_color_space = true; |
| 66 } | 69 } |
| 67 | 70 |
| 68 } // namespace gfx | 71 } // namespace gfx |
| OLD | NEW |