| Index: content/renderer/pepper/message_channel.cc
|
| diff --git a/content/renderer/pepper/message_channel.cc b/content/renderer/pepper/message_channel.cc
|
| index 490a6fb013fe0c387244c6205cd9d33d751ecbcd..ed8ee129aacfe5c482eb782dc3ff1bebc9ba1abb 100644
|
| --- a/content/renderer/pepper/message_channel.cc
|
| +++ b/content/renderer/pepper/message_channel.cc
|
| @@ -122,8 +122,7 @@ void MessageChannel::PostMessageToJavaScript(PP_Var message_data) {
|
| v8::Context::Scope context_scope(context);
|
|
|
| v8::Handle<v8::Value> v8_val;
|
| - if (!V8VarConverter(instance_->pp_instance())
|
| - .ToV8Value(message_data, context, &v8_val)) {
|
| + if (!var_converter_.ToV8Value(message_data, context, &v8_val)) {
|
| PpapiGlobals::Get()->LogWithSource(instance_->pp_instance(),
|
| PP_LOGLEVEL_ERROR,
|
| std::string(),
|
| @@ -187,6 +186,8 @@ MessageChannel::MessageChannel(PepperPluginInstanceImpl* instance)
|
| js_message_queue_state_(WAITING_TO_START),
|
| blocking_message_depth_(0),
|
| plugin_message_queue_state_(WAITING_TO_START),
|
| + var_converter_(instance->pp_instance(),
|
| + V8VarConverter::kDisallowObjectVars),
|
| weak_ptr_factory_(this) {
|
| }
|
|
|
| @@ -214,8 +215,7 @@ v8::Local<v8::Value> MessageChannel::GetNamedProperty(
|
| if (!instance_)
|
| return v8::Local<v8::Value>();
|
|
|
| - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kDisallowObjectVars,
|
| - isolate);
|
| + PepperTryCatchV8 try_catch(instance_, &var_converter_, isolate);
|
| if (identifier == kPostMessage) {
|
| return gin::CreateFunctionTemplate(isolate,
|
| base::Bind(&MessageChannel::PostMessageToNative,
|
| @@ -246,8 +246,7 @@ bool MessageChannel::SetNamedProperty(v8::Isolate* isolate,
|
| v8::Local<v8::Value> value) {
|
| if (!instance_)
|
| return false;
|
| - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kDisallowObjectVars,
|
| - isolate);
|
| + PepperTryCatchV8 try_catch(instance_, &var_converter_, isolate);
|
| if (identifier == kPostMessage ||
|
| (identifier == kPostMessageAndAwaitResponse)) {
|
| try_catch.ThrowException("Cannot set properties with the name postMessage"
|
| @@ -294,8 +293,7 @@ void MessageChannel::PostMessageToNative(gin::Arguments* args) {
|
| void MessageChannel::PostBlockingMessageToNative(gin::Arguments* args) {
|
| if (!instance_)
|
| return;
|
| - PepperTryCatchV8 try_catch(instance_, V8VarConverter::kDisallowObjectVars,
|
| - args->isolate());
|
| + PepperTryCatchV8 try_catch(instance_, &var_converter_, args->isolate());
|
| if (args->Length() != 1) {
|
| try_catch.ThrowException(
|
| "postMessageAndAwaitResponse requires one argument");
|
| @@ -389,14 +387,13 @@ PluginObject* MessageChannel::GetPluginObject(v8::Isolate* isolate) {
|
|
|
| void MessageChannel::EnqueuePluginMessage(v8::Handle<v8::Value> v8_value) {
|
| plugin_message_queue_.push_back(VarConversionResult());
|
| - // Convert NPVariantType_Object in to an appropriate PP_Var like Dictionary,
|
| - // Array, etc. Note NPVariantToVar would convert to an "Object" PP_Var,
|
| - // which we don't support for Messaging.
|
| + // Convert the v8 value in to an appropriate PP_Var like Dictionary,
|
| + // Array, etc. (We explicitly don't want an "Object" PP_Var, which we don't
|
| + // support for Messaging.)
|
| // TODO(raymes): Possibly change this to use TryCatch to do the conversion and
|
| // throw an exception if necessary.
|
| - V8VarConverter v8_var_converter(instance_->pp_instance());
|
| V8VarConverter::VarResult conversion_result =
|
| - v8_var_converter.FromV8Value(
|
| + var_converter_.FromV8Value(
|
| v8_value,
|
| v8::Isolate::GetCurrent()->GetCurrentContext(),
|
| base::Bind(&MessageChannel::FromV8ValueComplete,
|
|
|