Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2176)

Unified Diff: content/renderer/pepper/pepper_try_catch.cc

Issue 635593004: PPAPI: Make V8VarConverter longer-lived (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/pepper/pepper_try_catch.cc
diff --git a/content/renderer/pepper/pepper_try_catch.cc b/content/renderer/pepper/pepper_try_catch.cc
index 2462cbf458b28b3865f0ac707aeac8be750f28a5..ec8436922149e57695e320c4c49e2ec606e2a308 100644
--- a/content/renderer/pepper/pepper_try_catch.cc
+++ b/content/renderer/pepper/pepper_try_catch.cc
@@ -5,6 +5,7 @@
#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"
@@ -20,9 +21,8 @@ const char kInvalidException[] = "Error: An invalid exception was thrown.";
} // namespace
PepperTryCatch::PepperTryCatch(PepperPluginInstanceImpl* instance,
- V8VarConverter::AllowObjectVars convert_objects)
- : instance_(instance),
- convert_objects_(convert_objects) {}
+ V8VarConverter* var_converter)
+ : instance_(instance), var_converter_(var_converter) {}
raymes 2014/10/09 22:04:42 nit, optional: since we know that the conversion m
dmichael (off chromium) 2014/10/09 22:45:37 You mean kAllowObjectVars? We don't know that here
raymes 2014/10/10 19:27:14 Sorry, yeah that's what I meant :)
PepperTryCatch::~PepperTryCatch() {}
@@ -32,9 +32,8 @@ v8::Handle<v8::Value> PepperTryCatch::ToV8(PP_Var var) {
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>();
@@ -48,8 +47,8 @@ ppapi::ScopedPPVar PepperTryCatch::FromV8(v8::Handle<v8::Value> 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();
@@ -57,11 +56,10 @@ ppapi::ScopedPPVar PepperTryCatch::FromV8(v8::Handle<v8::Value> v8_value) {
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.
@@ -120,8 +118,9 @@ void PepperTryCatchV8::SetException(const char* message) {
}
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),

Powered by Google App Engine
This is Rietveld 408576698