From 213a172779fddbd7e588ee2e2b3906ccc47d6896 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Wed, 7 Oct 2015 12:52:13 -0700 Subject: Rename IFXJS_Runtime and IFXJS_Context to IJS_. Nothing but sed. FXJS is a layer that makes it easier to define objects in V8, but has no knowledge of PDF-specific native objects. It could in theory be used to implement other sets of native objects. JS is the layer that implements PDF-specific native objects on top of FXJS. Therefore, the classes used to interface to JS should be named using IJS_. IFXJS_ is reserved for someday adding better API for FXJS iteslf. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1386173002 . --- fpdfsdk/include/fsdk_mgr.h | 6 +++--- fpdfsdk/include/javascript/IJavaScript.h | 18 +++++++++--------- fpdfsdk/include/jsapi/fxjs_v8.h | 24 ++++++++++++++---------- 3 files changed, 26 insertions(+), 22 deletions(-) (limited to 'fpdfsdk/include') diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 270160eeb6..ca9a8cc263 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -209,13 +209,13 @@ class CPDFDoc_Environment final { CFFL_IFormFiller* GetIFormFiller(); // Creates if not present. CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); // Creates if not present. - IFXJS_Runtime* GetJSRuntime(); // Creates if not present. + IJS_Runtime* GetJSRuntime(); // Creates if not present. CPDFSDK_ActionHandler* GetActionHander(); // Creates if not present. private: CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr; CPDFSDK_ActionHandler* m_pActionHandler; - nonstd::unique_ptr m_pJSRuntime; + nonstd::unique_ptr m_pJSRuntime; FPDF_FORMFILLINFO* const m_pInfo; CPDFSDK_Document* m_pSDKDoc; CPDF_Document* const m_pPDFDoc; @@ -239,7 +239,7 @@ class CPDFSDK_Document { CPDFSDK_Annot* GetFocusAnnot(); - IFXJS_Runtime* GetJsRuntime(); + IJS_Runtime* GetJsRuntime(); FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag = 0); FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0); diff --git a/fpdfsdk/include/javascript/IJavaScript.h b/fpdfsdk/include/javascript/IJavaScript.h index 4aeb76065b..a527d19544 100644 --- a/fpdfsdk/include/javascript/IJavaScript.h +++ b/fpdfsdk/include/javascript/IJavaScript.h @@ -16,7 +16,7 @@ class CPDFSDK_Document; class CPDF_Bookmark; class CPDF_FormField; -class IFXJS_Context { +class IJS_Context { public: virtual FX_BOOL RunScript(const CFX_WideString& script, CFX_WideString& info) = 0; @@ -128,22 +128,22 @@ class IFXJS_Context { virtual void EnableMessageBox(FX_BOOL bEnable) = 0; protected: - virtual ~IFXJS_Context() {} + virtual ~IJS_Context() {} }; -class IFXJS_Runtime { +class IJS_Runtime { public: - static IFXJS_Runtime* Create(CPDFDoc_Environment* pEnv); - virtual ~IFXJS_Runtime() {} + static IJS_Runtime* Create(CPDFDoc_Environment* pEnv); + virtual ~IJS_Runtime() {} - virtual IFXJS_Context* NewContext() = 0; - virtual void ReleaseContext(IFXJS_Context* pContext) = 0; - virtual IFXJS_Context* GetCurrentContext() = 0; + virtual IJS_Context* NewContext() = 0; + virtual void ReleaseContext(IJS_Context* pContext) = 0; + virtual IJS_Context* GetCurrentContext() = 0; virtual void SetReaderDocument(CPDFSDK_Document* pReaderDoc) = 0; virtual CPDFSDK_Document* GetReaderDocument() = 0; protected: - IFXJS_Runtime() {} + IJS_Runtime() {} }; #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ diff --git a/fpdfsdk/include/jsapi/fxjs_v8.h b/fpdfsdk/include/jsapi/fxjs_v8.h index f174b21f0a..651414b53b 100644 --- a/fpdfsdk/include/jsapi/fxjs_v8.h +++ b/fpdfsdk/include/jsapi/fxjs_v8.h @@ -4,8 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -// PDFium wrapper around V8 APIs. PDFium code should include this file rather -// than including V8 headers directly. +// FXJS_V8 is a layer that makes it easier to define native objects in V8, but +// has no knowledge of PDF-specific native objects. It could in theory be used +// to implement other sets of native objects. + +// PDFium code should include this file rather than including V8 headers +// directly. #ifndef FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ #define FPDFSDK_INCLUDE_JSAPI_FXJS_V8_H_ @@ -15,8 +19,8 @@ // FXJS_V8 places no interpretation on these two classes; it merely // passes them on to the caller-provided FXJS_CONSTRUCTORs. -class IFXJS_Context; -class IFXJS_Runtime; +class IJS_Context; +class IJS_Runtime; enum FXJSOBJTYPE { FXJSOBJTYPE_DYNAMIC = 0, // Created by native method and returned to JS. @@ -57,7 +61,7 @@ class FXJS_ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { void Free(void* data, size_t length) override; }; -using FXJS_CONSTRUCTOR = void (*)(IFXJS_Context* cc, v8::Local obj); +using FXJS_CONSTRUCTOR = void (*)(IJS_Context* cc, v8::Local obj); using FXJS_DESTRUCTOR = void (*)(v8::Local obj); // Call before making FXJS_PrepareIsolate call. @@ -115,22 +119,22 @@ void FXJS_DefineGlobalConst(v8::Isolate* pIsolate, // Called after FXJS_Define* calls made. void FXJS_InitializeRuntime(v8::Isolate* pIsolate, - IFXJS_Runtime* pFXRuntime, - IFXJS_Context* context, + IJS_Runtime* pFXRuntime, + IJS_Context* context, v8::Global& v8PersistentContext); void FXJS_ReleaseRuntime(v8::Isolate* pIsolate, v8::Global& v8PersistentContext); -IFXJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); +IJS_Runtime* FXJS_GetRuntimeFromIsolate(v8::Isolate* pIsolate); // Called after FXJS_InitializeRuntime call made. int FXJS_Execute(v8::Isolate* pIsolate, - IFXJS_Context* pJSContext, + IJS_Context* pJSContext, const wchar_t* script, long length, FXJSErr* perror); v8::Local FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, - IFXJS_Context* pJSContext, + IJS_Context* pJSContext, int nObjDefnID); v8::Local FXJS_GetThisObj(v8::Isolate* pIsolate); int FXJS_GetObjDefnID(v8::Local pObj); -- cgit v1.2.3