summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_message_utils.h
diff options
context:
space:
mode:
authortsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 23:12:28 +0000
committertsepez@chromium.org <tsepez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-12 23:12:28 +0000
commitc1ee48d04fb70cd0ac6dcf34d6a1ce59b2b9b565 (patch)
tree46e93af4692c896290c09098858804f781898099 /ipc/ipc_message_utils.h
parent94aaf8a94581679fe64dc9d22b25df006bad015b (diff)
downloadchromium_src-c1ee48d04fb70cd0ac6dcf34d6a1ce59b2b9b565.zip
chromium_src-c1ee48d04fb70cd0ac6dcf34d6a1ce59b2b9b565.tar.gz
chromium_src-c1ee48d04fb70cd0ac6dcf34d6a1ce59b2b9b565.tar.bz2
Add support for marshalling unsigned char in IPC.
Previously, we've supported unsigned short, but not unsigned char. There are a few places where folks are passing around color values that must be in the 0..255, and we can save both bytes written and avoid explicit range checks by the receiving method by using this rather than larger types. We support unsigned char only. Signed char is evil due to questionable signedness in the C specs. I've re-arranged the order of these specializatons so that they go in order of increasing size as they go down the page. R=jam@chromium.org BUG=259903 Review URL: https://chromiumcodereview.appspot.com/18068016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211473 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_message_utils.h')
-rw-r--r--ipc/ipc_message_utils.h24
1 files changed, 16 insertions, 8 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 7fda943..4db8b12 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -121,6 +121,22 @@ struct ParamTraits<bool> {
};
template <>
+struct IPC_EXPORT ParamTraits<unsigned char> {
+ typedef unsigned short param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct IPC_EXPORT ParamTraits<unsigned short> {
+ typedef unsigned short param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, PickleIterator* iter, param_type* r);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
struct ParamTraits<int> {
typedef int param_type;
static void Write(Message* m, const param_type& p) {
@@ -194,14 +210,6 @@ struct ParamTraits<unsigned long long> {
IPC_EXPORT static void Log(const param_type& p, std::string* l);
};
-template <>
-struct IPC_EXPORT ParamTraits<unsigned short> {
- typedef unsigned short param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, PickleIterator* iter, param_type* r);
- static void Log(const param_type& p, std::string* l);
-};
-
// Note that the IPC layer doesn't sanitize NaNs and +/- INF values. Clients
// should be sure to check the sanity of these values after receiving them over
// IPC.