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

Unified Diff: ipc/ipc_message_utils.h

Issue 2804001: Mac: More pluming for OOP font loading (Closed)
Patch Set: Fix review comments Created 10 years, 6 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
Index: ipc/ipc_message_utils.h
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index df2c6c7693ff7df67e3148b5cd8e0d211df54b88..747d2620cfca91aae76e9a03d528f083df85b835 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -226,6 +226,33 @@ struct ParamTraits<unsigned long long> {
}
};
+// 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.
+template <>
+struct ParamTraits<float> {
+ typedef float param_type;
+ static void Write(Message* m, const param_type& p) {
+ m->WriteData(reinterpret_cast<const char*>(&p), sizeof(param_type));
+ }
+ static bool Read(const Message* m, void** iter, param_type* r) {
+ const char *data;
agl 2010/06/15 14:10:15 Seems over complex: const char* data; int data_si
jeremy 2010/06/15 14:26:55 Agreed, I wanted to match the definition for doubl
+ int data_size = 0;
+ bool result = m->ReadData(iter, &data, &data_size);
+ if (result && data_size == sizeof(param_type)) {
+ memcpy(r, data, sizeof(param_type));
+ } else {
+ result = false;
+ NOTREACHED();
+ }
+
+ return result;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(StringPrintf(L"e", p));
+ }
+};
+
template <>
struct ParamTraits<double> {
typedef double param_type;
« chrome/common/render_messages_internal.h ('K') | « chrome/common/sandbox_mac_fontloading_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698