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

Unified Diff: fpdfsdk/include/jsapi/fxjs_v8.h

Issue 1338073002: Refactor fxjs_v8 and add embeddertests for it. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Working, expose new API to condition the isolate Created 5 years, 3 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: fpdfsdk/include/jsapi/fxjs_v8.h
diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h
index 419568673147920c6c9c1ba21df4a248a7aa293e..516558f57168dd167093b9ac7c3324b27dc7b4f2 100644
--- a/fpdfsdk/include/jsapi/fxjs_v8.h
+++ b/fpdfsdk/include/jsapi/fxjs_v8.h
@@ -48,11 +48,25 @@ extern const wchar_t kFXJSValueNameUndefined[];
class IFXJS_Context;
class IFXJS_Runtime;
+class JS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
+ void* Allocate(size_t length) override;
+ void* AllocateUninitialized(size_t length) override;
+ void Free(void* data, size_t length) override;
+};
+
typedef void (*LP_CONSTRUCTOR)(IFXJS_Context* cc,
v8::Local<v8::Object> obj,
v8::Local<v8::Object> global);
typedef void (*LP_DESTRUCTOR)(v8::Local<v8::Object> obj);
+// Call before making JS_PrepareIsolate call.
+void JS_Initial(unsigned int embedderDataSlot);
Lei Zhang 2015/09/15 01:59:55 Can we rename this to JS_Initialize?
Tom Sepez 2015/09/15 15:56:42 Done.
+void JS_Release();
+
+// Call before making JS_Define* calls.
+void JS_PrepareIsolate(v8::Isolate* pIsolate);
+void JS_ResetIsolate(v8::Isolate* pIsolate);
Lei Zhang 2015/09/15 01:59:55 Do we ever need to call this in normal usage?
Tom Sepez 2015/09/15 15:56:42 As implemented, no. In an ideal world, yes, becaus
+
// Always returns a valid, newly-created objDefnID.
int JS_DefineObj(v8::Isolate* pIsolate,
const wchar_t* sObjName,
@@ -86,19 +100,21 @@ void JS_DefineGlobalConst(v8::Isolate* pIsolate,
const wchar_t* sConstName,
v8::Local<v8::Value> pDefault);
+// Called after JS_Define* calls made.
void JS_InitialRuntime(v8::Isolate* pIsolate,
IFXJS_Runtime* pFXRuntime,
IFXJS_Context* context,
v8::Global<v8::Context>& v8PersistentContext);
void JS_ReleaseRuntime(v8::Isolate* pIsolate,
v8::Global<v8::Context>& v8PersistentContext);
-void JS_Initial(unsigned int embedderDataSlot);
-void JS_Release();
+
+// Called after JS_InitialRutime call made.
Lei Zhang 2015/09/15 01:59:55 typo
Tom Sepez 2015/09/15 15:56:42 You don't like rutime? done.
int JS_Execute(v8::Isolate* pIsolate,
IFXJS_Context* pJSContext,
const wchar_t* script,
long length,
FXJSErr* perror);
+
v8::Local<v8::Object> JS_NewFxDynamicObj(v8::Isolate* pIsolate,
IFXJS_Context* pJSContext,
int nObjDefnID);

Powered by Google App Engine
This is Rietveld 408576698