OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_flash_file_proxy.h" | 5 #include "ppapi/proxy/ppb_flash_file_proxy.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "ipc/ipc_channel_proxy.h" | 16 #include "ipc/ipc_channel_proxy.h" |
17 #include "ipc/ipc_message.h" | 17 #include "ipc/ipc_message.h" |
18 #include "ipc/ipc_sync_message.h" | 18 #include "ipc/ipc_sync_message.h" |
19 #include "ppapi/c/pp_errors.h" | 19 #include "ppapi/c/pp_errors.h" |
20 #include "ppapi/c/pp_file_info.h" | 20 #include "ppapi/c/pp_file_info.h" |
21 #include "ppapi/c/private/ppb_flash_file.h" | 21 #include "ppapi/c/private/ppb_flash_file.h" |
22 #include "ppapi/proxy/plugin_dispatcher.h" | 22 #include "ppapi/proxy/plugin_dispatcher.h" |
23 #include "ppapi/proxy/plugin_resource_tracker.h" | 23 #include "ppapi/proxy/plugin_resource_tracker.h" |
24 #include "ppapi/proxy/ppapi_messages.h" | 24 #include "ppapi/proxy/ppapi_messages.h" |
25 #include "ppapi/shared_impl/resource.h" | 25 #include "ppapi/shared_impl/resource.h" |
26 | 26 |
27 using ppapi::HostResource; | 27 namespace ppapi { |
28 using ppapi::Resource; | |
29 | |
30 namespace pp { | |
31 namespace proxy { | 28 namespace proxy { |
32 | 29 |
33 namespace { | 30 namespace { |
34 | 31 |
35 // Given an error code and a handle result from a Pepper API call, converts to a | 32 // Given an error code and a handle result from a Pepper API call, converts to a |
36 // PlatformFileForTransit by sharing with the other side, closing the original | 33 // PlatformFileForTransit by sharing with the other side, closing the original |
37 // handle, possibly also updating the error value if an error occurred. | 34 // handle, possibly also updating the error value if an error occurred. |
38 IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit( | 35 IPC::PlatformFileForTransit PlatformFileToPlatformFileForTransit( |
39 Dispatcher* dispatcher, | 36 Dispatcher* dispatcher, |
40 int32_t* error, | 37 int32_t* error, |
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 const std::string& path, | 593 const std::string& path, |
597 PP_FileInfo* info, | 594 PP_FileInfo* info, |
598 int32_t* result) { | 595 int32_t* result) { |
599 *result = ppb_flash_file_module_local_target()-> | 596 *result = ppb_flash_file_module_local_target()-> |
600 QueryFile(instance, path.c_str(), info); | 597 QueryFile(instance, path.c_str(), info); |
601 } | 598 } |
602 | 599 |
603 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents( | 600 void PPB_Flash_File_ModuleLocal_Proxy::OnMsgGetDirContents( |
604 PP_Instance instance, | 601 PP_Instance instance, |
605 const std::string& path, | 602 const std::string& path, |
606 std::vector<pp::proxy::SerializedDirEntry>* entries, | 603 std::vector<SerializedDirEntry>* entries, |
607 int32_t* result) { | 604 int32_t* result) { |
608 PP_DirContents_Dev* contents = NULL; | 605 PP_DirContents_Dev* contents = NULL; |
609 *result = ppb_flash_file_module_local_target()-> | 606 *result = ppb_flash_file_module_local_target()-> |
610 GetDirContents(instance, path.c_str(), &contents); | 607 GetDirContents(instance, path.c_str(), &contents); |
611 if (*result != PP_OK) | 608 if (*result != PP_OK) |
612 return; | 609 return; |
613 | 610 |
614 // Convert the list of entries to the serialized version. | 611 // Convert the list of entries to the serialized version. |
615 entries->resize(contents->count); | 612 entries->resize(contents->count); |
616 for (int32_t i = 0; i < contents->count; i++) { | 613 for (int32_t i = 0; i < contents->count; i++) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 723 |
727 void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile( | 724 void PPB_Flash_File_FileRef_Proxy::OnMsgQueryFile( |
728 const HostResource& host_resource, | 725 const HostResource& host_resource, |
729 PP_FileInfo* info, | 726 PP_FileInfo* info, |
730 int32_t* result) { | 727 int32_t* result) { |
731 *result = ppb_flash_file_module_local_target()-> | 728 *result = ppb_flash_file_module_local_target()-> |
732 QueryFile(host_resource.host_resource(), info); | 729 QueryFile(host_resource.host_resource(), info); |
733 } | 730 } |
734 | 731 |
735 } // namespace proxy | 732 } // namespace proxy |
736 } // namespace pp | 733 } // namespace ppapi |
OLD | NEW |