diff options
author | rockot <rockot@chromium.org> | 2016-02-03 12:20:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-03 20:21:49 +0000 |
commit | 502c94ff1a9f99b5c4ecfe700415cc4ed14228dd (patch) | |
tree | 260521d2640e580c11a54d24781ef0ebc32baee3 /ppapi | |
parent | 26c9117edc07280155c69c7fab04729af46a79eb (diff) | |
download | chromium_src-502c94ff1a9f99b5c4ecfe700415cc4ed14228dd.zip chromium_src-502c94ff1a9f99b5c4ecfe700415cc4ed14228dd.tar.gz chromium_src-502c94ff1a9f99b5c4ecfe700415cc4ed14228dd.tar.bz2 |
IPC::Message -> base::Pickle
This changes consumers of IPC::Message to generally refer
refer to base::Pickle instead when performing serialization
and deserialization operations. The few specific instances
where the IPC::Message interface (Read/WriteAttachent) is
needed can safely be static_cast'd, as IPC::Message is the
only public subclass of base::Pickle.
The purpose of this change is to facilitate the transition
to Mojo IPC, as we've trained the Mojo bindings layer to
use existing ParamTraits<T> parameterized over base::Pickle.
To support this base::Pickle has had some stub interfaces
added for WriteAttachment and ReadAttachment, along with a
Pickle::Attachment.
A follow-up patch will add sizing traits to the standard
IPC_STRUCT macros, enabling the majority of Chrome IPC
structs to be carried over Mojo message pipes as-is.
BUG=577685
R=jam@chromium.org
Review URL: https://codereview.chromium.org/1659003003
Cr-Commit-Position: refs/heads/master@{#373323}
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/nacl_message_scanner.cc | 4 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.cc | 81 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.h | 108 | ||||
-rw-r--r-- | ppapi/proxy/raw_var_data.cc | 37 | ||||
-rw-r--r-- | ppapi/proxy/raw_var_data.h | 35 | ||||
-rw-r--r-- | ppapi/proxy/raw_var_data_unittest.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/resource_message_params.cc | 22 | ||||
-rw-r--r-- | ppapi/proxy/resource_message_params.h | 36 | ||||
-rw-r--r-- | ppapi/proxy/serialized_flash_menu.cc | 17 | ||||
-rw-r--r-- | ppapi/proxy/serialized_flash_menu.h | 5 | ||||
-rw-r--r-- | ppapi/proxy/serialized_var.cc | 8 | ||||
-rw-r--r-- | ppapi/proxy/serialized_var.h | 14 |
12 files changed, 199 insertions, 170 deletions
diff --git a/ppapi/proxy/nacl_message_scanner.cc b/ppapi/proxy/nacl_message_scanner.cc index 766bc8a..e8ca425c 100644 --- a/ppapi/proxy/nacl_message_scanner.cc +++ b/ppapi/proxy/nacl_message_scanner.cc @@ -55,7 +55,7 @@ struct ScanningResults { void WriteHandle(int handle_index, const SerializedHandle& handle, - IPC::Message* msg) { + base::Pickle* msg) { SerializedHandle::WriteHeader(handle.header(), msg); if (handle.type() != SerializedHandle::INVALID) { @@ -78,7 +78,7 @@ void ScanParam(const SerializedHandle& handle, ScanningResults* results) { } void HandleWriter(int* handle_index, - IPC::Message* m, + base::Pickle* m, const SerializedHandle& handle) { WriteHandle((*handle_index)++, handle, m); } diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 57f8a9f..9d21eac 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -41,7 +41,7 @@ namespace { // The solution is to make a new object for each deserialized item, and then // add it to the vector one at a time. template <typename T> -bool ReadVectorWithoutCopy(const Message* m, +bool ReadVectorWithoutCopy(const base::Pickle* m, base::PickleIterator* iter, std::vector<T>* output) { // This part is just a copy of the the default ParamTraits vector Read(). @@ -67,8 +67,8 @@ bool ReadVectorWithoutCopy(const Message* m, // way as the "regular" IPC vector serializer does. But having the code here // saves us from having to copy this code into all ParamTraits that use the // ReadVectorWithoutCopy function for deserializing. -template<typename T> -void WriteVectorWithoutCopy(Message* m, const std::vector<T>& p) { +template <typename T> +void WriteVectorWithoutCopy(base::Pickle* m, const std::vector<T>& p) { WriteParam(m, static_cast<int>(p.size())); for (size_t i = 0; i < p.size(); i++) WriteParam(m, p[i]); @@ -79,12 +79,12 @@ void WriteVectorWithoutCopy(Message* m, const std::vector<T>& p) { // PP_Bool --------------------------------------------------------------------- // static -void ParamTraits<PP_Bool>::Write(Message* m, const param_type& p) { +void ParamTraits<PP_Bool>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, PP_ToBool(p)); } // static -bool ParamTraits<PP_Bool>::Read(const Message* m, +bool ParamTraits<PP_Bool>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { // We specifically want to be strict here about what types of input we accept, @@ -104,7 +104,8 @@ void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { // PP_KeyInformation ------------------------------------------------------- // static -void ParamTraits<PP_KeyInformation>::Write(Message* m, const param_type& p) { +void ParamTraits<PP_KeyInformation>::Write(base::Pickle* m, + const param_type& p) { WriteParam(m, p.key_id_size); m->WriteBytes(p.key_id, static_cast<int>(p.key_id_size)); WriteParam(m, p.key_status); @@ -112,7 +113,7 @@ void ParamTraits<PP_KeyInformation>::Write(Message* m, const param_type& p) { } // static -bool ParamTraits<PP_KeyInformation>::Read(const Message* m, +bool ParamTraits<PP_KeyInformation>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { uint32_t size; @@ -150,14 +151,14 @@ void ParamTraits<PP_KeyInformation>::Log(const param_type& p, std::string* l) { // PP_NetAddress_Private ------------------------------------------------------- // static -void ParamTraits<PP_NetAddress_Private>::Write(Message* m, +void ParamTraits<PP_NetAddress_Private>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.size); m->WriteBytes(p.data, static_cast<int>(p.size)); } // static -bool ParamTraits<PP_NetAddress_Private>::Read(const Message* m, +bool ParamTraits<PP_NetAddress_Private>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { uint16_t size; @@ -185,14 +186,14 @@ void ParamTraits<PP_NetAddress_Private>::Log(const param_type& p, // HostResource ---------------------------------------------------------------- // static -void ParamTraits<ppapi::HostResource>::Write(Message* m, +void ParamTraits<ppapi::HostResource>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.instance()); WriteParam(m, p.host_resource()); } // static -bool ParamTraits<ppapi::HostResource>::Read(const Message* m, +bool ParamTraits<ppapi::HostResource>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { PP_Instance instance; @@ -211,13 +212,13 @@ void ParamTraits<ppapi::HostResource>::Log(const param_type& p, // SerializedVar --------------------------------------------------------------- // static -void ParamTraits<ppapi::proxy::SerializedVar>::Write(Message* m, +void ParamTraits<ppapi::proxy::SerializedVar>::Write(base::Pickle* m, const param_type& p) { p.WriteToMessage(m); } // static -bool ParamTraits<ppapi::proxy::SerializedVar>::Read(const Message* m, +bool ParamTraits<ppapi::proxy::SerializedVar>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return r->ReadFromMessage(m, iter); @@ -230,15 +231,15 @@ void ParamTraits<ppapi::proxy::SerializedVar>::Log(const param_type& p, // std::vector<SerializedVar> -------------------------------------------------- -void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Write( - Message* m, +void ParamTraits<std::vector<ppapi::proxy::SerializedVar>>::Write( + base::Pickle* m, const param_type& p) { WriteVectorWithoutCopy(m, p); } // static bool ParamTraits<std::vector<ppapi::proxy::SerializedVar>>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadVectorWithoutCopy(m, iter, r); @@ -252,13 +253,13 @@ void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( // ppapi::PpapiPermissions ----------------------------------------------------- -void ParamTraits<ppapi::PpapiPermissions>::Write(Message* m, +void ParamTraits<ppapi::PpapiPermissions>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.GetBits()); } // static -bool ParamTraits<ppapi::PpapiPermissions>::Read(const Message* m, +bool ParamTraits<ppapi::PpapiPermissions>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { uint32_t bits; @@ -276,7 +277,7 @@ void ParamTraits<ppapi::PpapiPermissions>::Log(const param_type& p, // SerializedHandle ------------------------------------------------------------ // static -void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, +void ParamTraits<ppapi::proxy::SerializedHandle>::Write(base::Pickle* m, const param_type& p) { ppapi::proxy::SerializedHandle::WriteHeader(p.header(), m); switch (p.type()) { @@ -295,7 +296,7 @@ void ParamTraits<ppapi::proxy::SerializedHandle>::Write(Message* m, // static bool ParamTraits<ppapi::proxy::SerializedHandle>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { ppapi::proxy::SerializedHandle::Header header; @@ -342,7 +343,7 @@ void ParamTraits<ppapi::proxy::SerializedHandle>::Log(const param_type& p, // static void ParamTraits<ppapi::proxy::PPBURLLoader_UpdateProgress_Params>::Write( - Message* m, + base::Pickle* m, const param_type& p) { WriteParam(m, p.instance); WriteParam(m, p.resource); @@ -354,7 +355,7 @@ void ParamTraits<ppapi::proxy::PPBURLLoader_UpdateProgress_Params>::Write( // static bool ParamTraits<ppapi::proxy::PPBURLLoader_UpdateProgress_Params>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadParam(m, iter, &r->instance) && ReadParam(m, iter, &r->resource) && @@ -374,7 +375,7 @@ void ParamTraits<ppapi::proxy::PPBURLLoader_UpdateProgress_Params>::Log( // PPBFlash_DrawGlyphs_Params -------------------------------------------------- // static void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write( - Message* m, + base::Pickle* m, const param_type& p) { WriteParam(m, p.instance); WriteParam(m, p.image_data); @@ -398,7 +399,7 @@ void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Write( // static bool ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadParam(m, iter, &r->instance) && @@ -429,7 +430,7 @@ void ParamTraits<ppapi::proxy::PPBFlash_DrawGlyphs_Params>::Log( // SerializedDirEntry ---------------------------------------------------------- // static -void ParamTraits<ppapi::proxy::SerializedDirEntry>::Write(Message* m, +void ParamTraits<ppapi::proxy::SerializedDirEntry>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, p.name); WriteParam(m, p.is_dir); @@ -437,7 +438,7 @@ void ParamTraits<ppapi::proxy::SerializedDirEntry>::Write(Message* m, // static bool ParamTraits<ppapi::proxy::SerializedDirEntry>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadParam(m, iter, &r->name) && ReadParam(m, iter, &r->is_dir); @@ -452,7 +453,7 @@ void ParamTraits<ppapi::proxy::SerializedDirEntry>::Log(const param_type& p, // static void ParamTraits<ppapi::proxy::SerializedFontDescription>::Write( - Message* m, + base::Pickle* m, const param_type& p) { WriteParam(m, p.face); WriteParam(m, p.family); @@ -466,7 +467,7 @@ void ParamTraits<ppapi::proxy::SerializedFontDescription>::Write( // static bool ParamTraits<ppapi::proxy::SerializedFontDescription>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadParam(m, iter, &r->face) && ReadParam(m, iter, &r->family) && @@ -487,7 +488,7 @@ void ParamTraits<ppapi::proxy::SerializedFontDescription>::Log( // static void ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Write( - Message* m, + base::Pickle* m, const param_type& p) { WriteParam(m, p.family); WriteParam(m, p.generic_family); @@ -499,7 +500,7 @@ void ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Write( // static bool ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadParam(m, iter, &r->family) && @@ -518,14 +519,14 @@ void ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc>::Log( // ppapi::PepperFilePath ------------------------------------------------------- // static -void ParamTraits<ppapi::PepperFilePath>::Write(Message* m, +void ParamTraits<ppapi::PepperFilePath>::Write(base::Pickle* m, const param_type& p) { WriteParam(m, static_cast<unsigned>(p.domain())); WriteParam(m, p.path()); } // static -bool ParamTraits<ppapi::PepperFilePath>::Read(const Message* m, +bool ParamTraits<ppapi::PepperFilePath>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* p) { unsigned domain; @@ -554,14 +555,14 @@ void ParamTraits<ppapi::PepperFilePath>::Log(const param_type& p, // static void ParamTraits<ppapi::proxy::SerializedFlashMenu>::Write( - Message* m, + base::Pickle* m, const param_type& p) { p.WriteToMessage(m); } // static bool ParamTraits<ppapi::proxy::SerializedFlashMenu>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return r->ReadFromMessage(m, iter); @@ -577,14 +578,14 @@ void ParamTraits<ppapi::proxy::SerializedFlashMenu>::Log(const param_type& p, // static void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Write( - Message* m, + base::Pickle* m, const param_type& p) { WriteParam(m, p.values_); } // static bool ParamTraits<ppapi::PPB_X509Certificate_Fields>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { return ReadParam(m, iter, &(r->values_)); @@ -598,7 +599,7 @@ void ParamTraits<ppapi::PPB_X509Certificate_Fields>::Log(const param_type& p, // ppapi::SocketOptionData ----------------------------------------------------- // static -void ParamTraits<ppapi::SocketOptionData>::Write(Message* m, +void ParamTraits<ppapi::SocketOptionData>::Write(base::Pickle* m, const param_type& p) { ppapi::SocketOptionData::Type type = p.GetType(); WriteParam(m, static_cast<int32_t>(type)); @@ -631,7 +632,7 @@ void ParamTraits<ppapi::SocketOptionData>::Write(Message* m, } // static -bool ParamTraits<ppapi::SocketOptionData>::Read(const Message* m, +bool ParamTraits<ppapi::SocketOptionData>::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { *r = ppapi::SocketOptionData(); @@ -675,7 +676,7 @@ void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, // static void ParamTraits<ppapi::CompositorLayerData::Transform>::Write( - Message* m, + base::Pickle* m, const param_type& p) { for (size_t i = 0; i < arraysize(p.matrix); i++) WriteParam(m, p.matrix[i]); @@ -683,7 +684,7 @@ void ParamTraits<ppapi::CompositorLayerData::Transform>::Write( // static bool ParamTraits<ppapi::CompositorLayerData::Transform>::Read( - const Message* m, + const base::Pickle* m, base::PickleIterator* iter, param_type* r) { for (size_t i = 0; i < arraysize(r->matrix);i++) { diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index e3638b8..6996547 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -49,24 +49,30 @@ namespace IPC { template<> struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> { typedef PP_Bool param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template <> struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> { typedef PP_NetAddress_Private param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; template <> struct PPAPI_PROXY_EXPORT ParamTraits<PP_KeyInformation> { typedef PP_KeyInformation param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; @@ -74,8 +80,10 @@ template<> struct PPAPI_PROXY_EXPORT ParamTraits< ppapi::proxy::PPBFlash_DrawGlyphs_Params> { typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; @@ -83,24 +91,30 @@ template<> struct PPAPI_PROXY_EXPORT ParamTraits< ppapi::proxy::PPBURLLoader_UpdateProgress_Params> { typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedDirEntry> { typedef ppapi::proxy::SerializedDirEntry param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFontDescription> { typedef ppapi::proxy::SerializedFontDescription param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; @@ -108,32 +122,40 @@ template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> { typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> { typedef ppapi::proxy::SerializedHandle param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> { typedef ppapi::HostResource param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedVar> { typedef ppapi::proxy::SerializedVar param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; @@ -141,16 +163,20 @@ template<> struct PPAPI_PROXY_EXPORT ParamTraits< std::vector<ppapi::proxy::SerializedVar> > { typedef std::vector<ppapi::proxy::SerializedVar> param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> { typedef ppapi::PpapiPermissions param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; @@ -158,16 +184,20 @@ struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> { template <> struct ParamTraits<ppapi::PepperFilePath> { typedef ppapi::PepperFilePath param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* p); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* p); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> { typedef ppapi::proxy::SerializedFlashMenu param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; #endif // !defined(OS_NACL) && !defined(NACL_WIN64) @@ -175,24 +205,30 @@ struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> { template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> { typedef ppapi::PPB_X509Certificate_Fields param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> { typedef ppapi::SocketOptionData param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; template<> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::CompositorLayerData::Transform> { typedef ppapi::CompositorLayerData::Transform param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, base::PickleIterator* iter, param_type* r); + static void Write(base::Pickle* m, const param_type& p); + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, + param_type* r); static void Log(const param_type& p, std::string* l); }; diff --git a/ppapi/proxy/raw_var_data.cc b/ppapi/proxy/raw_var_data.cc index ae38d33..f4bcf96 100644 --- a/ppapi/proxy/raw_var_data.cc +++ b/ppapi/proxy/raw_var_data.cc @@ -173,7 +173,7 @@ PP_Var RawVarDataGraph::CreatePPVar(PP_Instance instance) { return graph[0]; } -void RawVarDataGraph::Write(IPC::Message* m, +void RawVarDataGraph::Write(base::Pickle* m, const HandleWriter& handle_writer) { // Write the size, followed by each node in the graph. m->WriteUInt32(static_cast<uint32_t>(data_.size())); @@ -184,7 +184,7 @@ void RawVarDataGraph::Write(IPC::Message* m, } // static -scoped_ptr<RawVarDataGraph> RawVarDataGraph::Read(const IPC::Message* m, +scoped_ptr<RawVarDataGraph> RawVarDataGraph::Read(const base::Pickle* m, base::PickleIterator* iter) { scoped_ptr<RawVarDataGraph> result(new RawVarDataGraph); uint32_t size = 0; @@ -283,9 +283,8 @@ void BasicRawVarData::PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) { } -void BasicRawVarData::Write( - IPC::Message* m, - const HandleWriter& handle_writer) { +void BasicRawVarData::Write(base::Pickle* m, + const HandleWriter& handle_writer) { switch (var_.type) { case PP_VARTYPE_UNDEFINED: case PP_VARTYPE_NULL: @@ -311,7 +310,7 @@ void BasicRawVarData::Write( } bool BasicRawVarData::Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { PP_Var result; result.type = type; @@ -377,13 +376,13 @@ void StringRawVarData::PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) { } -void StringRawVarData::Write(IPC::Message* m, +void StringRawVarData::Write(base::Pickle* m, const HandleWriter& handle_writer) { m->WriteString(data_); } bool StringRawVarData::Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { if (!iter->ReadString(&data_)) return false; @@ -482,9 +481,8 @@ void ArrayBufferRawVarData::PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) { } -void ArrayBufferRawVarData::Write( - IPC::Message* m, - const HandleWriter& handle_writer) { +void ArrayBufferRawVarData::Write(base::Pickle* m, + const HandleWriter& handle_writer) { m->WriteInt(type_); switch (type_) { case ARRAY_BUFFER_SHMEM_HOST: @@ -500,7 +498,7 @@ void ArrayBufferRawVarData::Write( } bool ArrayBufferRawVarData::Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { int shmem_type; if (!iter->ReadInt(&shmem_type)) @@ -572,7 +570,7 @@ void ArrayRawVarData::PopulatePPVar(const PP_Var& var, array_var->elements().push_back(ScopedPPVar(graph[children_[i]])); } -void ArrayRawVarData::Write(IPC::Message* m, +void ArrayRawVarData::Write(base::Pickle* m, const HandleWriter& handle_writer) { m->WriteUInt32(static_cast<uint32_t>(children_.size())); for (size_t i = 0; i < children_.size(); ++i) @@ -580,7 +578,7 @@ void ArrayRawVarData::Write(IPC::Message* m, } bool ArrayRawVarData::Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { uint32_t size; if (!iter->ReadUInt32(&size)) @@ -635,9 +633,8 @@ void DictionaryRawVarData::PopulatePPVar(const PP_Var& var, } } -void DictionaryRawVarData::Write( - IPC::Message* m, - const HandleWriter& handle_writer) { +void DictionaryRawVarData::Write(base::Pickle* m, + const HandleWriter& handle_writer) { m->WriteUInt32(static_cast<uint32_t>(children_.size())); for (size_t i = 0; i < children_.size(); ++i) { m->WriteString(children_[i].first); @@ -646,7 +643,7 @@ void DictionaryRawVarData::Write( } bool DictionaryRawVarData::Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { uint32_t size; if (!iter->ReadUInt32(&size)) @@ -712,7 +709,7 @@ void ResourceRawVarData::PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) { } -void ResourceRawVarData::Write(IPC::Message* m, +void ResourceRawVarData::Write(base::Pickle* m, const HandleWriter& handle_writer) { m->WriteInt(static_cast<int>(pp_resource_)); m->WriteInt(pending_renderer_host_id_); @@ -723,7 +720,7 @@ void ResourceRawVarData::Write(IPC::Message* m, } bool ResourceRawVarData::Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { int value; if (!iter->ReadInt(&value)) diff --git a/ppapi/proxy/raw_var_data.h b/ppapi/proxy/raw_var_data.h index 7e437e9..fec92e7 100644 --- a/ppapi/proxy/raw_var_data.h +++ b/ppapi/proxy/raw_var_data.h @@ -33,7 +33,7 @@ namespace proxy { class RawVarData; -typedef base::Callback<void(IPC::Message*, const SerializedHandle&)> +typedef base::Callback<void(base::Pickle*, const SerializedHandle&)> HandleWriter; // Contains the data associated with a graph of connected PP_Vars. Useful for @@ -70,10 +70,10 @@ class PPAPI_PROXY_EXPORT RawVarDataGraph { PP_Var CreatePPVar(PP_Instance instance); // Write the graph to a message using the given HandleWriter. - void Write(IPC::Message* m, const HandleWriter& handle_writer); + void Write(base::Pickle* m, const HandleWriter& handle_writer); // Create a RawVarDataGraph from the given message. - static scoped_ptr<RawVarDataGraph> Read(const IPC::Message* m, + static scoped_ptr<RawVarDataGraph> Read(const base::Pickle* m, base::PickleIterator* iter); // Returns a vector of SerializedHandles associated with this RawVarDataGraph. @@ -117,11 +117,10 @@ class RawVarData { const std::vector<PP_Var>& graph) = 0; // Writes the RawVarData to a message. - virtual void Write(IPC::Message* m, - const HandleWriter& handle_writer) = 0; + virtual void Write(base::Pickle* m, const HandleWriter& handle_writer) = 0; // Reads the RawVarData from a message. Returns true on success. virtual bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) = 0; // Returns a SerializedHandle associated with this RawVarData or NULL if none @@ -146,9 +145,9 @@ class BasicRawVarData : public RawVarData { PP_Var CreatePPVar(PP_Instance instance) override; void PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) override; - void Write(IPC::Message* m, const HandleWriter& handle_writer) override; + void Write(base::Pickle* m, const HandleWriter& handle_writer) override; bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) override; private: @@ -167,9 +166,9 @@ class StringRawVarData : public RawVarData { PP_Var CreatePPVar(PP_Instance instance) override; void PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) override; - void Write(IPC::Message* m, const HandleWriter& handle_writer) override; + void Write(base::Pickle* m, const HandleWriter& handle_writer) override; bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) override; private: @@ -196,9 +195,9 @@ class ArrayBufferRawVarData : public RawVarData { PP_Var CreatePPVar(PP_Instance instance) override; void PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) override; - void Write(IPC::Message* m, const HandleWriter& handle_writer) override; + void Write(base::Pickle* m, const HandleWriter& handle_writer) override; bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) override; SerializedHandle* GetHandle() override; @@ -227,9 +226,9 @@ class ArrayRawVarData : public RawVarData { PP_Var CreatePPVar(PP_Instance instance) override; void PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) override; - void Write(IPC::Message* m, const HandleWriter& handle_writer) override; + void Write(base::Pickle* m, const HandleWriter& handle_writer) override; bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) override; private: @@ -250,9 +249,9 @@ class DictionaryRawVarData : public RawVarData { PP_Var CreatePPVar(PP_Instance instance) override; void PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) override; - void Write(IPC::Message* m, const HandleWriter& handle_writer) override; + void Write(base::Pickle* m, const HandleWriter& handle_writer) override; bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) override; private: @@ -276,9 +275,9 @@ class ResourceRawVarData : public RawVarData { PP_Var CreatePPVar(PP_Instance instance) override; void PopulatePPVar(const PP_Var& var, const std::vector<PP_Var>& graph) override; - void Write(IPC::Message* m, const HandleWriter& handle_writer) override; + void Write(base::Pickle* m, const HandleWriter& handle_writer) override; bool Read(PP_VarType type, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) override; private: diff --git a/ppapi/proxy/raw_var_data_unittest.cc b/ppapi/proxy/raw_var_data_unittest.cc index 1e68712..5985a5d 100644 --- a/ppapi/proxy/raw_var_data_unittest.cc +++ b/ppapi/proxy/raw_var_data_unittest.cc @@ -31,7 +31,7 @@ namespace proxy { namespace { -void DefaultHandleWriter(IPC::Message* m, const SerializedHandle& handle) { +void DefaultHandleWriter(base::Pickle* m, const SerializedHandle& handle) { IPC::ParamTraits<SerializedHandle>::Write(m, handle); } diff --git a/ppapi/proxy/resource_message_params.cc b/ppapi/proxy/resource_message_params.cc index 3e5e03b..9dd744a 100644 --- a/ppapi/proxy/resource_message_params.cc +++ b/ppapi/proxy/resource_message_params.cc @@ -40,26 +40,26 @@ ResourceMessageParams::ResourceMessageParams(PP_Resource resource, ResourceMessageParams::~ResourceMessageParams() { } -void ResourceMessageParams::Serialize(IPC::Message* msg) const { +void ResourceMessageParams::Serialize(base::Pickle* msg) const { WriteHeader(msg); WriteHandles(msg); } -bool ResourceMessageParams::Deserialize(const IPC::Message* msg, +bool ResourceMessageParams::Deserialize(const base::Pickle* msg, base::PickleIterator* iter) { return ReadHeader(msg, iter) && ReadHandles(msg, iter); } -void ResourceMessageParams::WriteHeader(IPC::Message* msg) const { +void ResourceMessageParams::WriteHeader(base::Pickle* msg) const { IPC::WriteParam(msg, pp_resource_); IPC::WriteParam(msg, sequence_); } -void ResourceMessageParams::WriteHandles(IPC::Message* msg) const { +void ResourceMessageParams::WriteHandles(base::Pickle* msg) const { IPC::WriteParam(msg, handles_->data()); } -bool ResourceMessageParams::ReadHeader(const IPC::Message* msg, +bool ResourceMessageParams::ReadHeader(const base::Pickle* msg, base::PickleIterator* iter) { DCHECK(handles_->data().empty()); handles_->set_should_close(true); @@ -67,7 +67,7 @@ bool ResourceMessageParams::ReadHeader(const IPC::Message* msg, IPC::ReadParam(msg, iter, &sequence_); } -bool ResourceMessageParams::ReadHandles(const IPC::Message* msg, +bool ResourceMessageParams::ReadHandles(const base::Pickle* msg, base::PickleIterator* iter) { return IPC::ReadParam(msg, iter, &handles_->data()); } @@ -151,12 +151,12 @@ ResourceMessageCallParams::ResourceMessageCallParams(PP_Resource resource, ResourceMessageCallParams::~ResourceMessageCallParams() { } -void ResourceMessageCallParams::Serialize(IPC::Message* msg) const { +void ResourceMessageCallParams::Serialize(base::Pickle* msg) const { ResourceMessageParams::Serialize(msg); IPC::WriteParam(msg, has_callback_); } -bool ResourceMessageCallParams::Deserialize(const IPC::Message* msg, +bool ResourceMessageCallParams::Deserialize(const base::Pickle* msg, base::PickleIterator* iter) { if (!ResourceMessageParams::Deserialize(msg, iter)) return false; @@ -177,7 +177,7 @@ ResourceMessageReplyParams::ResourceMessageReplyParams(PP_Resource resource, ResourceMessageReplyParams::~ResourceMessageReplyParams() { } -void ResourceMessageReplyParams::Serialize(IPC::Message* msg) const { +void ResourceMessageReplyParams::Serialize(base::Pickle* msg) const { // Rather than serialize all of ResourceMessageParams first, we serialize all // non-handle data first, then the handles. When transferring to NaCl on // Windows, we need to be able to translate Windows-style handles to POSIX- @@ -186,13 +186,13 @@ void ResourceMessageReplyParams::Serialize(IPC::Message* msg) const { WriteHandles(msg); } -bool ResourceMessageReplyParams::Deserialize(const IPC::Message* msg, +bool ResourceMessageReplyParams::Deserialize(const base::Pickle* msg, base::PickleIterator* iter) { return (ReadHeader(msg, iter) && IPC::ReadParam(msg, iter, &result_) && ReadHandles(msg, iter)); } -void ResourceMessageReplyParams::WriteReplyHeader(IPC::Message* msg) const { +void ResourceMessageReplyParams::WriteReplyHeader(base::Pickle* msg) const { WriteHeader(msg); IPC::WriteParam(msg, result_); } diff --git a/ppapi/proxy/resource_message_params.h b/ppapi/proxy/resource_message_params.h index 9e76d1e..098f781 100644 --- a/ppapi/proxy/resource_message_params.h +++ b/ppapi/proxy/resource_message_params.h @@ -75,16 +75,16 @@ class PPAPI_PROXY_EXPORT ResourceMessageParams { ResourceMessageParams(); ResourceMessageParams(PP_Resource resource, int32_t sequence); - virtual void Serialize(IPC::Message* msg) const; - virtual bool Deserialize(const IPC::Message* msg, base::PickleIterator* iter); + virtual void Serialize(base::Pickle* msg) const; + virtual bool Deserialize(const base::Pickle* msg, base::PickleIterator* iter); // Writes everything except the handles to |msg|. - void WriteHeader(IPC::Message* msg) const; + void WriteHeader(base::Pickle* msg) const; // Writes the handles to |msg|. - void WriteHandles(IPC::Message* msg) const; + void WriteHandles(base::Pickle* msg) const; // Matching deserialize helpers. - bool ReadHeader(const IPC::Message* msg, base::PickleIterator* iter); - bool ReadHandles(const IPC::Message* msg, base::PickleIterator* iter); + bool ReadHeader(const base::Pickle* msg, base::PickleIterator* iter); + bool ReadHandles(const base::Pickle* msg, base::PickleIterator* iter); private: class PPAPI_PROXY_EXPORT SerializedHandles @@ -147,8 +147,8 @@ class PPAPI_PROXY_EXPORT ResourceMessageCallParams void set_has_callback() { has_callback_ = true; } bool has_callback() const { return has_callback_; } - void Serialize(IPC::Message* msg) const override; - bool Deserialize(const IPC::Message* msg, + void Serialize(base::Pickle* msg) const override; + bool Deserialize(const base::Pickle* msg, base::PickleIterator* iter) override; private: @@ -166,12 +166,12 @@ class PPAPI_PROXY_EXPORT ResourceMessageReplyParams void set_result(int32_t r) { result_ = r; } int32_t result() const { return result_; } - void Serialize(IPC::Message* msg) const override; - bool Deserialize(const IPC::Message* msg, + void Serialize(base::Pickle* msg) const override; + bool Deserialize(const base::Pickle* msg, base::PickleIterator* iter) override; // Writes everything except the handles to |msg|. - void WriteReplyHeader(IPC::Message* msg) const; + void WriteReplyHeader(base::Pickle* msg) const; private: // Pepper "result code" for the callback. @@ -186,10 +186,9 @@ namespace IPC { template <> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::ResourceMessageCallParams> { typedef ppapi::proxy::ResourceMessageCallParams param_type; - static void Write(Message* m, const param_type& p) { - p.Serialize(m); - } - static bool Read(const Message* m, base::PickleIterator* iter, + static void Write(base::Pickle* m, const param_type& p) { p.Serialize(m); } + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, param_type* r) { return r->Deserialize(m, iter); } @@ -200,10 +199,9 @@ ParamTraits<ppapi::proxy::ResourceMessageCallParams> { template <> struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::ResourceMessageReplyParams> { typedef ppapi::proxy::ResourceMessageReplyParams param_type; - static void Write(Message* m, const param_type& p) { - p.Serialize(m); - } - static bool Read(const Message* m, base::PickleIterator* iter, + static void Write(base::Pickle* m, const param_type& p) { p.Serialize(m); } + static bool Read(const base::Pickle* m, + base::PickleIterator* iter, param_type* r) { return r->Deserialize(m, iter); } diff --git a/ppapi/proxy/serialized_flash_menu.cc b/ppapi/proxy/serialized_flash_menu.cc index 4791b06..b59fcc4 100644 --- a/ppapi/proxy/serialized_flash_menu.cc +++ b/ppapi/proxy/serialized_flash_menu.cc @@ -21,9 +21,9 @@ const uint32_t kMaxMenuEntries = 1000; bool CheckMenu(int depth, const PP_Flash_Menu* menu); void FreeMenu(const PP_Flash_Menu* menu); -void WriteMenu(IPC::Message* m, const PP_Flash_Menu* menu); +void WriteMenu(base::Pickle* m, const PP_Flash_Menu* menu); PP_Flash_Menu* ReadMenu(int depth, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter); bool CheckMenuItem(int depth, const PP_Flash_MenuItem* item) { @@ -47,7 +47,7 @@ bool CheckMenu(int depth, const PP_Flash_Menu* menu) { return true; } -void WriteMenuItem(IPC::Message* m, const PP_Flash_MenuItem* menu_item) { +void WriteMenuItem(base::Pickle* m, const PP_Flash_MenuItem* menu_item) { PP_Flash_MenuItem_Type type = menu_item->type; m->WriteUInt32(type); m->WriteString(menu_item->name ? menu_item->name : ""); @@ -58,7 +58,7 @@ void WriteMenuItem(IPC::Message* m, const PP_Flash_MenuItem* menu_item) { WriteMenu(m, menu_item->submenu); } -void WriteMenu(IPC::Message* m, const PP_Flash_Menu* menu) { +void WriteMenu(base::Pickle* m, const PP_Flash_Menu* menu) { m->WriteUInt32(menu->count); for (uint32_t i = 0; i < menu->count; ++i) WriteMenuItem(m, menu->items + i); @@ -81,7 +81,7 @@ void FreeMenu(const PP_Flash_Menu* menu) { } bool ReadMenuItem(int depth, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter, PP_Flash_MenuItem* menu_item) { uint32_t type; @@ -111,7 +111,7 @@ bool ReadMenuItem(int depth, } PP_Flash_Menu* ReadMenu(int depth, - const IPC::Message* m, + const base::Pickle* m, base::PickleIterator* iter) { if (depth > kMaxMenuDepth) return NULL; @@ -165,12 +165,11 @@ bool SerializedFlashMenu::SetPPMenu(const PP_Flash_Menu* menu) { return true; } - -void SerializedFlashMenu::WriteToMessage(IPC::Message* m) const { +void SerializedFlashMenu::WriteToMessage(base::Pickle* m) const { WriteMenu(m, pp_menu_); } -bool SerializedFlashMenu::ReadFromMessage(const IPC::Message* m, +bool SerializedFlashMenu::ReadFromMessage(const base::Pickle* m, base::PickleIterator* iter) { DCHECK(!pp_menu_); pp_menu_ = ReadMenu(0, m, iter); diff --git a/ppapi/proxy/serialized_flash_menu.h b/ppapi/proxy/serialized_flash_menu.h index 607c603..3160b26 100644 --- a/ppapi/proxy/serialized_flash_menu.h +++ b/ppapi/proxy/serialized_flash_menu.h @@ -12,6 +12,7 @@ #include "ppapi/proxy/ppapi_proxy_export.h" namespace base { +class Pickle; class PickleIterator; } @@ -33,8 +34,8 @@ class PPAPI_PROXY_EXPORT SerializedFlashMenu { const PP_Flash_Menu* pp_menu() const { return pp_menu_; } - void WriteToMessage(IPC::Message* m) const; - bool ReadFromMessage(const IPC::Message* m, base::PickleIterator* iter); + void WriteToMessage(base::Pickle* m) const; + bool ReadFromMessage(const base::Pickle* m, base::PickleIterator* iter); private: const PP_Flash_Menu* pp_menu_; diff --git a/ppapi/proxy/serialized_var.cc b/ppapi/proxy/serialized_var.cc index 4d3ecff..bbdba09 100644 --- a/ppapi/proxy/serialized_var.cc +++ b/ppapi/proxy/serialized_var.cc @@ -19,7 +19,7 @@ namespace ppapi { namespace proxy { namespace { -void DefaultHandleWriter(IPC::Message* m, const SerializedHandle& handle) { +void DefaultHandleWriter(base::Pickle* m, const SerializedHandle& handle) { IPC::ParamTraits<SerializedHandle>::Write(m, handle); } } // namespace @@ -95,7 +95,7 @@ void SerializedVar::Inner::ForceSetVarValueForTest(PP_Var value) { raw_var_data_.reset(NULL); } -void SerializedVar::Inner::WriteToMessage(IPC::Message* m) const { +void SerializedVar::Inner::WriteToMessage(base::Pickle* m) const { // When writing to the IPC messages, a serialization rules handler should // always have been set. // @@ -124,7 +124,7 @@ void SerializedVar::Inner::WriteToMessage(IPC::Message* m) const { } void SerializedVar::Inner::WriteDataToMessage( - IPC::Message* m, + base::Pickle* m, const HandleWriter& handle_writer) const { if (raw_var_data_) { m->WriteBool(true); // Success. @@ -134,7 +134,7 @@ void SerializedVar::Inner::WriteDataToMessage( } } -bool SerializedVar::Inner::ReadFromMessage(const IPC::Message* m, +bool SerializedVar::Inner::ReadFromMessage(const base::Pickle* m, base::PickleIterator* iter) { #ifndef NDEBUG // We should only deserialize something once or will end up with leaked diff --git a/ppapi/proxy/serialized_var.h b/ppapi/proxy/serialized_var.h index 3f8ec99..85c0018 100644 --- a/ppapi/proxy/serialized_var.h +++ b/ppapi/proxy/serialized_var.h @@ -81,17 +81,15 @@ class PPAPI_PROXY_EXPORT SerializedVar { ~SerializedVar(); // Backend implementation for IPC::ParamTraits<SerializedVar>. - void WriteToMessage(IPC::Message* m) const { - inner_->WriteToMessage(m); - } + void WriteToMessage(base::Pickle* m) const { inner_->WriteToMessage(m); } // If ReadFromMessage has been called, WriteDataToMessage will write the var // that has been read from ReadFromMessage back to a message. This is used // when converting handles for use in NaCl. - void WriteDataToMessage(IPC::Message* m, + void WriteDataToMessage(base::Pickle* m, const HandleWriter& handle_writer) const { inner_->WriteDataToMessage(m, handle_writer); } - bool ReadFromMessage(const IPC::Message* m, base::PickleIterator* iter) { + bool ReadFromMessage(const base::Pickle* m, base::PickleIterator* iter) { return inner_->ReadFromMessage(m, iter); } @@ -144,10 +142,10 @@ class PPAPI_PROXY_EXPORT SerializedVar { // it was just received off the wire, without any serialization rules. void ForceSetVarValueForTest(PP_Var value); - void WriteToMessage(IPC::Message* m) const; - void WriteDataToMessage(IPC::Message* m, + void WriteToMessage(base::Pickle* m) const; + void WriteDataToMessage(base::Pickle* m, const HandleWriter& handle_writer) const; - bool ReadFromMessage(const IPC::Message* m, base::PickleIterator* iter); + bool ReadFromMessage(const base::Pickle* m, base::PickleIterator* iter); // Sets the cleanup mode. See the CleanupMode enum below. void SetCleanupModeToEndSendPassRef(); |