OLD | NEW |
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" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 PP_Resource ResourceCreationProxy::CreateFlashTCPSocket( | 151 PP_Resource ResourceCreationProxy::CreateFlashTCPSocket( |
152 PP_Instance instance) { | 152 PP_Instance instance) { |
153 return PPB_Flash_TCPSocket_Proxy::CreateProxyResource(instance); | 153 return PPB_Flash_TCPSocket_Proxy::CreateProxyResource(instance); |
154 } | 154 } |
155 | 155 |
156 PP_Resource ResourceCreationProxy::CreateFontObject( | 156 PP_Resource ResourceCreationProxy::CreateFontObject( |
157 PP_Instance instance, | 157 PP_Instance instance, |
158 const PP_FontDescription_Dev* description) { | 158 const PP_FontDescription_Dev* description) { |
159 if (!ppapi::FontImpl::IsPPFontDescriptionValid(*description)) | 159 if (!ppapi::FontImpl::IsPPFontDescriptionValid(*description)) |
160 return 0; | 160 return 0; |
161 | 161 return (new Font(HostResource::MakeInstanceOnly(instance), *description))-> |
162 return PluginResourceTracker::GetInstance()->AddResource( | 162 GetReference(); |
163 new Font(HostResource::MakeInstanceOnly(instance), *description)); | |
164 } | 163 } |
165 | 164 |
166 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, | 165 PP_Resource ResourceCreationProxy::CreateGraphics2D(PP_Instance instance, |
167 const PP_Size& size, | 166 const PP_Size& size, |
168 PP_Bool is_always_opaque) { | 167 PP_Bool is_always_opaque) { |
169 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, | 168 return PPB_Graphics2D_Proxy::CreateProxyResource(instance, size, |
170 is_always_opaque); | 169 is_always_opaque); |
171 } | 170 } |
172 | 171 |
173 PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance, | 172 PP_Resource ResourceCreationProxy::CreateImageData(PP_Instance instance, |
(...skipping 11 matching lines...) Expand all Loading... |
185 INTERFACE_ID_RESOURCE_CREATION, instance, format, size, init_to_zero, | 184 INTERFACE_ID_RESOURCE_CREATION, instance, format, size, init_to_zero, |
186 &result, &image_data_desc, &image_handle)); | 185 &result, &image_data_desc, &image_handle)); |
187 | 186 |
188 if (result.is_null() || image_data_desc.size() != sizeof(PP_ImageDataDesc)) | 187 if (result.is_null() || image_data_desc.size() != sizeof(PP_ImageDataDesc)) |
189 return 0; | 188 return 0; |
190 | 189 |
191 // We serialize the PP_ImageDataDesc just by copying to a string. | 190 // We serialize the PP_ImageDataDesc just by copying to a string. |
192 PP_ImageDataDesc desc; | 191 PP_ImageDataDesc desc; |
193 memcpy(&desc, image_data_desc.data(), sizeof(PP_ImageDataDesc)); | 192 memcpy(&desc, image_data_desc.data(), sizeof(PP_ImageDataDesc)); |
194 | 193 |
195 return PluginResourceTracker::GetInstance()->AddResource( | 194 return (new ImageData(result, desc, image_handle))->GetReference(); |
196 new ImageData(result, desc, image_handle)); | |
197 } | 195 } |
198 | 196 |
199 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( | 197 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( |
200 PP_Instance instance, | 198 PP_Instance instance, |
201 PP_InputEvent_Type type, | 199 PP_InputEvent_Type type, |
202 PP_TimeTicks time_stamp, | 200 PP_TimeTicks time_stamp, |
203 uint32_t modifiers, | 201 uint32_t modifiers, |
204 uint32_t key_code, | 202 uint32_t key_code, |
205 struct PP_Var character_text) { | 203 struct PP_Var character_text) { |
206 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && | 204 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); | 399 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); |
402 #else | 400 #else |
403 *result_image_handle = ImageData::HandleFromInt(handle); | 401 *result_image_handle = ImageData::HandleFromInt(handle); |
404 #endif | 402 #endif |
405 } | 403 } |
406 } | 404 } |
407 } | 405 } |
408 | 406 |
409 } // namespace proxy | 407 } // namespace proxy |
410 } // namespace pp | 408 } // namespace pp |
OLD | NEW |