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

Unified Diff: ui/gfx/ipc/color/gfx_param_traits.cc

Issue 2161293002: Color: Separate ICCProfile and ColorSpace structures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporate review feedback Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/ipc/color/gfx_param_traits.h ('k') | ui/gfx/ipc/color/gfx_param_traits_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ipc/color/gfx_param_traits.cc
diff --git a/ui/gfx/ipc/color/gfx_param_traits.cc b/ui/gfx/ipc/color/gfx_param_traits.cc
index 5853f6ba0cd77b861a150cb0023c5fc788e659a6..abf6054dcf1555bb05de1e5a6e6ef587ffc996f7 100644
--- a/ui/gfx/ipc/color/gfx_param_traits.cc
+++ b/ui/gfx/ipc/color/gfx_param_traits.cc
@@ -11,48 +11,31 @@ namespace IPC {
void ParamTraits<gfx::ColorSpace>::GetSize(base::PickleSizer* s,
const gfx::ColorSpace& p) {
- GetParamSize(s, p.type_);
- switch (p.type_) {
- case gfx::ColorSpace::Type::UNDEFINED:
- break;
- case gfx::ColorSpace::Type::ICC_PROFILE: {
- GetParamSize(s, p.GetICCProfile());
- break;
- }
- }
+ GetParamSize(s, p.valid_);
+ if (!p.valid_)
+ return;
+ GetParamSize(s, p.icc_profile_id_);
}
void ParamTraits<gfx::ColorSpace>::Write(base::Pickle* m,
const gfx::ColorSpace& p) {
- std::vector<char> icc_profile = p.GetICCProfile();
- WriteParam(m, p.type_);
- switch (p.type_) {
- case gfx::ColorSpace::Type::UNDEFINED:
- break;
- case gfx::ColorSpace::Type::ICC_PROFILE: {
- WriteParam(m, p.GetICCProfile());
- break;
- }
- }
+ WriteParam(m, p.valid_);
+ if (!p.valid_)
+ return;
+ WriteParam(m, p.icc_profile_id_);
}
bool ParamTraits<gfx::ColorSpace>::Read(const base::Pickle* m,
base::PickleIterator* iter,
gfx::ColorSpace* r) {
- if (!ReadParam(m, iter, &r->type_))
+ if (!ReadParam(m, iter, &r->valid_))
return false;
- switch (r->type_) {
- case gfx::ColorSpace::Type::UNDEFINED:
- return true;
- case gfx::ColorSpace::Type::ICC_PROFILE: {
- std::vector<char> icc_profile;
- if (!ReadParam(m, iter, &icc_profile))
- return false;
- *r = gfx::ColorSpace::FromICCProfile(icc_profile);
- return true;
- }
- }
- return false;
+ if (!r->valid_)
+ return true;
+
+ if (!ReadParam(m, iter, &r->icc_profile_id_))
+ return false;
+ return true;
}
void ParamTraits<gfx::ColorSpace>::Log(const gfx::ColorSpace& p,
« no previous file with comments | « ui/gfx/ipc/color/gfx_param_traits.h ('k') | ui/gfx/ipc/color/gfx_param_traits_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698