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

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

Issue 11094060: Exclude host-side code from the NaCl IRT proxy build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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_ref_proxy.cc ('k') | ppapi/proxy/ppb_graphics_2d_proxy.cc » ('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) 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/ppb_file_system_proxy.h" 5 #include "ppapi/proxy/ppb_file_system_proxy.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.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"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Create( 128 dispatcher->Send(new PpapiHostMsg_PPBFileSystem_Create(
129 API_ID_PPB_FILE_SYSTEM, instance, type, &result)); 129 API_ID_PPB_FILE_SYSTEM, instance, type, &result));
130 if (result.is_null()) 130 if (result.is_null())
131 return 0; 131 return 0;
132 return (new FileSystem(result, type))->GetReference(); 132 return (new FileSystem(result, type))->GetReference();
133 } 133 }
134 134
135 bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) { 135 bool PPB_FileSystem_Proxy::OnMessageReceived(const IPC::Message& msg) {
136 bool handled = true; 136 bool handled = true;
137 IPC_BEGIN_MESSAGE_MAP(PPB_FileSystem_Proxy, msg) 137 IPC_BEGIN_MESSAGE_MAP(PPB_FileSystem_Proxy, msg)
138 #if !defined(OS_NACL)
138 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Create, OnMsgCreate) 139 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Create, OnMsgCreate)
139 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen) 140 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFileSystem_Open, OnMsgOpen)
141 #endif
140 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete) 142 IPC_MESSAGE_HANDLER(PpapiMsg_PPBFileSystem_OpenComplete, OnMsgOpenComplete)
141 IPC_MESSAGE_UNHANDLED(handled = false) 143 IPC_MESSAGE_UNHANDLED(handled = false)
142 IPC_END_MESSAGE_MAP() 144 IPC_END_MESSAGE_MAP()
143 return handled; 145 return handled;
144 } 146 }
145 147
148 #if !defined(OS_NACL)
146 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance, 149 void PPB_FileSystem_Proxy::OnMsgCreate(PP_Instance instance,
147 int type, 150 int type,
148 HostResource* result) { 151 HostResource* result) {
149 thunk::EnterResourceCreation enter(instance); 152 thunk::EnterResourceCreation enter(instance);
150 if (enter.failed()) 153 if (enter.failed())
151 return; 154 return;
152 PP_Resource resource = enter.functions()->CreateFileSystem( 155 PP_Resource resource = enter.functions()->CreateFileSystem(
153 instance, static_cast<PP_FileSystemType>(type)); 156 instance, static_cast<PP_FileSystemType>(type));
154 if (!resource) 157 if (!resource)
155 return; // CreateInfo default constructor initializes to 0. 158 return; // CreateInfo default constructor initializes to 0.
156 result->SetHostResource(instance, resource); 159 result->SetHostResource(instance, resource);
157 } 160 }
158 161
159 void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource, 162 void PPB_FileSystem_Proxy::OnMsgOpen(const HostResource& host_resource,
160 int64_t expected_size) { 163 int64_t expected_size) {
161 EnterHostFromHostResourceForceCallback<PPB_FileSystem_API> enter( 164 EnterHostFromHostResourceForceCallback<PPB_FileSystem_API> enter(
162 host_resource, callback_factory_, 165 host_resource, callback_factory_,
163 &PPB_FileSystem_Proxy::OpenCompleteInHost, host_resource); 166 &PPB_FileSystem_Proxy::OpenCompleteInHost, host_resource);
164 if (enter.succeeded()) 167 if (enter.succeeded())
165 enter.SetResult(enter.object()->Open(expected_size, enter.callback())); 168 enter.SetResult(enter.object()->Open(expected_size, enter.callback()));
166 } 169 }
170 #endif // !defined(OS_NACL)
167 171
168 // Called in the plugin to handle the open callback. 172 // Called in the plugin to handle the open callback.
169 void PPB_FileSystem_Proxy::OnMsgOpenComplete(const HostResource& host_resource, 173 void PPB_FileSystem_Proxy::OnMsgOpenComplete(const HostResource& host_resource,
170 int32_t result) { 174 int32_t result) {
171 EnterPluginFromHostResource<PPB_FileSystem_API> enter(host_resource); 175 EnterPluginFromHostResource<PPB_FileSystem_API> enter(host_resource);
172 if (enter.succeeded()) 176 if (enter.succeeded())
173 static_cast<FileSystem*>(enter.object())->OpenComplete(result); 177 static_cast<FileSystem*>(enter.object())->OpenComplete(result);
174 } 178 }
175 179
180 #if !defined(OS_NACL)
176 void PPB_FileSystem_Proxy::OpenCompleteInHost( 181 void PPB_FileSystem_Proxy::OpenCompleteInHost(
177 int32_t result, 182 int32_t result,
178 const HostResource& host_resource) { 183 const HostResource& host_resource) {
179 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete( 184 dispatcher()->Send(new PpapiMsg_PPBFileSystem_OpenComplete(
180 API_ID_PPB_FILE_SYSTEM, host_resource, result)); 185 API_ID_PPB_FILE_SYSTEM, host_resource, result));
181 } 186 }
187 #endif // !defined(OS_NACL)
182 188
183 } // namespace proxy 189 } // namespace proxy
184 } // namespace ppapi 190 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_file_ref_proxy.cc ('k') | ppapi/proxy/ppb_graphics_2d_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698