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 "content/renderer/pepper/plugin_object.h" | 5 #include "content/renderer/pepper/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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 result_converter.exception()); | 201 result_converter.exception()); |
202 | 202 |
203 // Convert the array of PP_Var to an array of NPIdentifiers. If any | 203 // Convert the array of PP_Var to an array of NPIdentifiers. If any |
204 // conversions fail, we will set the exception. | 204 // conversions fail, we will set the exception. |
205 if (!result_converter.has_exception()) { | 205 if (!result_converter.has_exception()) { |
206 if (property_count > 0) { | 206 if (property_count > 0) { |
207 *values = static_cast<NPIdentifier*>( | 207 *values = static_cast<NPIdentifier*>( |
208 calloc(property_count, sizeof(NPIdentifier))); | 208 calloc(property_count, sizeof(NPIdentifier))); |
209 *count = 0; // Will be the number of items successfully converted. | 209 *count = 0; // Will be the number of items successfully converted. |
210 for (uint32_t i = 0; i < property_count; ++i) { | 210 for (uint32_t i = 0; i < property_count; ++i) { |
211 if (!((*values)[i] = PPVarToNPIdentifier(properties[i]))) { | 211 (*values)[i] = PPVarToNPIdentifier(properties[i]); |
| 212 if (!(*values)[i]) { |
212 // Throw an exception for the failed convertion. | 213 // Throw an exception for the failed convertion. |
213 *result_converter.exception() = | 214 *result_converter.exception() = |
214 StringVar::StringToPPVar(kInvalidValueException); | 215 StringVar::StringToPPVar(kInvalidValueException); |
215 break; | 216 break; |
216 } | 217 } |
217 (*count)++; | 218 (*count)++; |
218 } | 219 } |
219 | 220 |
220 if (result_converter.has_exception()) { | 221 if (result_converter.has_exception()) { |
221 // We don't actually have to free the identifiers we converted since | 222 // We don't actually have to free the identifiers we converted since |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 358 } |
358 | 359 |
359 // static | 360 // static |
360 NPObject* PluginObject::AllocateObjectWrapper() { | 361 NPObject* PluginObject::AllocateObjectWrapper() { |
361 NPObjectWrapper* wrapper = new NPObjectWrapper; | 362 NPObjectWrapper* wrapper = new NPObjectWrapper; |
362 memset(wrapper, 0, sizeof(NPObjectWrapper)); | 363 memset(wrapper, 0, sizeof(NPObjectWrapper)); |
363 return wrapper; | 364 return wrapper; |
364 } | 365 } |
365 | 366 |
366 } // namespace content | 367 } // namespace content |
OLD | NEW |