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

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

Issue 2150013003: Add IPC support for gfx::ColorSpace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl try 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
new file mode 100644
index 0000000000000000000000000000000000000000..5853f6ba0cd77b861a150cb0023c5fc788e659a6
--- /dev/null
+++ b/ui/gfx/ipc/color/gfx_param_traits.cc
@@ -0,0 +1,91 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/gfx/ipc/color/gfx_param_traits.h"
+
+#include "ui/gfx/color_space.h"
+#include "ui/gfx/ipc/color/gfx_param_traits_macros.h"
+
+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;
+ }
+ }
+}
+
+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;
+ }
+ }
+}
+
+bool ParamTraits<gfx::ColorSpace>::Read(const base::Pickle* m,
+ base::PickleIterator* iter,
+ gfx::ColorSpace* r) {
+ if (!ReadParam(m, iter, &r->type_))
+ 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;
+}
+
+void ParamTraits<gfx::ColorSpace>::Log(const gfx::ColorSpace& p,
+ std::string* l) {
+ l->append("<gfx::ColorSpace>");
+}
+
+} // namespace IPC
+
+// Generate param traits size methods.
+#include "ipc/param_traits_size_macros.h"
+namespace IPC {
+#undef UI_GFX_IPC_COLOR_GFX_PARAM_TRAITS_MACROS_H_
+#include "ui/gfx/ipc/color/gfx_param_traits_macros.h"
+}
+
+// Generate param traits write methods.
+#include "ipc/param_traits_write_macros.h"
+namespace IPC {
+#undef UI_GFX_IPC_COLOR_GFX_PARAM_TRAITS_MACROS_H_
+#include "ui/gfx/ipc/color/gfx_param_traits_macros.h"
+} // namespace IPC
+
+// Generate param traits read methods.
+#include "ipc/param_traits_read_macros.h"
+namespace IPC {
+#undef UI_GFX_IPC_COLOR_GFX_PARAM_TRAITS_MACROS_H_
+#include "ui/gfx/ipc/color/gfx_param_traits_macros.h"
+} // namespace IPC
+
+// Generate param traits log methods.
+#include "ipc/param_traits_log_macros.h"
+namespace IPC {
+#undef UI_GFX_IPC_COLOR_GFX_PARAM_TRAITS_MACROS_H_
+#include "ui/gfx/ipc/color/gfx_param_traits_macros.h"
+} // namespace IPC
« 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