Index: ppapi/proxy/handle_converter.cc |
diff --git a/ppapi/proxy/handle_converter.cc b/ppapi/proxy/handle_converter.cc |
index ef4102c0cc5037fc0da9a168bd2184d4e1a9af61..4c7d282cc93b2c4b70d8c374b69733dd5af4949e 100644 |
--- a/ppapi/proxy/handle_converter.cc |
+++ b/ppapi/proxy/handle_converter.cc |
@@ -44,18 +44,28 @@ void ConvertHandlesInParam(const ppapi::proxy::SerializedHandle& handle, |
WriteHandle((*handle_index)++, handle, msg); |
} |
+void HandleWriter(int* handle_index, |
+ IPC::Message* m, |
+ const ppapi::proxy::SerializedHandle& handle) { |
+ WriteHandle((*handle_index)++, handle, m); |
+} |
+ |
void ConvertHandlesInParam(const ppapi::proxy::SerializedVar& var, |
Handles* handles, |
IPC::Message* msg, |
int* handle_index) { |
- ppapi::proxy::SerializedHandle *handle = var.GetPluginShmemHandle(); |
- if (handle) { |
- handles->push_back(*handle); |
- if (msg) { |
- var.WriteRawVarHeader(msg); |
- WriteHandle((*handle_index)++, *handle, msg); |
- } |
- } |
+ if (!var.raw_var_data()) |
+ return; |
+ |
+ std::vector<ppapi::proxy::SerializedHandle*> var_handles = |
+ var.raw_var_data()->GetHandles(); |
+ if (var_handles.empty()) |
+ return; |
+ |
+ for (size_t i = 0; i < var_handles.size(); ++i) |
+ handles->push_back(*var_handles[i]); |
+ if (msg) |
+ var.raw_var_data()->Write(msg, base::Bind(&HandleWriter, handle_index)); |
} |
// For PpapiMsg_ResourceReply and the reply to PpapiHostMsg_ResourceSyncCall, |