summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 03:29:26 +0000
committerjeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-17 03:29:26 +0000
commit2019966658e19a873744641668e134b92123f1d5 (patch)
tree853ac0828cc46bec543851b7c57c70a3bb1fc06e /ipc
parentf7d992aa311c3cec1fc95ce06338b129f4b34cbe (diff)
downloadchromium_src-2019966658e19a873744641668e134b92123f1d5.zip
chromium_src-2019966658e19a873744641668e134b92123f1d5.tar.gz
chromium_src-2019966658e19a873744641668e134b92123f1d5.tar.bz2
Mac: More pluming for OOP font loading
* Add font_descriptor and corresponding pluming to send an NSFont over IPC. * Rejigger font_loader to accept an NSFont as input and output an ATSFontContainerRef. The reasoning behind this is that WebKit ultimately controls the font lifetime and we can only deactivate the font container once the font is no longer in use. BUG=29729 Test=Unit tests should pass. Review URL: http://codereview.chromium.org/2804001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc')
-rw-r--r--ipc/ipc_message_utils.h39
1 files changed, 31 insertions, 8 deletions
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index df2c6c7..46c7298 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -226,6 +226,31 @@ 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;
+ int data_size;
+ if (!m->ReadData(iter, &data, &data_size) ||
+ data_size != sizeof(param_type)) {
+ NOTREACHED();
+ return false;
+ }
+ memcpy(r, data, sizeof(param_type));
+ return true;
+ }
+ static void Log(const param_type& p, std::wstring* l) {
+ l->append(StringPrintf(L"e", p));
+ }
+};
+
template <>
struct ParamTraits<double> {
typedef double param_type;
@@ -234,16 +259,14 @@ struct ParamTraits<double> {
}
static bool Read(const Message* m, void** iter, param_type* r) {
const char *data;
- 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;
+ int data_size;
+ if (!m->ReadData(iter, &data, &data_size) ||
+ data_size != sizeof(param_type)) {
NOTREACHED();
+ return false;
}
-
- return result;
+ memcpy(r, data, sizeof(param_type));
+ return true;
}
static void Log(const param_type& p, std::wstring* l) {
l->append(StringPrintf(L"e", p));