OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/proxy/ppb_file_io_proxy.h" | 5 #include "ppapi/proxy/ppb_file_io_proxy.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/proxy/enter_proxy.h" | 8 #include "ppapi/proxy/enter_proxy.h" |
9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
10 #include "ppapi/proxy/ppb_file_ref_proxy.h" | 10 #include "ppapi/proxy/ppb_file_ref_proxy.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 } | 322 } |
323 | 323 |
324 void PPB_FileIO_Proxy::OnHostMsgWrite(const HostResource& host_resource, | 324 void PPB_FileIO_Proxy::OnHostMsgWrite(const HostResource& host_resource, |
325 int64_t offset, | 325 int64_t offset, |
326 const std::string& data) { | 326 const std::string& data) { |
327 EnterHostFileIO enter(host_resource, callback_factory_, | 327 EnterHostFileIO enter(host_resource, callback_factory_, |
328 &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost, | 328 &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost, |
329 host_resource); | 329 host_resource); |
330 if (enter.succeeded()) { | 330 if (enter.succeeded()) { |
331 enter.SetResult(enter.object()->Write(offset, data.data(), data.size(), | 331 enter.SetResult(enter.object()->Write(offset, data.data(), |
| 332 static_cast<int32_t>(data.size()), |
332 enter.callback())); | 333 enter.callback())); |
333 } | 334 } |
334 } | 335 } |
335 | 336 |
336 void PPB_FileIO_Proxy::OnHostMsgSetLength(const HostResource& host_resource, | 337 void PPB_FileIO_Proxy::OnHostMsgSetLength(const HostResource& host_resource, |
337 int64_t length) { | 338 int64_t length) { |
338 EnterHostFileIO enter(host_resource, callback_factory_, | 339 EnterHostFileIO enter(host_resource, callback_factory_, |
339 &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost, | 340 &PPB_FileIO_Proxy::GeneralCallbackCompleteInHost, |
340 host_resource); | 341 host_resource); |
341 if (enter.succeeded()) | 342 if (enter.succeeded()) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 DCHECK(pp_error <= static_cast<int32_t>(data->size())); | 442 DCHECK(pp_error <= static_cast<int32_t>(data->size())); |
442 data->resize(pp_error); | 443 data->resize(pp_error); |
443 } | 444 } |
444 Send(new PpapiMsg_PPBFileIO_ReadComplete(kApiID, host_resource, pp_error, | 445 Send(new PpapiMsg_PPBFileIO_ReadComplete(kApiID, host_resource, pp_error, |
445 *data)); | 446 *data)); |
446 delete data; | 447 delete data; |
447 } | 448 } |
448 | 449 |
449 } // namespace proxy | 450 } // namespace proxy |
450 } // namespace ppapi | 451 } // namespace ppapi |
OLD | NEW |