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

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

Issue 7629017: Add a unified resource tracker shared between the proxy and the impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 9 years, 4 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
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_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 7 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/c/ppb_instance.h" 9 #include "ppapi/c/ppb_instance.h"
10 #include "ppapi/c/ppb_messaging.h" 10 #include "ppapi/c/ppb_messaging.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/plugin_resource.h"
14 #include "ppapi/proxy/plugin_resource_tracker.h" 13 #include "ppapi/proxy/plugin_resource_tracker.h"
15 #include "ppapi/proxy/ppapi_messages.h" 14 #include "ppapi/proxy/ppapi_messages.h"
16 #include "ppapi/proxy/serialized_var.h" 15 #include "ppapi/proxy/serialized_var.h"
17 #include "ppapi/thunk/enter.h" 16 #include "ppapi/thunk/enter.h"
18 #include "ppapi/thunk/thunk.h" 17 #include "ppapi/thunk/thunk.h"
19 18
20 // Windows headers interfere with this file. 19 // Windows headers interfere with this file.
21 #ifdef PostMessage 20 #ifdef PostMessage
22 #undef PostMessage 21 #undef PostMessage
23 #endif 22 #endif
24 23
25 using ppapi::HostResource; 24 using ppapi::HostResource;
25 using ppapi::Resource;
26 using ppapi::thunk::EnterFunctionNoLock; 26 using ppapi::thunk::EnterFunctionNoLock;
27 using ppapi::thunk::EnterResourceNoLock; 27 using ppapi::thunk::EnterResourceNoLock;
28 using ppapi::thunk::PPB_Instance_FunctionAPI; 28 using ppapi::thunk::PPB_Instance_FunctionAPI;
29 29
30 namespace pp { 30 namespace pp {
31 namespace proxy { 31 namespace proxy {
32 32
33 namespace { 33 namespace {
34 34
35 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher, 35 InterfaceProxy* CreateInstanceProxy(Dispatcher* dispatcher,
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 IPC_END_MESSAGE_MAP() 140 IPC_END_MESSAGE_MAP()
141 return handled; 141 return handled;
142 } 142 }
143 143
144 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() { 144 PPB_Instance_FunctionAPI* PPB_Instance_Proxy::AsPPB_Instance_FunctionAPI() {
145 return this; 145 return this;
146 } 146 }
147 147
148 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance, 148 PP_Bool PPB_Instance_Proxy::BindGraphics(PP_Instance instance,
149 PP_Resource device) { 149 PP_Resource device) {
150 PluginResource* object = 150 Resource* object = PluginResourceTracker::GetInstance()->GetResource(device);
151 PluginResourceTracker::GetInstance()->GetResourceObject(device); 151 if (!object || object->pp_instance() != instance)
152 if (!object || object->instance() != instance)
153 return PP_FALSE; 152 return PP_FALSE;
154 153
155 PP_Bool result = PP_FALSE; 154 PP_Bool result = PP_FALSE;
156 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics( 155 dispatcher()->Send(new PpapiHostMsg_PPBInstance_BindGraphics(
157 INTERFACE_ID_PPB_INSTANCE, instance, object->host_resource(), 156 INTERFACE_ID_PPB_INSTANCE, instance, object->host_resource(),
158 &result)); 157 &result));
159 return result; 158 return result;
160 } 159 }
161 160
162 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) { 161 PP_Bool PPB_Instance_Proxy::IsFullFrame(PP_Instance instance) {
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 363
365 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance, 364 void PPB_Instance_Proxy::OnMsgPostMessage(PP_Instance instance,
366 SerializedVarReceiveInput message) { 365 SerializedVarReceiveInput message) {
367 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false); 366 EnterFunctionNoLock<PPB_Instance_FunctionAPI> enter(instance, false);
368 if (enter.succeeded()) 367 if (enter.succeeded())
369 enter.functions()->PostMessage(instance, message.Get(dispatcher())); 368 enter.functions()->PostMessage(instance, message.Get(dispatcher()));
370 } 369 }
371 370
372 } // namespace proxy 371 } // namespace proxy
373 } // namespace pp 372 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698