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

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

Issue 1924613002: Move ui/gfx/geometry ParamTraits to ui/gfx/ipc/geometry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward declare Range in gfx_param_traits Created 4 years, 8 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/geometry/gfx_param_traits.h ('k') | ui/gfx/ipc/gfx_param_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/ipc/geometry/gfx_param_traits.cc
diff --git a/ui/gfx/ipc/gfx_param_traits.cc b/ui/gfx/ipc/geometry/gfx_param_traits.cc
similarity index 75%
copy from ui/gfx/ipc/gfx_param_traits.cc
copy to ui/gfx/ipc/geometry/gfx_param_traits.cc
index 551957e095dc6717fbc38a836933c2f7e04be89d..f6241a9cc9472fa63522c2f03cde8f5efc73ba1e 100644
--- a/ui/gfx/ipc/gfx_param_traits.cc
+++ b/ui/gfx/ipc/geometry/gfx_param_traits.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/gfx/ipc/gfx_param_traits.h"
+#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
#include <stddef.h>
#include <stdint.h>
@@ -13,7 +13,6 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/scroll_offset.h"
-#include "ui/gfx/range/range.h"
#if defined(OS_MACOSX)
#include "ipc/mach_port_mac.h"
@@ -93,7 +92,7 @@ void ParamTraits<gfx::Point3F>::Log(const gfx::Point3F& p, std::string* l) {
void ParamTraits<gfx::Size>::Write(base::Pickle* m, const gfx::Size& p) {
DCHECK_GE(p.width(), 0);
DCHECK_GE(p.height(), 0);
- int values[2] = { p.width(), p.height() };
+ int values[2] = {p.width(), p.height()};
m->WriteBytes(&values, sizeof(int) * 2);
}
@@ -116,7 +115,7 @@ void ParamTraits<gfx::Size>::Log(const gfx::Size& p, std::string* l) {
}
void ParamTraits<gfx::SizeF>::Write(base::Pickle* m, const gfx::SizeF& p) {
- float values[2] = { p.width(), p.height() };
+ float values[2] = {p.width(), p.height()};
m->WriteBytes(&values, sizeof(float) * 2);
}
@@ -143,7 +142,7 @@ void ParamTraits<gfx::Vector2d>::GetSize(base::PickleSizer* s,
void ParamTraits<gfx::Vector2d>::Write(base::Pickle* m,
const gfx::Vector2d& p) {
- int values[2] = { p.x(), p.y() };
+ int values[2] = {p.x(), p.y()};
m->WriteBytes(&values, sizeof(int) * 2);
}
@@ -165,7 +164,7 @@ void ParamTraits<gfx::Vector2d>::Log(const gfx::Vector2d& v, std::string* l) {
void ParamTraits<gfx::Vector2dF>::Write(base::Pickle* m,
const gfx::Vector2dF& p) {
- float values[2] = { p.x(), p.y() };
+ float values[2] = {p.x(), p.y()};
m->WriteBytes(&values, sizeof(float) * 2);
}
@@ -186,7 +185,7 @@ void ParamTraits<gfx::Vector2dF>::Log(const gfx::Vector2dF& v, std::string* l) {
}
void ParamTraits<gfx::Rect>::Write(base::Pickle* m, const gfx::Rect& p) {
- int values[4] = { p.x(), p.y(), p.width(), p.height() };
+ int values[4] = {p.x(), p.y(), p.width(), p.height()};
m->WriteBytes(&values, sizeof(int) * 4);
}
@@ -204,8 +203,8 @@ bool ParamTraits<gfx::Rect>::Read(const base::Pickle* m,
}
void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) {
- l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(),
- p.width(), p.height()));
+ l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), p.width(),
+ p.height()));
}
void ParamTraits<gfx::RectF>::GetSize(base::PickleSizer* s,
@@ -214,7 +213,7 @@ void ParamTraits<gfx::RectF>::GetSize(base::PickleSizer* s,
}
void ParamTraits<gfx::RectF>::Write(base::Pickle* m, const gfx::RectF& p) {
- float values[4] = { p.x(), p.y(), p.width(), p.height() };
+ float values[4] = {p.x(), p.y(), p.width(), p.height()};
m->WriteBytes(&values, sizeof(float) * 4);
}
@@ -230,28 +229,8 @@ bool ParamTraits<gfx::RectF>::Read(const base::Pickle* m,
}
void ParamTraits<gfx::RectF>::Log(const gfx::RectF& p, std::string* l) {
- l->append(base::StringPrintf("(%f, %f, %f, %f)", p.x(), p.y(),
- p.width(), p.height()));
-}
-
-void ParamTraits<gfx::Range>::Write(base::Pickle* m, const gfx::Range& r) {
- m->WriteUInt32(r.start());
- m->WriteUInt32(r.end());
-}
-
-bool ParamTraits<gfx::Range>::Read(const base::Pickle* m,
- base::PickleIterator* iter,
- gfx::Range* r) {
- uint32_t start, end;
- if (!iter->ReadUInt32(&start) || !iter->ReadUInt32(&end))
- return false;
- r->set_start(start);
- r->set_end(end);
- return true;
-}
-
-void ParamTraits<gfx::Range>::Log(const gfx::Range& r, std::string* l) {
- l->append(base::StringPrintf("(%d, %d)", r.start(), r.end()));
+ l->append(base::StringPrintf("(%f, %f, %f, %f)", p.x(), p.y(), p.width(),
+ p.height()));
}
void ParamTraits<gfx::ScrollOffset>::Write(base::Pickle* m,
@@ -282,52 +261,4 @@ void ParamTraits<gfx::ScrollOffset>::Log(const param_type& p, std::string* l) {
l->append(")");
}
-#if defined(OS_MACOSX) && !defined(OS_IOS)
-void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Write(
- base::Pickle* m,
- const param_type p) {
- MachPortMac mach_port_mac(p.get());
- ParamTraits<MachPortMac>::Write(m, mach_port_mac);
-}
-
-bool ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Read(
- const base::Pickle* m,
- base::PickleIterator* iter,
- param_type* r) {
- MachPortMac mach_port_mac;
- if (!ParamTraits<MachPortMac>::Read(m, iter, &mach_port_mac))
- return false;
- r->reset(mach_port_mac.get_mach_port());
- return true;
-}
-
-void ParamTraits<gfx::ScopedRefCountedIOSurfaceMachPort>::Log(
- const param_type& p,
- std::string* l) {
- l->append("IOSurface Mach send right: ");
- LogParam(p.get(), l);
-}
-#endif // defined(OS_MACOSX) && !defined(OS_IOS)
-
-} // namespace IPC
-
-// Generate param traits write methods.
-#include "ipc/param_traits_write_macros.h"
-namespace IPC {
-#undef UI_GFX_IPC_GFX_PARAM_TRAITS_MACROS_H_
-#include "ui/gfx/ipc/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_GFX_PARAM_TRAITS_MACROS_H_
-#include "ui/gfx/ipc/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_GFX_PARAM_TRAITS_MACROS_H_
-#include "ui/gfx/ipc/gfx_param_traits_macros.h"
} // namespace IPC
« no previous file with comments | « ui/gfx/ipc/geometry/gfx_param_traits.h ('k') | ui/gfx/ipc/gfx_param_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698