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

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

Issue 11308332: Fix Graphics2D in NaCl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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_instance_proxy.h ('k') | no next file » | 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_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/pp_time.h" 10 #include "ppapi/c/pp_time.h"
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 IPC_END_MESSAGE_MAP() 196 IPC_END_MESSAGE_MAP()
197 return handled; 197 return handled;
198 } 198 }
199 199
200 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, 200 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
201 PP_Resource device) { 201 PP_Resource device) {
202 // If device is 0, pass a null HostResource. This signals the host to unbind 202 // If device is 0, pass a null HostResource. This signals the host to unbind
203 // all devices. 203 // all devices.
204 HostResource host_resource; 204 HostResource host_resource;
205 PP_Resource pp_resource = 0; 205 PP_Resource pp_resource = 0;
206 PP_Bool result = PP_FALSE;
207 if (device) { 206 if (device) {
208 Resource* resource = 207 Resource* resource =
209 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device); 208 PpapiGlobals::Get()->GetResourceTracker()->GetResource(device);
210 if (!resource || resource->pp_instance() != instance) 209 if (!resource || resource->pp_instance() != instance)
211 return PP_FALSE; 210 return PP_FALSE;
212 host_resource = resource->host_resource(); 211 host_resource = resource->host_resource();
213 pp_resource = resource->pp_resource(); 212 pp_resource = resource->pp_resource();
214 } else { 213 } else {
215 // Passing 0 means unbinding all devices. 214 // Passing 0 means unbinding all devices.
216 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 215 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
217 API_ID_PPB_INSTANCE, instance, 0, &result)); 216 API_ID_PPB_INSTANCE, instance, 0));
218 return result; 217 return PP_TRUE;
219 } 218 }
220 219
221 // We need to pass different resource to Graphics 2D and 3D right now. Once 220 // We need to pass different resource to Graphics 2D and 3D right now. Once
222 // 3D is migrated to the new design, we should be able to unify this. 221 // 3D is migrated to the new design, we should be able to unify this.
223 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false); 222 EnterResourceNoLock<PPB_Graphics2D_API> enter_2d(device, false);
224 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false); 223 EnterResourceNoLock<PPB_Graphics3D_API> enter_3d(device, false);
225 if (enter_2d.succeeded()) { 224 if (enter_2d.succeeded()) {
226 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 225 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
227 API_ID_PPB_INSTANCE, instance, pp_resource, 226 API_ID_PPB_INSTANCE, instance, pp_resource));
228 &result)); 227 return PP_TRUE;
229 } else if (enter_3d.succeeded()) { 228 } else if (enter_3d.succeeded()) {
230 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 229 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
231 API_ID_PPB_INSTANCE, instance, host_resource.host_resource(), 230 API_ID_PPB_INSTANCE, instance, host_resource.host_resource()));
232 &result)); 231 return PP_TRUE;
233 } 232 }
234 return result; 233 return PP_FALSE;
235 } 234 }
236 235
237 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { 236 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) {
238 PP_Bool result = PP_FALSE; 237 PP_Bool result = PP_FALSE;
239 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( 238 dispatcher()->Send(new PpapiHostMsg_PPBInstance_IsFullFrame(
240 API_ID_PPB_INSTANCE, instance, &result)); 239 API_ID_PPB_INSTANCE, instance, &result));
241 return result; 240 return result;
242 } 241 }
243 242
244 const ViewData* PPB_Instance_Proxy::GetViewData(PP_Instance instance) { 243 const ViewData* PPB_Instance_Proxy::GetViewData(PP_Instance instance) {
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 PP_Instance instance, 802 PP_Instance instance,
804 SerializedVarReturnValue result) { 803 SerializedVarReturnValue result) {
805 EnterInstanceNoLock enter(instance); 804 EnterInstanceNoLock enter(instance);
806 if (enter.succeeded()) { 805 if (enter.succeeded()) {
807 result.Return(dispatcher(), 806 result.Return(dispatcher(),
808 enter.functions()->GetOwnerElementObject(instance)); 807 enter.functions()->GetOwnerElementObject(instance));
809 } 808 }
810 } 809 }
811 810
812 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance, 811 void PPB_Instance_Proxy::OnHostMsgBindGraphics(PP_Instance instance,
813 PP_Resource device, 812 PP_Resource device) {
814 PP_Bool* result) {
815 EnterInstanceNoLock enter(instance); 813 EnterInstanceNoLock enter(instance);
816 if (enter.succeeded()) { 814 if (enter.succeeded())
817 *result = enter.functions()->BindGraphics(instance, device); 815 enter.functions()->BindGraphics(instance, device);
bbudge 2012/12/03 21:16:54 Maybe a comment that we're discarding the return v
818 }
819 } 816 }
820 817
821 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate( 818 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputSampleRate(
822 PP_Instance instance, uint32_t* result) { 819 PP_Instance instance, uint32_t* result) {
823 EnterInstanceNoLock enter(instance); 820 EnterInstanceNoLock enter(instance);
824 if (enter.succeeded()) 821 if (enter.succeeded())
825 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance); 822 *result = enter.functions()->GetAudioHardwareOutputSampleRate(instance);
826 } 823 }
827 824
828 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputBufferSize( 825 void PPB_Instance_Proxy::OnHostMsgGetAudioHardwareOutputBufferSize(
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 PP_Instance instance) { 1190 PP_Instance instance) {
1194 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1191 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1195 GetInstanceData(instance); 1192 GetInstanceData(instance);
1196 if (!data) 1193 if (!data)
1197 return; // Instance was probably deleted. 1194 return; // Instance was probably deleted.
1198 data->should_do_request_surrounding_text = false; 1195 data->should_do_request_surrounding_text = false;
1199 } 1196 }
1200 1197
1201 } // namespace proxy 1198 } // namespace proxy
1202 } // namespace ppapi 1199 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698