| 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 "webkit/plugins/ppapi/plugin_object.h" | 5 #include "webkit/plugins/ppapi/plugin_object.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // Convert the array of PP_Var to an array of NPIdentifiers. If any | 188 // Convert the array of PP_Var to an array of NPIdentifiers. If any |
| 189 // conversions fail, we will set the exception. | 189 // conversions fail, we will set the exception. |
| 190 if (!result_converter.has_exception()) { | 190 if (!result_converter.has_exception()) { |
| 191 if (property_count > 0) { | 191 if (property_count > 0) { |
| 192 *values = static_cast<NPIdentifier*>( | 192 *values = static_cast<NPIdentifier*>( |
| 193 malloc(sizeof(NPIdentifier) * property_count)); | 193 malloc(sizeof(NPIdentifier) * property_count)); |
| 194 *count = 0; // Will be the number of items successfully converted. | 194 *count = 0; // Will be the number of items successfully converted. |
| 195 for (uint32_t i = 0; i < property_count; ++i) { | 195 for (uint32_t i = 0; i < property_count; ++i) { |
| 196 if (!((*values)[i] = PPVarToNPIdentifier(properties[i]))) { | 196 if (!((*values)[i] = PPVarToNPIdentifier(properties[i]))) { |
| 197 // Throw an exception for the failed convertion. | 197 // Throw an exception for the failed convertion. |
| 198 *result_converter.exception() = StringVar::StringToPPVar( | 198 *result_converter.exception() = |
| 199 obj->instance()->module()->pp_module(), kInvalidValueException); | 199 StringVar::StringToPPVar(kInvalidValueException); |
| 200 break; | 200 break; |
| 201 } | 201 } |
| 202 (*count)++; | 202 (*count)++; |
| 203 } | 203 } |
| 204 | 204 |
| 205 if (result_converter.has_exception()) { | 205 if (result_converter.has_exception()) { |
| 206 // We don't actually have to free the identifiers we converted since | 206 // We don't actually have to free the identifiers we converted since |
| 207 // all identifiers leak anyway :( . | 207 // all identifiers leak anyway :( . |
| 208 free(*values); | 208 free(*values); |
| 209 *values = NULL; | 209 *values = NULL; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 // static | 351 // static |
| 352 NPObject* PluginObject::AllocateObjectWrapper() { | 352 NPObject* PluginObject::AllocateObjectWrapper() { |
| 353 NPObjectWrapper* wrapper = new NPObjectWrapper; | 353 NPObjectWrapper* wrapper = new NPObjectWrapper; |
| 354 memset(wrapper, 0, sizeof(NPObjectWrapper)); | 354 memset(wrapper, 0, sizeof(NPObjectWrapper)); |
| 355 return wrapper; | 355 return wrapper; |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace ppapi | 358 } // namespace ppapi |
| 359 } // namespace webkit | 359 } // namespace webkit |
| 360 | 360 |
| OLD | NEW |