OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // IPC messages for font discovery. |
| 6 // Multiply-included message file, hence no include guard. |
| 7 |
| 8 #include "content/common/content_export.h" |
| 9 #include "content/common/content_param_traits.h" |
| 10 #include "content/public/common/common_param_traits.h" |
| 11 #include "ipc/ipc_message_macros.h" |
| 12 #include "skia/ext/refptr.h" |
| 13 #include "third_party/skia/include/core/SkDataTable.h" |
| 14 #include "third_party/skia/include/core/SkStream.h" |
| 15 #include "third_party/skia/include/core/SkString.h" |
| 16 #include "third_party/skia/include/ports/SkFontMgr_indirect.h" |
| 17 #include "third_party/skia/include/ports/SkFontStyle.h" |
| 18 |
| 19 #undef IPC_MESSAGE_EXPORT |
| 20 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 21 |
| 22 #ifdef IPC_MESSAGE_START |
| 23 #error IPC_MESSAGE_START |
| 24 #endif |
| 25 |
| 26 #define IPC_MESSAGE_START FontMsgStart |
| 27 |
| 28 #ifndef CONTENT_COMMON_FONTMGR_MESSAGES_H_ |
| 29 #define CONTENT_COMMON_FONTMGR_MESSAGES_H_ |
| 30 |
| 31 namespace IPC { |
| 32 template<> |
| 33 struct ParamTraits<SkString> { |
| 34 typedef SkString param_type; |
| 35 static void Write(Message* m, const param_type& p); |
| 36 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 37 static void Log(const param_type& p, std::string* l); |
| 38 }; |
| 39 |
| 40 // SkStream is not default constructable, no ParamTraits<T>. |
| 41 template<> |
| 42 struct ParamTraits<skia::RefPtr<SkStream> > { |
| 43 typedef skia::RefPtr<SkStream> param_type; |
| 44 static void Write(Message* m, const param_type& p); |
| 45 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 46 static void Log(const param_type& p, std::string* l); |
| 47 }; |
| 48 |
| 49 // SkDataTable is not default constructable, no ParamTraits<T>. |
| 50 template<> |
| 51 struct ParamTraits<skia::RefPtr<SkDataTable> > { |
| 52 typedef skia::RefPtr<SkDataTable> param_type; |
| 53 static void Write(Message* m, const param_type& p); |
| 54 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 55 static void Log(const param_type& p, std::string* l); |
| 56 }; |
| 57 |
| 58 // SkRemotableFontIdentitySet not default constructable, no ParamTraits<T>. |
| 59 template<> |
| 60 struct ParamTraits<skia::RefPtr<SkRemotableFontIdentitySet> > { |
| 61 typedef skia::RefPtr<SkRemotableFontIdentitySet> param_type; |
| 62 static void Write(Message* m, const param_type& p); |
| 63 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 64 static void Log(const param_type& p, std::string* l); |
| 65 }; |
| 66 |
| 67 template<> |
| 68 struct ParamTraits<SkFontStyle> { |
| 69 typedef SkFontStyle param_type; |
| 70 static void Write(Message* m, const param_type& p); |
| 71 static bool Read(const Message* m, PickleIterator* iter, param_type* r); |
| 72 static void Log(const param_type& p, std::string* l); |
| 73 }; |
| 74 |
| 75 } // namespace IPC |
| 76 |
| 77 #endif // CONTENT_COMMON_FONTMGR_MESSAGES_H_ |
| 78 |
| 79 IPC_STRUCT_TRAITS_BEGIN(SkFontIdentity) |
| 80 IPC_STRUCT_TRAITS_MEMBER(fDataId) |
| 81 IPC_STRUCT_TRAITS_MEMBER(fTtcIndex) |
| 82 IPC_STRUCT_TRAITS_MEMBER(fFontStyle) |
| 83 IPC_STRUCT_TRAITS_END() |
| 84 |
| 85 IPC_SYNC_MESSAGE_ROUTED0_1(FontMsg_GetFamilyNames, |
| 86 skia::RefPtr<SkDataTable> /* familyNames */) |
| 87 |
| 88 IPC_SYNC_MESSAGE_ROUTED1_1(FontMsg_GetIndexIdentities, |
| 89 int /*familyIndex*/, |
| 90 skia::RefPtr<SkRemotableFontIdentitySet> /*styles*/) |
| 91 |
| 92 IPC_SYNC_MESSAGE_ROUTED2_1(FontMsg_MatchIndexStyle, |
| 93 int /*familyIndex*/, |
| 94 SkFontStyle, |
| 95 SkFontIdentity) |
| 96 |
| 97 IPC_SYNC_MESSAGE_ROUTED1_1(FontMsg_MatchName, |
| 98 SkString /*familyName*/, |
| 99 skia::RefPtr<SkRemotableFontIdentitySet> /*styles*/) |
| 100 |
| 101 IPC_SYNC_MESSAGE_ROUTED2_1(FontMsg_MatchNameStyle, |
| 102 SkString /*familyName*/, |
| 103 SkFontStyle, |
| 104 SkFontIdentity) |
| 105 |
| 106 IPC_SYNC_MESSAGE_ROUTED4_1(FontMsg_MatchNameStyleCharacter, |
| 107 SkString /*familyName*/, |
| 108 SkFontStyle, |
| 109 SkString /*bpc47*/, |
| 110 uint32_t /*character*/, |
| 111 SkFontIdentity) |
| 112 |
| 113 IPC_SYNC_MESSAGE_ROUTED1_1(FontMsg_GetData, |
| 114 int /*fontId*/, |
| 115 skia::RefPtr<SkStream> /* fontData */) |
OLD | NEW |