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/file_io_resource.h" | 5 #include "ppapi/proxy/file_io_resource.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 if (enter.failed()) | 49 if (enter.failed()) |
50 return PP_ERROR_BADRESOURCE; | 50 return PP_ERROR_BADRESOURCE; |
51 | 51 |
52 int32_t rv = state_manager_.CheckOperationState( | 52 int32_t rv = state_manager_.CheckOperationState( |
53 FileIOStateManager::OPERATION_EXCLUSIVE, false); | 53 FileIOStateManager::OPERATION_EXCLUSIVE, false); |
54 if (rv != PP_OK) | 54 if (rv != PP_OK) |
55 return rv; | 55 return rv; |
56 | 56 |
57 Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER, | 57 Call<PpapiPluginMsg_FileIO_OpenReply>(RENDERER, |
58 PpapiHostMsg_FileIO_Open( | 58 PpapiHostMsg_FileIO_Open( |
59 enter.resource()->host_resource().host_resource(), | 59 file_ref, |
60 open_flags), | 60 open_flags), |
61 base::Bind(&FileIOResource::OnPluginMsgOpenFileComplete, this, | 61 base::Bind(&FileIOResource::OnPluginMsgOpenFileComplete, this, |
62 callback)); | 62 callback)); |
63 | 63 |
64 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); | 64 state_manager_.SetPendingOperation(FileIOStateManager::OPERATION_EXCLUSIVE); |
65 return PP_OK_COMPLETIONPENDING; | 65 return PP_OK_COMPLETIONPENDING; |
66 } | 66 } |
67 | 67 |
68 int32_t FileIOResource::Query(PP_FileInfo* info, | 68 int32_t FileIOResource::Query(PP_FileInfo* info, |
69 scoped_refptr<TrackedCallback> callback) { | 69 scoped_refptr<TrackedCallback> callback) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 result = PP_ERROR_FAILED; | 321 result = PP_ERROR_FAILED; |
322 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); | 322 *output_handle = IPC::PlatformFileForTransitToPlatformFile(transit_file); |
323 | 323 |
324 // End the operation now. The callback may perform another file operation. | 324 // End the operation now. The callback may perform another file operation. |
325 state_manager_.SetOperationFinished(); | 325 state_manager_.SetOperationFinished(); |
326 callback->Run(result); | 326 callback->Run(result); |
327 } | 327 } |
328 | 328 |
329 } // namespace proxy | 329 } // namespace proxy |
330 } // namespace ppapi | 330 } // namespace ppapi |
OLD | NEW |