#define CONTENT_RENDERER_PEPPER_PEPPER_TRY_CATCH_H_
#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
-#include "content/renderer/pepper/v8_var_converter.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/scoped_pp_var.h"
#include "v8/include/v8.h"
namespace content {
class PepperPluginInstanceImpl;
+class V8VarConverter;
// Base class for scripting TryCatch helpers.
class CONTENT_EXPORT PepperTryCatch {
// PepperTryCatch objects should only be used as stack variables. This object
// takes a reference on the given PepperPluginInstanceImpl.
PepperTryCatch(PepperPluginInstanceImpl* instance,
- V8VarConverter::AllowObjectVars convert_objects);
+ V8VarConverter* var_converter);
virtual ~PepperTryCatch();
virtual void SetException(const char* message) = 0;
// shouldn't keep the instance around for too long.
scoped_refptr<PepperPluginInstanceImpl> instance_;
- // Whether To/FromV8 should convert object vars. If set to
- // kDisallowObjectVars, an exception should be set if they are encountered
- // during conversion.
- V8VarConverter::AllowObjectVars convert_objects_;
+ V8VarConverter* var_converter_;
};
// Catches var exceptions and emits a v8 exception.
class PepperTryCatchV8 : public PepperTryCatch {
public:
PepperTryCatchV8(PepperPluginInstanceImpl* instance,
- V8VarConverter::AllowObjectVars convert_objects,
+ V8VarConverter* var_converter,
v8::Isolate* isolate);
- virtual ~PepperTryCatchV8();
+ ~PepperTryCatchV8() override;
bool ThrowException();
void ThrowException(const char* message);
PP_Var* exception() { return &exception_; }
// PepperTryCatch
- virtual void SetException(const char* message) OVERRIDE;
- virtual bool HasException() OVERRIDE;
- virtual v8::Handle<v8::Context> GetContext() OVERRIDE;
+ void SetException(const char* message) override;
+ bool HasException() override;
+ v8::Handle<v8::Context> GetContext() override;
private:
PP_Var exception_;
// is responsible for managing the lifetime of the exception. It is valid to
// pass NULL for |exception| in which case no exception will be set.
PepperTryCatchVar(PepperPluginInstanceImpl* instance,
+ V8VarConverter* var_converter,
PP_Var* exception);
- virtual ~PepperTryCatchVar();
+ ~PepperTryCatchVar() override;
// PepperTryCatch
- virtual void SetException(const char* message) OVERRIDE;
- virtual bool HasException() OVERRIDE;
- virtual v8::Handle<v8::Context> GetContext() OVERRIDE;
+ void SetException(const char* message) override;
+ bool HasException() override;
+ v8::Handle<v8::Context> GetContext() override;
private:
// Code which uses PepperTryCatchVar doesn't typically have a HandleScope,