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_file_ref_proxy.h" | 5 #include "ppapi/proxy/ppb_file_ref_proxy.h" |
6 | 6 |
7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
8 #include "ppapi/c/ppb_file_ref.h" | 8 #include "ppapi/c/ppb_file_ref.h" |
9 #include "ppapi/c/private/ppb_proxy_private.h" | 9 #include "ppapi/c/private/ppb_proxy_private.h" |
10 #include "ppapi/proxy/enter_proxy.h" | 10 #include "ppapi/proxy/enter_proxy.h" |
11 #include "ppapi/proxy/host_dispatcher.h" | 11 #include "ppapi/proxy/host_dispatcher.h" |
12 #include "ppapi/proxy/plugin_dispatcher.h" | 12 #include "ppapi/proxy/plugin_dispatcher.h" |
13 #include "ppapi/proxy/ppapi_messages.h" | 13 #include "ppapi/proxy/ppapi_messages.h" |
14 #include "ppapi/proxy/serialized_var.h" | 14 #include "ppapi/proxy/serialized_var.h" |
15 #include "ppapi/thunk/ppb_file_ref_api.h" | 15 #include "ppapi/thunk/ppb_file_ref_api.h" |
16 #include "ppapi/thunk/resource_creation_api.h" | 16 #include "ppapi/thunk/resource_creation_api.h" |
17 #include "ppapi/thunk/thunk.h" | 17 #include "ppapi/thunk/thunk.h" |
18 | 18 |
19 using ppapi::HostResource; | |
20 using ppapi::Resource; | |
21 using ppapi::thunk::EnterFunctionNoLock; | 19 using ppapi::thunk::EnterFunctionNoLock; |
22 using ppapi::thunk::EnterResourceNoLock; | 20 using ppapi::thunk::EnterResourceNoLock; |
23 using ppapi::thunk::PPB_FileRef_API; | 21 using ppapi::thunk::PPB_FileRef_API; |
24 using ppapi::thunk::ResourceCreationAPI; | 22 using ppapi::thunk::ResourceCreationAPI; |
25 | 23 |
26 namespace pp { | 24 namespace ppapi { |
27 namespace proxy { | 25 namespace proxy { |
28 | 26 |
29 namespace { | 27 namespace { |
30 | 28 |
31 InterfaceProxy* CreateFileRefProxy(Dispatcher* dispatcher, | 29 InterfaceProxy* CreateFileRefProxy(Dispatcher* dispatcher, |
32 const void* target_interface) { | 30 const void* target_interface) { |
33 return new PPB_FileRef_Proxy(dispatcher, target_interface); | 31 return new PPB_FileRef_Proxy(dispatcher, target_interface); |
34 } | 32 } |
35 | 33 |
36 } // namespace | 34 } // namespace |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher, | 152 PPB_FileRef_Proxy::PPB_FileRef_Proxy(Dispatcher* dispatcher, |
155 const void* target_interface) | 153 const void* target_interface) |
156 : InterfaceProxy(dispatcher, target_interface) { | 154 : InterfaceProxy(dispatcher, target_interface) { |
157 } | 155 } |
158 | 156 |
159 PPB_FileRef_Proxy::~PPB_FileRef_Proxy() { | 157 PPB_FileRef_Proxy::~PPB_FileRef_Proxy() { |
160 } | 158 } |
161 | 159 |
162 const InterfaceProxy::Info* PPB_FileRef_Proxy::GetInfo() { | 160 const InterfaceProxy::Info* PPB_FileRef_Proxy::GetInfo() { |
163 static const Info info = { | 161 static const Info info = { |
164 ::ppapi::thunk::GetPPB_FileRef_Thunk(), | 162 thunk::GetPPB_FileRef_Thunk(), |
165 PPB_FILEREF_INTERFACE, | 163 PPB_FILEREF_INTERFACE, |
166 INTERFACE_ID_PPB_FILE_REF, | 164 INTERFACE_ID_PPB_FILE_REF, |
167 false, | 165 false, |
168 &CreateFileRefProxy, | 166 &CreateFileRefProxy, |
169 }; | 167 }; |
170 return &info; | 168 return &info; |
171 } | 169 } |
172 | 170 |
173 // static | 171 // static |
174 PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, | 172 PP_Resource PPB_FileRef_Proxy::CreateProxyResource(PP_Resource file_system, |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 if (enter.failed()) | 297 if (enter.failed()) |
300 return; | 298 return; |
301 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); | 299 PP_CompletionCallback callback = ReceiveCallback(serialized_callback); |
302 int32_t result = enter.object()->Rename(new_file_ref.host_resource(), | 300 int32_t result = enter.object()->Rename(new_file_ref.host_resource(), |
303 callback); | 301 callback); |
304 if (result != PP_OK_COMPLETIONPENDING) | 302 if (result != PP_OK_COMPLETIONPENDING) |
305 PP_RunCompletionCallback(&callback, result); | 303 PP_RunCompletionCallback(&callback, result); |
306 } | 304 } |
307 | 305 |
308 } // namespace proxy | 306 } // namespace proxy |
309 } // namespace pp | 307 } // namespace ppapi |
OLD | NEW |