| 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/host_resource.h" | 9 #include "ppapi/proxy/host_resource.h" |
| 10 #include "ppapi/proxy/interface_id.h" | 10 #include "ppapi/proxy/interface_id.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 PP_Instance instance) { | 151 PP_Instance instance) { |
| 152 return PPB_Flash_TCPSocket_Proxy::CreateProxyResource(instance); | 152 return PPB_Flash_TCPSocket_Proxy::CreateProxyResource(instance); |
| 153 } | 153 } |
| 154 | 154 |
| 155 PP_Resource ResourceCreationProxy::CreateFontObject( | 155 PP_Resource ResourceCreationProxy::CreateFontObject( |
| 156 PP_Instance instance, | 156 PP_Instance instance, |
| 157 const PP_FontDescription_Dev* description) { | 157 const PP_FontDescription_Dev* description) { |
| 158 if (!ppapi::FontImpl::IsPPFontDescriptionValid(*description)) | 158 if (!ppapi::FontImpl::IsPPFontDescriptionValid(*description)) |
| 159 return 0; | 159 return 0; |
| 160 | 160 |
| 161 linked_ptr<Font> object(new Font(HostResource::MakeInstanceOnly(instance), | 161 return PluginResourceTracker::GetInstance()->AddResource( |
| 162 *description)); | 162 new Font(HostResource::MakeInstanceOnly(instance), *description)); |
| 163 return PluginResourceTracker::GetInstance()->AddResource(object); | |
| 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 linked_ptr<ImageData> object(new ImageData(result, desc, image_handle)); | 194 return PluginResourceTracker::GetInstance()->AddResource( |
| 196 return PluginResourceTracker::GetInstance()->AddResource(object); | 195 new ImageData(result, desc, image_handle)); |
| 197 } | 196 } |
| 198 | 197 |
| 199 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( | 198 PP_Resource ResourceCreationProxy::CreateKeyboardInputEvent( |
| 200 PP_Instance instance, | 199 PP_Instance instance, |
| 201 PP_InputEvent_Type type, | 200 PP_InputEvent_Type type, |
| 202 PP_TimeTicks time_stamp, | 201 PP_TimeTicks time_stamp, |
| 203 uint32_t modifiers, | 202 uint32_t modifiers, |
| 204 uint32_t key_code, | 203 uint32_t key_code, |
| 205 struct PP_Var character_text) { | 204 struct PP_Var character_text) { |
| 206 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && | 205 if (type != PP_INPUTEVENT_TYPE_RAWKEYDOWN && |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); | 402 *result_image_handle = dispatcher_->ShareHandleWithRemote(ih, false); |
| 404 #else | 403 #else |
| 405 *result_image_handle = ImageData::HandleFromInt(handle); | 404 *result_image_handle = ImageData::HandleFromInt(handle); |
| 406 #endif | 405 #endif |
| 407 } | 406 } |
| 408 } | 407 } |
| 409 } | 408 } |
| 410 | 409 |
| 411 } // namespace proxy | 410 } // namespace proxy |
| 412 } // namespace pp | 411 } // namespace pp |
| OLD | NEW |