Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: ppapi/proxy/ppb_file_system_proxy.cc

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_file_system_proxy.h ('k') | ppapi/proxy/ppb_flash_clipboard_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_system_proxy.h" 5 #include "ppapi/proxy/ppb_file_system_proxy.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/task.h" 8 #include "base/task.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/ppb_file_system.h" 10 #include "ppapi/c/ppb_file_system.h"
11 #include "ppapi/proxy/enter_proxy.h" 11 #include "ppapi/proxy/enter_proxy.h"
12 #include "ppapi/proxy/host_dispatcher.h" 12 #include "ppapi/proxy/host_dispatcher.h"
13 #include "ppapi/proxy/plugin_dispatcher.h" 13 #include "ppapi/proxy/plugin_dispatcher.h"
14 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/proxy/serialized_var.h" 15 #include "ppapi/proxy/serialized_var.h"
16 #include "ppapi/thunk/enter.h" 16 #include "ppapi/thunk/enter.h"
17 #include "ppapi/thunk/ppb_file_system_api.h" 17 #include "ppapi/thunk/ppb_file_system_api.h"
18 #include "ppapi/thunk/resource_creation_api.h" 18 #include "ppapi/thunk/resource_creation_api.h"
19 #include "ppapi/thunk/thunk.h" 19 #include "ppapi/thunk/thunk.h"
20 20
21 using ppapi::thunk::EnterFunctionNoLock; 21 using ppapi::thunk::EnterFunctionNoLock;
22 using ppapi::thunk::PPB_FileSystem_API; 22 using ppapi::thunk::PPB_FileSystem_API;
23 using ppapi::thunk::ResourceCreationAPI; 23 using ppapi::thunk::ResourceCreationAPI;
24 24
25 namespace ppapi { 25 namespace ppapi {
26 namespace proxy { 26 namespace proxy {
27 27
28 namespace { 28 namespace {
29 29
30 InterfaceProxy* CreateFileSystemProxy(Dispatcher* dispatcher) { 30 InterfaceProxy* CreateFileSystemProxy(Dispatcher* dispatcher,
31 return new PPB_FileSystem_Proxy(dispatcher); 31 const void* target_interface) {
32 return new PPB_FileSystem_Proxy(dispatcher, target_interface);
32 } 33 }
33 34
34 } // namespace 35 } // namespace
35 36
36 // This object maintains most of the state of the ref in the plugin for fast 37 // This object maintains most of the state of the ref in the plugin for fast
37 // querying. It's all set in the constructor from the "create info" sent from 38 // querying. It's all set in the constructor from the "create info" sent from
38 // the host. 39 // the host.
39 class FileSystem : public Resource, public PPB_FileSystem_API { 40 class FileSystem : public Resource, public PPB_FileSystem_API {
40 public: 41 public:
41 FileSystem(const HostResource& host_resource, PP_FileSystemType type); 42 FileSystem(const HostResource& host_resource, PP_FileSystemType type);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 103 }
103 104
104 PP_FileSystemType FileSystem::GetType() { 105 PP_FileSystemType FileSystem::GetType() {
105 return type_; 106 return type_;
106 } 107 }
107 108
108 void FileSystem::OpenComplete(int32_t result) { 109 void FileSystem::OpenComplete(int32_t result) {
109 PP_RunAndClearCompletionCallback(&current_open_callback_, result); 110 PP_RunAndClearCompletionCallback(&current_open_callback_, result);
110 } 111 }
111 112
112 PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher) 113 PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher,
113 : InterfaceProxy(dispatcher), 114 const void* target_interface)
115 : InterfaceProxy(dispatcher, target_interface),
114 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 116 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
115 } 117 }
116 118
117 PPB_FileSystem_Proxy::~PPB_FileSystem_Proxy() { 119 PPB_FileSystem_Proxy::~PPB_FileSystem_Proxy() {
118 } 120 }
119 121
120 const InterfaceProxy::Info* PPB_FileSystem_Proxy::GetInfo() { 122 const InterfaceProxy::Info* PPB_FileSystem_Proxy::GetInfo() {
121 static const Info info = { 123 static const Info info = {
122 thunk::GetPPB_FileSystem_Thunk(), 124 thunk::GetPPB_FileSystem_Thunk(),
123 PPB_FILESYSTEM_INTERFACE, 125 PPB_FILESYSTEM_INTERFACE,
(...skipping 27 matching lines...) Expand all
151 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen) 153 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen)
152 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete) 154 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete)
153 IPC_MESSAGE_UNHANDLED(handled = false) 155 IPC_MESSAGE_UNHANDLED(handled = false)
154 IPC_END_MESSAGE_MAP() 156 IPC_END_MESSAGE_MAP()
155 return handled; 157 return handled;
156 } 158 }
157 159
158 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance, 160 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance,
159 int type, 161 int type,
160 HostResource* result) { 162 HostResource* result) {
161 thunk::EnterResourceCreation enter(instance); 163 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true);
162 if (enter.failed()) 164 if (enter.failed())
163 return; 165 return;
164 PP_Resource resource = enter.functions()->CreateFileSystem( 166 PP_Resource resource = enter.functions()->CreateFileSystem(
165 instance, static_cast<PP_FileSystemType>(type)); 167 instance, static_cast<PP_FileSystemType>(type));
166 if (!resource) 168 if (!resource)
167 return; // CreateInfo default constructor initializes to 0. 169 return; // CreateInfo default constructor initializes to 0.
168 result->SetHostResource(instance, resource); 170 result->SetHostResource(instance, resource);
169 } 171 }
170 172
171 void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource, 173 void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource,
(...skipping 15 matching lines...) Expand all
187 189
188 void PPB_FileSystem_Proxy::OpenCompleteInHost( 190 void PPB_FileSystem_Proxy::OpenCompleteInHost(
189 int32_t result, 191 int32_t result,
190 const HostResource& host_resource) { 192 const HostResource& host_resource) {
191 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete( 193 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete(
192 INTERFACE_ID_PPB_FILE_SYSTEM, host_resource, result)); 194 INTERFACE_ID_PPB_FILE_SYSTEM, host_resource, result));
193 } 195 }
194 196
195 } // namespace proxy 197 } // namespace proxy
196 } // namespace ppapi 198 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_system_proxy.h ('k') | ppapi/proxy/ppb_flash_clipboard_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698