Index: ui/gfx/color_space.h |
diff --git a/ui/gfx/color_space.h b/ui/gfx/color_space.h |
index 0129e7e1cb4282c8ac765a927293bf19455c0afd..44a85eb4a761a7d8457ef00635d0d01183430bd5 100644 |
--- a/ui/gfx/color_space.h |
+++ b/ui/gfx/color_space.h |
@@ -8,6 +8,7 @@ |
#include <vector> |
#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
#include "build/build_config.h" |
#include "ui/gfx/gfx_export.h" |
@@ -25,6 +26,7 @@ class GFX_EXPORT ColorSpace { |
ColorSpace& operator=(const ColorSpace& other); |
~ColorSpace(); |
bool operator==(const ColorSpace& other) const; |
+ bool operator<(const ColorSpace& other) const; |
// Returns the color profile of the monitor that can best represent color. |
// This profile should be used for creating content that does not know on |
@@ -35,7 +37,7 @@ class GFX_EXPORT ColorSpace { |
static ColorSpace FromCGColorSpace(CGColorSpaceRef cg_color_space); |
#endif |
- const std::vector<char>& GetICCProfile() const { return icc_profile_; } |
+ const std::vector<char>& GetICCProfile() const; |
#if defined(OS_WIN) |
// This will read monitor ICC profiles from disk and cache the results for the |
@@ -47,7 +49,20 @@ class GFX_EXPORT ColorSpace { |
static bool IsValidProfileLength(size_t length); |
private: |
- std::vector<char> icc_profile_; |
+ struct Key; |
+ class GlobalData; |
+ friend struct Key; |
+ friend class GlobalData; |
+ enum class Type { |
+ UNDEFINED, |
+ ICC_PROFILE, |
+ }; |
+ Type type_ = Type::UNDEFINED; |
+ |
+ // GlobalData stores large or expensive-to-compute data about a color space |
+ // (e.g, ICC profile). This structure is shared by all identical ColorSpace |
+ // objects in the process. It is lazily initialized for named color spaces. |
+ mutable scoped_refptr<GlobalData> global_data_; |
}; |
} // namespace gfx |