Chromium Code Reviews| Index: ppapi/proxy/ppb_file_io_proxy.cc |
| =================================================================== |
| --- ppapi/proxy/ppb_file_io_proxy.cc (revision 161132) |
| +++ ppapi/proxy/ppb_file_io_proxy.cc (working copy) |
| @@ -28,7 +28,9 @@ |
| // partial read. |
| static const int32_t kMaxReadSize = 33554432; // 32MB |
| +#if !defined(OS_NACL) |
| typedef EnterHostFromHostResourceForceCallback<PPB_FileIO_API> EnterHostFileIO; |
| +#endif |
| typedef EnterPluginFromHostResource<PPB_FileIO_API> EnterPluginFileIO; |
| class FileIO : public PPB_FileIO_Shared { |
| @@ -218,6 +220,7 @@ |
| bool PPB_FileIO_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| bool handled = true; |
| IPC_BEGIN_MESSAGE_MAP(PPB_FileIO_Proxy, msg) |
| + #if !defined(OS_NACL) |
| // Plugin -> host message. |
| IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Create, OnHostMsgCreate) |
| IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_Open, OnHostMsgOpen) |
| @@ -231,7 +234,7 @@ |
| IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_WillWrite, OnHostMsgWillWrite) |
| IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileIO_WillSetLength, |
| OnHostMsgWillSetLength) |
| - |
| +#endif // !defined(OS_NACL) |
| // Host -> plugin messages. |
| IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileIO_GeneralComplete, |
| OnPluginMsgGeneralComplete) |
| @@ -246,6 +249,7 @@ |
| return handled; |
| } |
| +#if !defined(OS_NACL) |
| void PPB_FileIO_Proxy::OnHostMsgCreate(PP_Instance instance, |
| HostResource* result) { |
| thunk::EnterResourceCreation enter(instance); |
| @@ -371,6 +375,43 @@ |
| enter.SetResult(enter.object()->WillSetLength(length, enter.callback())); |
| } |
| +void PPB_FileIO_Proxy::GeneralCallbackCompleteInHost( |
|
brettw
2012/10/11 18:05:50
I like to keep the header and .cc ordering the sam
bbudge
2012/10/11 18:46:02
Done for all files where methods were moved.
|
| + int32_t pp_error, |
| + const HostResource& host_resource) { |
| + Send(new PpapiMsg_PPBFileIO_GeneralComplete(kApiID, host_resource, pp_error)); |
| +} |
| + |
| +void PPB_FileIO_Proxy::OpenFileCallbackCompleteInHost( |
| + int32_t pp_error, |
| + const HostResource& host_resource) { |
| + Send(new PpapiMsg_PPBFileIO_OpenFileComplete(kApiID, host_resource, |
| + pp_error)); |
| +} |
| + |
| +void PPB_FileIO_Proxy::QueryCallbackCompleteInHost( |
| + int32_t pp_error, |
| + const HostResource& host_resource, |
| + PP_FileInfo* info) { |
| + Send(new PpapiMsg_PPBFileIO_QueryComplete(kApiID, host_resource, pp_error, |
| + *info)); |
| + delete info; |
| +} |
| + |
| +void PPB_FileIO_Proxy::ReadCallbackCompleteInHost( |
| + int32_t pp_error, |
| + const HostResource& host_resource, |
| + std::string* data) { |
| + // Only send the amount of data in the string that was actually read. |
| + if (pp_error >= 0) { |
| + DCHECK(pp_error <= static_cast<int32_t>(data->size())); |
| + data->resize(pp_error); |
| + } |
| + Send(new PpapiMsg_PPBFileIO_ReadComplete(kApiID, host_resource, pp_error, |
| + *data)); |
| + delete data; |
| +} |
| +#endif // !defined(OS_NACL) |
| + |
| void PPB_FileIO_Proxy::OnPluginMsgGeneralComplete( |
| const HostResource& host_resource, |
| int32_t result) { |
| @@ -410,41 +451,5 @@ |
| } |
| } |
| -void PPB_FileIO_Proxy::GeneralCallbackCompleteInHost( |
| - int32_t pp_error, |
| - const HostResource& host_resource) { |
| - Send(new PpapiMsg_PPBFileIO_GeneralComplete(kApiID, host_resource, pp_error)); |
| -} |
| - |
| -void PPB_FileIO_Proxy::OpenFileCallbackCompleteInHost( |
| - int32_t pp_error, |
| - const HostResource& host_resource) { |
| - Send(new PpapiMsg_PPBFileIO_OpenFileComplete(kApiID, host_resource, |
| - pp_error)); |
| -} |
| - |
| -void PPB_FileIO_Proxy::QueryCallbackCompleteInHost( |
| - int32_t pp_error, |
| - const HostResource& host_resource, |
| - PP_FileInfo* info) { |
| - Send(new PpapiMsg_PPBFileIO_QueryComplete(kApiID, host_resource, pp_error, |
| - *info)); |
| - delete info; |
| -} |
| - |
| -void PPB_FileIO_Proxy::ReadCallbackCompleteInHost( |
| - int32_t pp_error, |
| - const HostResource& host_resource, |
| - std::string* data) { |
| - // Only send the amount of data in the string that was actually read. |
| - if (pp_error >= 0) { |
| - DCHECK(pp_error <= static_cast<int32_t>(data->size())); |
| - data->resize(pp_error); |
| - } |
| - Send(new PpapiMsg_PPBFileIO_ReadComplete(kApiID, host_resource, pp_error, |
| - *data)); |
| - delete data; |
| -} |
| - |
| } // namespace proxy |
| } // namespace ppapi |