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

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

Issue 7887001: s patch tries to remove most of the manual registration for Pepper interfaces, and replaces it wi... (Closed) Base URL: svn://chrome-svn/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 const void* target_interface) { 31 return new PPB_FileSystem_Proxy(dispatcher);
32 return new PPB_FileSystem_Proxy(dispatcher, target_interface);
33 } 32 }
34 33
35 } // namespace 34 } // namespace
36 35
37 // This object maintains most of the state of the ref in the plugin for fast 36 // This object maintains most of the state of the ref in the plugin for fast
38 // querying. It's all set in the constructor from the "create info" sent from 37 // querying. It's all set in the constructor from the "create info" sent from
39 // the host. 38 // the host.
40 class FileSystem : public Resource, public PPB_FileSystem_API { 39 class FileSystem : public Resource, public PPB_FileSystem_API {
41 public: 40 public:
42 FileSystem(const HostResource& host_resource, PP_FileSystemType type); 41 FileSystem(const HostResource& host_resource, PP_FileSystemType type);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 102 }
104 103
105 PP_FileSystemType FileSystem::GetType() { 104 PP_FileSystemType FileSystem::GetType() {
106 return type_; 105 return type_;
107 } 106 }
108 107
109 void FileSystem::OpenComplete(int32_t result) { 108 void FileSystem::OpenComplete(int32_t result) {
110 PP_RunAndClearCompletionCallback(&current_open_callback_, result); 109 PP_RunAndClearCompletionCallback(&current_open_callback_, result);
111 } 110 }
112 111
113 PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher, 112 PPB_FileSystem_Proxy::PPB_FileSystem_Proxy(Dispatcher* dispatcher)
114 const void* target_interface) 113 : InterfaceProxy(dispatcher),
115 : InterfaceProxy(dispatcher, target_interface),
116 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { 114 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
117 } 115 }
118 116
119 PPB_FileSystem_Proxy::~PPB_FileSystem_Proxy() { 117 PPB_FileSystem_Proxy::~PPB_FileSystem_Proxy() {
120 } 118 }
121 119
122 const InterfaceProxy::Info* PPB_FileSystem_Proxy::GetInfo() { 120 const InterfaceProxy::Info* PPB_FileSystem_Proxy::GetInfo() {
123 static const Info info = { 121 static const Info info = {
124 thunk::GetPPB_FileSystem_Thunk(), 122 thunk::GetPPB_FileSystem_Thunk(),
125 PPB_FILESYSTEM_INTERFACE, 123 PPB_FILESYSTEM_INTERFACE,
(...skipping 27 matching lines...) Expand all
153 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen) 151 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen)
154 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete) 152 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete)
155 IPC_MESSAGE_UNHANDLED(handled = false) 153 IPC_MESSAGE_UNHANDLED(handled = false)
156 IPC_END_MESSAGE_MAP() 154 IPC_END_MESSAGE_MAP()
157 return handled; 155 return handled;
158 } 156 }
159 157
160 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance, 158 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance,
161 int type, 159 int type,
162 HostResource* result) { 160 HostResource* result) {
163 EnterFunctionNoLock<ResourceCreationAPI> enter(instance, true); 161 thunk::EnterResourceCreation enter(instance);
164 if (enter.failed()) 162 if (enter.failed())
165 return; 163 return;
166 PP_Resource resource = enter.functions()->CreateFileSystem( 164 PP_Resource resource = enter.functions()->CreateFileSystem(
167 instance, static_cast<PP_FileSystemType>(type)); 165 instance, static_cast<PP_FileSystemType>(type));
168 if (!resource) 166 if (!resource)
169 return; // CreateInfo default constructor initializes to 0. 167 return; // CreateInfo default constructor initializes to 0.
170 result->SetHostResource(instance, resource); 168 result->SetHostResource(instance, resource);
171 } 169 }
172 170
173 void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource, 171 void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource,
(...skipping 15 matching lines...) Expand all
189 187
190 void PPB_FileSystem_Proxy::OpenCompleteInHost( 188 void PPB_FileSystem_Proxy::OpenCompleteInHost(
191 int32_t result, 189 int32_t result,
192 const HostResource& host_resource) { 190 const HostResource& host_resource) {
193 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete( 191 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete(
194 INTERFACE_ID_PPB_FILE_SYSTEM, host_resource, result)); 192 INTERFACE_ID_PPB_FILE_SYSTEM, host_resource, result));
195 } 193 }
196 194
197 } // namespace proxy 195 } // namespace proxy
198 } // namespace ppapi 196 } // 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