| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // If the plugin threw an exception, then throw a V8 version of it to | 139 // If the plugin threw an exception, then throw a V8 version of it to |
| 140 // JavaScript. Either way, return true, because we successfully dispatched | 140 // JavaScript. Either way, return true, because we successfully dispatched |
| 141 // the call to the plugin. | 141 // the call to the plugin. |
| 142 try_catch.ThrowException(); | 142 try_catch.ThrowException(); |
| 143 return true; | 143 return true; |
| 144 } | 144 } |
| 145 | 145 |
| 146 std::vector<std::string> PluginObject::EnumerateNamedProperties( | 146 std::vector<std::string> PluginObject::EnumerateNamedProperties( |
| 147 v8::Isolate* isolate) { | 147 v8::Isolate* isolate) { |
| 148 std::vector<std::string> result; | 148 std::vector<std::string> result; |
| 149 if (!instance_) | 149 if (!instance_) { |
| 150 std::string error = "Plugin object deleted"; |
| 151 isolate->ThrowException( |
| 152 v8::Exception::ReferenceError(gin::StringToV8(isolate, error))); |
| 150 return result; | 153 return result; |
| 154 } |
| 151 | 155 |
| 152 V8VarConverter var_converter(instance_->pp_instance(), | 156 V8VarConverter var_converter(instance_->pp_instance(), |
| 153 V8VarConverter::kAllowObjectVars); | 157 V8VarConverter::kAllowObjectVars); |
| 154 PepperTryCatchV8 try_catch(instance_, &var_converter, isolate); | 158 PepperTryCatchV8 try_catch(instance_, &var_converter, isolate); |
| 155 | 159 |
| 156 PP_Var* name_vars; | 160 PP_Var* name_vars; |
| 157 uint32_t count = 0; | 161 uint32_t count = 0; |
| 158 ppp_class_->GetAllPropertyNames(ppp_class_data_, &count, &name_vars, | 162 ppp_class_->GetAllPropertyNames(ppp_class_data_, &count, &name_vars, |
| 159 try_catch.exception()); | 163 try_catch.exception()); |
| 160 ScopedPPVarArray scoped_name_vars( | 164 ScopedPPVarArray scoped_name_vars( |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 return function_template; | 297 return function_template; |
| 294 function_template = | 298 function_template = |
| 295 gin::CreateFunctionTemplate( | 299 gin::CreateFunctionTemplate( |
| 296 isolate, base::Bind(&PluginObject::Call, weak_factory_.GetWeakPtr(), | 300 isolate, base::Bind(&PluginObject::Call, weak_factory_.GetWeakPtr(), |
| 297 name)); | 301 name)); |
| 298 template_cache_.Set(name, function_template); | 302 template_cache_.Set(name, function_template); |
| 299 return function_template; | 303 return function_template; |
| 300 } | 304 } |
| 301 | 305 |
| 302 } // namespace content | 306 } // namespace content |
| OLD | NEW |