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

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

Issue 6400007: Implement proxy for 3d-related interfaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 10 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_surface_3d_proxy.cc ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/ppp_instance_proxy.h" 5 #include "ppapi/proxy/ppp_instance_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ppapi/c/pp_var.h" 9 #include "ppapi/c/pp_var.h"
10 #include "ppapi/c/ppp_instance.h" 10 #include "ppapi/c/ppp_instance.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/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
13 #include "ppapi/proxy/ppb_url_loader_proxy.h" 14 #include "ppapi/proxy/ppb_url_loader_proxy.h"
14 15
15 namespace pp { 16 namespace pp {
16 namespace proxy { 17 namespace proxy {
17 18
18 namespace { 19 namespace {
19 20
20 PP_Bool DidCreate(PP_Instance instance, 21 PP_Bool DidCreate(PP_Instance instance,
21 uint32_t argc, 22 uint32_t argc,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 136
136 void PPP_Instance_Proxy::OnMsgDidCreate( 137 void PPP_Instance_Proxy::OnMsgDidCreate(
137 PP_Instance instance, 138 PP_Instance instance,
138 const std::vector<std::string>& argn, 139 const std::vector<std::string>& argn,
139 const std::vector<std::string>& argv, 140 const std::vector<std::string>& argv,
140 PP_Bool* result) { 141 PP_Bool* result) {
141 *result = PP_FALSE; 142 *result = PP_FALSE;
142 if (argn.size() != argv.size()) 143 if (argn.size() != argv.size())
143 return; 144 return;
144 145
146 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
147 if (!dispatcher)
148 return;
149 dispatcher->DidCreateInstance(instance);
150
145 // Make sure the arrays always have at least one element so we can take the 151 // Make sure the arrays always have at least one element so we can take the
146 // address below. 152 // address below.
147 std::vector<const char*> argn_array( 153 std::vector<const char*> argn_array(
148 std::max(static_cast<size_t>(1), argn.size())); 154 std::max(static_cast<size_t>(1), argn.size()));
149 std::vector<const char*> argv_array( 155 std::vector<const char*> argv_array(
150 std::max(static_cast<size_t>(1), argn.size())); 156 std::max(static_cast<size_t>(1), argn.size()));
151 for (size_t i = 0; i < argn.size(); i++) { 157 for (size_t i = 0; i < argn.size(); i++) {
152 argn_array[i] = argn[i].c_str(); 158 argn_array[i] = argn[i].c_str();
153 argv_array[i] = argv[i].c_str(); 159 argv_array[i] = argv[i].c_str();
154 } 160 }
155 161
156 DCHECK(ppp_instance_target()); 162 DCHECK(ppp_instance_target());
157 *result = ppp_instance_target()->DidCreate(instance, 163 *result = ppp_instance_target()->DidCreate(instance,
158 static_cast<uint32_t>(argn.size()), 164 static_cast<uint32_t>(argn.size()),
159 &argn_array[0], &argv_array[0]); 165 &argn_array[0], &argv_array[0]);
160 DCHECK(*result); 166 DCHECK(*result);
161 } 167 }
162 168
163 void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) { 169 void PPP_Instance_Proxy::OnMsgDidDestroy(PP_Instance instance) {
164 ppp_instance_target()->DidDestroy(instance); 170 ppp_instance_target()->DidDestroy(instance);
171 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
172 if (!dispatcher)
173 return;
174
175 dispatcher->DidDestroyInstance(instance);
165 } 176 }
166 177
167 void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance, 178 void PPP_Instance_Proxy::OnMsgDidChangeView(PP_Instance instance,
168 const PP_Rect& position, 179 const PP_Rect& position,
169 const PP_Rect& clip) { 180 const PP_Rect& clip) {
181 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
182 if (!dispatcher)
183 return;
184 InstanceData* data = dispatcher->GetInstanceData(instance);
185 if (!data)
186 return;
187 data->position = position;
170 ppp_instance_target()->DidChangeView(instance, &position, &clip); 188 ppp_instance_target()->DidChangeView(instance, &position, &clip);
171 } 189 }
172 190
173 void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance, 191 void PPP_Instance_Proxy::OnMsgDidChangeFocus(PP_Instance instance,
174 PP_Bool has_focus) { 192 PP_Bool has_focus) {
175 ppp_instance_target()->DidChangeFocus(instance, has_focus); 193 ppp_instance_target()->DidChangeFocus(instance, has_focus);
176 } 194 }
177 195
178 void PPP_Instance_Proxy::OnMsgHandleInputEvent(PP_Instance instance, 196 void PPP_Instance_Proxy::OnMsgHandleInputEvent(PP_Instance instance,
179 const PP_InputEvent& event, 197 const PP_InputEvent& event,
(...skipping 12 matching lines...) Expand all
192 210
193 void PPP_Instance_Proxy::OnMsgGetInstanceObject( 211 void PPP_Instance_Proxy::OnMsgGetInstanceObject(
194 PP_Instance instance, 212 PP_Instance instance,
195 SerializedVarReturnValue result) { 213 SerializedVarReturnValue result) {
196 result.Return(dispatcher(), 214 result.Return(dispatcher(),
197 ppp_instance_target()->GetInstanceObject(instance)); 215 ppp_instance_target()->GetInstanceObject(instance));
198 } 216 }
199 217
200 } // namespace proxy 218 } // namespace proxy
201 } // namespace pp 219 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_surface_3d_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698