#include "content/renderer/pepper/pepper_try_catch.h"
#include "content/renderer/pepper/pepper_plugin_instance_impl.h"
+#include "content/renderer/pepper/v8_var_converter.h"
#include "gin/converter.h"
#include "ppapi/shared_impl/ppapi_globals.h"
#include "ppapi/shared_impl/var_tracker.h"
} // namespace
PepperTryCatch::PepperTryCatch(PepperPluginInstanceImpl* instance,
- V8VarConverter::AllowObjectVars convert_objects)
- : instance_(instance),
- convert_objects_(convert_objects) {}
+ V8VarConverter* var_converter)
+ : instance_(instance), var_converter_(var_converter) {}
PepperTryCatch::~PepperTryCatch() {}
return v8::Handle<v8::Value>();
}
- V8VarConverter converter(instance_->pp_instance(), convert_objects_);
v8::Handle<v8::Value> result;
- bool success = converter.ToV8Value(var, GetContext(), &result);
+ bool success = var_converter_->ToV8Value(var, GetContext(), &result);
if (!success) {
SetException(kConversionException);
return v8::Handle<v8::Value>();
return ppapi::ScopedPPVar();
}
ppapi::ScopedPPVar result;
- V8VarConverter converter(instance_->pp_instance(), convert_objects_);
- bool success = converter.FromV8ValueSync(v8_value, GetContext(), &result);
+ bool success =
+ var_converter_->FromV8ValueSync(v8_value, GetContext(), &result);
if (!success) {
SetException(kConversionException);
return ppapi::ScopedPPVar();
return result;
}
-PepperTryCatchV8::PepperTryCatchV8(
- PepperPluginInstanceImpl* instance,
- V8VarConverter::AllowObjectVars convert_objects,
- v8::Isolate* isolate)
- : PepperTryCatch(instance, convert_objects),
+PepperTryCatchV8::PepperTryCatchV8(PepperPluginInstanceImpl* instance,
+ V8VarConverter* var_converter,
+ v8::Isolate* isolate)
+ : PepperTryCatch(instance, var_converter),
exception_(PP_MakeUndefined()) {
// Typically when using PepperTryCatchV8 we are passed an isolate. We verify
// that this isolate is the same as the plugin isolate.
}
PepperTryCatchVar::PepperTryCatchVar(PepperPluginInstanceImpl* instance,
+ V8VarConverter* var_converter,
PP_Var* exception)
- : PepperTryCatch(instance, V8VarConverter::kAllowObjectVars),
+ : PepperTryCatch(instance, var_converter),
handle_scope_(instance_->GetIsolate()),
context_(GetContext()),
exception_(exception),