summaryrefslogtreecommitdiffstats
path: root/content/common/common_param_traits.h
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 22:54:43 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-10 22:54:43 +0000
commitd6d8f719ce2e6c1483e085523ddb963eba1b6514 (patch)
tree368bb1396420155025fe41e5f13b5b7468b574f9 /content/common/common_param_traits.h
parent9fefe44a6503d060cd7cc38df910f09b3164c5e0 (diff)
downloadchromium_src-d6d8f719ce2e6c1483e085523ddb963eba1b6514.zip
chromium_src-d6d8f719ce2e6c1483e085523ddb963eba1b6514.tar.gz
chromium_src-d6d8f719ce2e6c1483e085523ddb963eba1b6514.tar.bz2
Move GPU messages to content. I've also switched the IPC structs to use the new IPC macros that generate serialization code.
Review URL: http://codereview.chromium.org/6673003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77721 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common/common_param_traits.h')
-rw-r--r--content/common/common_param_traits.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h
index f6f79b6..20c5be3 100644
--- a/content/common/common_param_traits.h
+++ b/content/common/common_param_traits.h
@@ -27,11 +27,18 @@
// TODO(erg): The following headers are historical and only work because
// their definitions are inlined, which also needs to be fixed.
+#include "ui/gfx/native_widget_types.h"
#include "webkit/glue/resource_type.h"
// Forward declarations.
class GURL;
+namespace gfx {
+class Point;
+class Rect;
+class Size;
+} // namespace gfx
+
namespace net {
class HttpResponseHeaders;
class HostPortPair;
@@ -122,6 +129,62 @@ struct SimilarTypeTraits<base::PlatformFileError> {
typedef int Type;
};
+template <>
+struct ParamTraits<gfx::Point> {
+ typedef gfx::Point param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<gfx::Size> {
+ typedef gfx::Size param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<gfx::Rect> {
+ typedef gfx::Rect param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<gfx::NativeWindow> {
+ typedef gfx::NativeWindow param_type;
+ static void Write(Message* m, const param_type& p) {
+#if defined(OS_WIN)
+ // HWNDs are always 32 bits on Windows, even on 64 bit systems.
+ m->WriteUInt32(reinterpret_cast<uint32>(p));
+#else
+ m->WriteData(reinterpret_cast<const char*>(&p), sizeof(p));
+#endif
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+#if defined(OS_WIN)
+ return m->ReadUInt32(iter, reinterpret_cast<uint32*>(r));
+#else
+ const char *data;
+ int data_size = 0;
+ bool result = m->ReadData(iter, &data, &data_size);
+ if (result && data_size == sizeof(gfx::NativeWindow)) {
+ memcpy(r, data, sizeof(gfx::NativeWindow));
+ } else {
+ result = false;
+ NOTREACHED();
+ }
+ return result;
+#endif
+ }
+ static void Log(const param_type& p, std::string* l) {
+ l->append("<gfx::NativeWindow>");
+ }
+};
+
} // namespace IPC
#endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_