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

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

Issue 7621070: Merge the plugin and impl side of the audio config and input event resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed compile issues 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/resource_creation_proxy.h" 5 #include "ppapi/proxy/resource_creation_proxy.h"
6 6
7 #include "ppapi/c/pp_errors.h" 7 #include "ppapi/c/pp_errors.h"
8 #include "ppapi/c/pp_size.h" 8 #include "ppapi/c/pp_size.h"
9 #include "ppapi/proxy/interface_id.h" 9 #include "ppapi/proxy/interface_id.h"
10 #include "ppapi/proxy/plugin_dispatcher.h" 10 #include "ppapi/proxy/plugin_dispatcher.h"
11 #include "ppapi/c/trusted/ppb_image_data_trusted.h" 11 #include "ppapi/c/trusted/ppb_image_data_trusted.h"
12 #include "ppapi/proxy/plugin_resource_tracker.h" 12 #include "ppapi/proxy/plugin_resource_tracker.h"
13 #include "ppapi/proxy/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
14 #include "ppapi/proxy/ppb_audio_config_proxy.h"
15 #include "ppapi/proxy/ppb_audio_proxy.h" 14 #include "ppapi/proxy/ppb_audio_proxy.h"
16 #include "ppapi/proxy/ppb_buffer_proxy.h" 15 #include "ppapi/proxy/ppb_buffer_proxy.h"
17 #include "ppapi/proxy/ppb_broker_proxy.h" 16 #include "ppapi/proxy/ppb_broker_proxy.h"
18 #include "ppapi/proxy/ppb_context_3d_proxy.h" 17 #include "ppapi/proxy/ppb_context_3d_proxy.h"
19 #include "ppapi/proxy/ppb_file_chooser_proxy.h" 18 #include "ppapi/proxy/ppb_file_chooser_proxy.h"
20 #include "ppapi/proxy/ppb_file_ref_proxy.h" 19 #include "ppapi/proxy/ppb_file_ref_proxy.h"
21 #include "ppapi/proxy/ppb_file_system_proxy.h" 20 #include "ppapi/proxy/ppb_file_system_proxy.h"
22 #include "ppapi/proxy/ppb_flash_menu_proxy.h" 21 #include "ppapi/proxy/ppb_flash_menu_proxy.h"
23 #include "ppapi/proxy/ppb_flash_net_connector_proxy.h" 22 #include "ppapi/proxy/ppb_flash_net_connector_proxy.h"
24 #include "ppapi/proxy/ppb_flash_tcp_socket_proxy.h" 23 #include "ppapi/proxy/ppb_flash_tcp_socket_proxy.h"
25 #include "ppapi/proxy/ppb_font_proxy.h" 24 #include "ppapi/proxy/ppb_font_proxy.h"
26 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" 25 #include "ppapi/proxy/ppb_graphics_2d_proxy.h"
27 #include "ppapi/proxy/ppb_graphics_3d_proxy.h" 26 #include "ppapi/proxy/ppb_graphics_3d_proxy.h"
28 #include "ppapi/proxy/ppb_image_data_proxy.h" 27 #include "ppapi/proxy/ppb_image_data_proxy.h"
29 #include "ppapi/proxy/ppb_input_event_proxy.h" 28 #include "ppapi/proxy/ppb_input_event_proxy.h"
yzshen1 2011/08/22 17:37:00 Do you still need this one?
30 #include "ppapi/proxy/ppb_surface_3d_proxy.h" 29 #include "ppapi/proxy/ppb_surface_3d_proxy.h"
31 #include "ppapi/proxy/ppb_url_loader_proxy.h" 30 #include "ppapi/proxy/ppb_url_loader_proxy.h"
32 #include "ppapi/proxy/ppb_url_request_info_proxy.h" 31 #include "ppapi/proxy/ppb_url_request_info_proxy.h"
33 #include "ppapi/proxy/ppb_video_capture_proxy.h" 32 #include "ppapi/proxy/ppb_video_capture_proxy.h"
34 #include "ppapi/proxy/ppb_video_decoder_proxy.h" 33 #include "ppapi/proxy/ppb_video_decoder_proxy.h"
34 #include "ppapi/shared_impl/audio_config_impl.h"
35 #include "ppapi/shared_impl/font_impl.h" 35 #include "ppapi/shared_impl/font_impl.h"
36 #include "ppapi/shared_impl/function_group_base.h" 36 #include "ppapi/shared_impl/function_group_base.h"
37 #include "ppapi/shared_impl/host_resource.h" 37 #include "ppapi/shared_impl/host_resource.h"
38 #include "ppapi/shared_impl/input_event_impl.h" 38 #include "ppapi/shared_impl/input_event_impl.h"
39 #include "ppapi/shared_impl/var.h" 39 #include "ppapi/shared_impl/var.h"
40 #include "ppapi/thunk/enter.h" 40 #include "ppapi/thunk/enter.h"
41 #include "ppapi/thunk/ppb_image_data_api.h" 41 #include "ppapi/thunk/ppb_image_data_api.h"
42 42
43 using ppapi::thunk::ResourceCreationAPI; 43 using ppapi::thunk::ResourceCreationAPI;
44 44
(...skipping 17 matching lines...) Expand all
62 PPB_Audio_Callback audio_callback, 62 PPB_Audio_Callback audio_callback,
63 void* user_data) { 63 void* user_data) {
64 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id, 64 return PPB_Audio_Proxy::CreateProxyResource(instance, config_id,
65 audio_callback, user_data); 65 audio_callback, user_data);
66 } 66 }
67 67
68 PP_Resource ResourceCreationProxy::CreateAudioConfig( 68 PP_Resource ResourceCreationProxy::CreateAudioConfig(
69 PP_Instance instance, 69 PP_Instance instance,
70 PP_AudioSampleRate sample_rate, 70 PP_AudioSampleRate sample_rate,
71 uint32_t sample_frame_count) { 71 uint32_t sample_frame_count) {
72 return PPB_AudioConfig_Proxy::CreateProxyResource( 72 return AudioConfigImpl::CreateAsProxy(
73 instance, sample_rate, sample_frame_count); 73 instance, sample_rate, sample_frame_count);
74 } 74 }
75 75
76 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) { 76 PP_Resource ResourceCreationProxy::CreateAudioTrusted(PP_Instance instance) {
77 // Proxied plugins can't created trusted audio devices. 77 // Proxied plugins can't created trusted audio devices.
78 return 0; 78 return 0;
79 } 79 }
80 80
81 PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) { 81 PP_Resource ResourceCreationProxy::CreateBroker(PP_Instance instance) {
82 return PPB_Broker_Proxy::CreateProxyResource(instance); 82 return PPB_Broker_Proxy::CreateProxyResource(instance);
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 data.event_time_stamp = time_stamp; 210 data.event_time_stamp = time_stamp;
211 data.event_modifiers = modifiers; 211 data.event_modifiers = modifiers;
212 data.key_code = key_code; 212 data.key_code = key_code;
213 if (character_text.type == PP_VARTYPE_STRING) { 213 if (character_text.type == PP_VARTYPE_STRING) {
214 StringVar* text_str = StringVar::FromPPVar(character_text); 214 StringVar* text_str = StringVar::FromPPVar(character_text);
215 if (!text_str) 215 if (!text_str)
216 return 0; 216 return 0;
217 data.character_text = text_str->value(); 217 data.character_text = text_str->value();
218 } 218 }
219 219
220 return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); 220 return (new InputEventImpl(InputEventImpl::InitAsProxy(),
221 instance, data))->GetReference();
221 } 222 }
222 223
223 PP_Resource ResourceCreationProxy::CreateMouseInputEvent( 224 PP_Resource ResourceCreationProxy::CreateMouseInputEvent(
224 PP_Instance instance, 225 PP_Instance instance,
225 PP_InputEvent_Type type, 226 PP_InputEvent_Type type,
226 PP_TimeTicks time_stamp, 227 PP_TimeTicks time_stamp,
227 uint32_t modifiers, 228 uint32_t modifiers,
228 PP_InputEvent_MouseButton mouse_button, 229 PP_InputEvent_MouseButton mouse_button,
229 const PP_Point* mouse_position, 230 const PP_Point* mouse_position,
230 int32_t click_count) { 231 int32_t click_count) {
231 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN && 232 if (type != PP_INPUTEVENT_TYPE_MOUSEDOWN &&
232 type != PP_INPUTEVENT_TYPE_MOUSEUP && 233 type != PP_INPUTEVENT_TYPE_MOUSEUP &&
233 type != PP_INPUTEVENT_TYPE_MOUSEMOVE && 234 type != PP_INPUTEVENT_TYPE_MOUSEMOVE &&
234 type != PP_INPUTEVENT_TYPE_MOUSEENTER && 235 type != PP_INPUTEVENT_TYPE_MOUSEENTER &&
235 type != PP_INPUTEVENT_TYPE_MOUSELEAVE) 236 type != PP_INPUTEVENT_TYPE_MOUSELEAVE)
236 return 0; 237 return 0;
237 238
238 ppapi::InputEventData data; 239 ppapi::InputEventData data;
239 data.event_type = type; 240 data.event_type = type;
240 data.event_time_stamp = time_stamp; 241 data.event_time_stamp = time_stamp;
241 data.event_modifiers = modifiers; 242 data.event_modifiers = modifiers;
242 data.mouse_button = mouse_button; 243 data.mouse_button = mouse_button;
243 data.mouse_position = *mouse_position; 244 data.mouse_position = *mouse_position;
244 data.mouse_click_count = click_count; 245 data.mouse_click_count = click_count;
245 246
246 return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); 247 return (new InputEventImpl(InputEventImpl::InitAsProxy(),
248 instance, data))->GetReference();
247 } 249 }
248 250
249 PP_Resource ResourceCreationProxy::CreateGraphics3D( 251 PP_Resource ResourceCreationProxy::CreateGraphics3D(
250 PP_Instance instance, 252 PP_Instance instance,
251 PP_Resource share_context, 253 PP_Resource share_context,
252 const int32_t* attrib_list) { 254 const int32_t* attrib_list) {
253 return PPB_Graphics3D_Proxy::CreateProxyResource( 255 return PPB_Graphics3D_Proxy::CreateProxyResource(
254 instance, share_context, attrib_list); 256 instance, share_context, attrib_list);
255 } 257 }
256 258
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 const PP_FloatPoint* wheel_ticks, 321 const PP_FloatPoint* wheel_ticks,
320 PP_Bool scroll_by_page) { 322 PP_Bool scroll_by_page) {
321 ppapi::InputEventData data; 323 ppapi::InputEventData data;
322 data.event_type = PP_INPUTEVENT_TYPE_WHEEL; 324 data.event_type = PP_INPUTEVENT_TYPE_WHEEL;
323 data.event_time_stamp = time_stamp; 325 data.event_time_stamp = time_stamp;
324 data.event_modifiers = modifiers; 326 data.event_modifiers = modifiers;
325 data.wheel_delta = *wheel_delta; 327 data.wheel_delta = *wheel_delta;
326 data.wheel_ticks = *wheel_ticks; 328 data.wheel_ticks = *wheel_ticks;
327 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page); 329 data.wheel_scroll_by_page = PP_ToBool(scroll_by_page);
328 330
329 return PPB_InputEvent_Proxy::CreateProxyResource(instance, data); 331 return (new InputEventImpl(InputEventImpl::InitAsProxy(),
332 instance, data))->GetReference();
330 } 333 }
331 334
332 bool ResourceCreationProxy::Send(IPC::Message* msg) { 335 bool ResourceCreationProxy::Send(IPC::Message* msg) {
333 return dispatcher_->Send(msg); 336 return dispatcher_->Send(msg);
334 } 337 }
335 338
336 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) { 339 bool ResourceCreationProxy::OnMessageReceived(const IPC::Message& msg) {
337 bool handled = true; 340 bool handled = true;
338 IPC_BEGIN_MESSAGE_MAP(ResourceCreationProxy, msg) 341 IPC_BEGIN_MESSAGE_MAP(ResourceCreationProxy, msg)
339 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreation_Graphics2D, 342 IPC_MESSAGE_HANDLER(PpapiHostMsg_ResourceCreation_Graphics2D,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); 401 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false);
399 #else 402 #else
400 *result_image_handle = ImageData::HandleFromInt(handle); 403 *result_image_handle = ImageData::HandleFromInt(handle);
401 #endif 404 #endif
402 } 405 }
403 } 406 }
404 } 407 }
405 408
406 } // namespace proxy 409 } // namespace proxy
407 } // namespace ppapi 410 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698