diff options
author | dsinclair <dsinclair@chromium.org> | 2016-07-12 10:42:14 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-12 10:42:14 -0700 |
commit | b3f2467e065fdb36ae7c46e0a3e0b2902c8eb7f8 (patch) | |
tree | 1bec44d79b085286fba0bfe6185cd24625b6e74a | |
parent | 7f9c8609999bf3bd0b33b5b350fb9baa008cf967 (diff) | |
download | pdfium-b3f2467e065fdb36ae7c46e0a3e0b2902c8eb7f8.tar.xz |
Move fpdfsdk/jsapi into fxjs/
This CL moves the fpdfsdk/sjapi code info fxjs/. The "fxjs" library is moved
from being XFA specific to being compiled if V8 is enabled.
The fxjs_v8 files are required when building for XFA (they have XFA defines
in them) and are used in CFXJS_RuntimeData. The cfxjse_* files are only added
if XFA is also enabled.
Review-Url: https://codereview.chromium.org/2144603003
-rw-r--r-- | BUILD.gn | 64 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Define.h | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Object.h | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/JS_Value.h | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/cjs_runtime.h | 2 | ||||
-rw-r--r-- | fxjs/DEPS | 2 | ||||
-rw-r--r-- | fxjs/cfxjse_runtimedata.cpp | 2 | ||||
-rw-r--r-- | fxjs/fxjs_v8.cpp (renamed from fpdfsdk/jsapi/fxjs_v8.cpp) | 6 | ||||
-rw-r--r-- | fxjs/fxjs_v8_embeddertest.cpp (renamed from fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp) | 0 | ||||
-rw-r--r-- | fxjs/include/fxjs_v8.h (renamed from fpdfsdk/jsapi/include/fxjs_v8.h) | 6 | ||||
-rw-r--r-- | pdfium.gyp | 58 | ||||
-rw-r--r-- | testing/DEPS | 2 | ||||
-rw-r--r-- | testing/js_embedder_test.h | 2 | ||||
-rw-r--r-- | xfa.gyp | 35 |
14 files changed, 89 insertions, 96 deletions
@@ -828,15 +828,9 @@ static_library("javascript") { "fpdfsdk/javascript/resource.h", "fpdfsdk/javascript/util.cpp", "fpdfsdk/javascript/util.h", - "fpdfsdk/jsapi/fxjs_v8.cpp", - "fpdfsdk/jsapi/include/fxjs_v8.h", ] - include_dirs = [ - "//v8", - "//v8/include", - ] - public_deps = [ - "//v8", + deps = [ + ":fxjs", ] configs += [ "//v8:external_startup_data" ] } else { @@ -869,25 +863,32 @@ static_library("formfiller") { configs += [ ":pdfium_core_config" ] } -if (pdf_enable_xfa) { +if (pdf_enable_v8) { static_library("fxjs") { sources = [ - "fxjs/cfxjse_arguments.cpp", - "fxjs/cfxjse_class.cpp", - "fxjs/cfxjse_context.cpp", - "fxjs/cfxjse_isolatetracker.cpp", - "fxjs/cfxjse_isolatetracker.h", - "fxjs/cfxjse_runtimedata.cpp", - "fxjs/cfxjse_runtimedata.h", - "fxjs/cfxjse_value.cpp", - "fxjs/include/cfxjse_arguments.h", - "fxjs/include/cfxjse_class.h", - "fxjs/include/cfxjse_context.h", - "fxjs/include/cfxjse_value.h", - "fxjs/include/fxjse.h", + "fxjs/fxjs_v8.cpp", + "fxjs/include/fxjs_v8.h", ] + if (pdf_enable_xfa) { + sources += [ + "fxjs/cfxjse_arguments.cpp", + "fxjs/cfxjse_class.cpp", + "fxjs/cfxjse_context.cpp", + "fxjs/cfxjse_isolatetracker.cpp", + "fxjs/cfxjse_isolatetracker.h", + "fxjs/cfxjse_runtimedata.cpp", + "fxjs/cfxjse_runtimedata.h", + "fxjs/cfxjse_value.cpp", + "fxjs/include/cfxjse_arguments.h", + "fxjs/include/cfxjse_class.h", + "fxjs/include/cfxjse_context.h", + "fxjs/include/cfxjse_value.h", + "fxjs/include/fxjse.h", + ] + } deps = [ - "//v8:v8_libplatform", + "//v8", + "//v8:v8_libplatform", ] configs += [ ":pdfium_core_config" ] include_dirs = [ @@ -898,7 +899,9 @@ if (pdf_enable_xfa) { "//v8", ] } +} +if (pdf_enable_xfa) { static_library("fpdfxfa") { sources = [ "fpdfsdk/fpdfxfa/fpdfxfa_app.cpp", @@ -1456,9 +1459,7 @@ if (pdf_enable_xfa) { "xfa/fxgraphics/cfx_shading.h", "xfa/fxgraphics/include/cfx_graphics.h", ] - include_dirs = [ - ".", - ] + include_dirs = [ "." ] deps = [ ":fxjs", ] @@ -1565,18 +1566,11 @@ test("pdfium_embeddertests") { if (pdf_enable_v8) { sources += [ "fpdfsdk/javascript/public_methods_embeddertest.cpp", - "fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp", + "fxjs/fxjs_v8_embeddertest.cpp", "testing/js_embedder_test.cpp", "testing/js_embedder_test.h", ] - deps += [ - "//v8", - "//v8:v8_libplatform", - ] - include_dirs += [ - "//v8", - "//v8/include", - ] + deps += [ ":fxjs" ] configs += [ "//v8:external_startup_data" ] } configs += [ ":pdfium_core_config" ] diff --git a/fpdfsdk/javascript/JS_Define.h b/fpdfsdk/javascript/JS_Define.h index 2c00818d08..ffef6267c8 100644 --- a/fpdfsdk/javascript/JS_Define.h +++ b/fpdfsdk/javascript/JS_Define.h @@ -12,7 +12,7 @@ #include "fpdfsdk/javascript/JS_Object.h" #include "fpdfsdk/javascript/JS_Value.h" #include "fpdfsdk/javascript/resource.h" -#include "fpdfsdk/jsapi/include/fxjs_v8.h" +#include "fxjs/include/fxjs_v8.h" struct JSConstSpec { const wchar_t* pName; diff --git a/fpdfsdk/javascript/JS_Object.h b/fpdfsdk/javascript/JS_Object.h index 908645ce33..7105ec6cd0 100644 --- a/fpdfsdk/javascript/JS_Object.h +++ b/fpdfsdk/javascript/JS_Object.h @@ -12,7 +12,7 @@ #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/javascript/cjs_runtime.h" -#include "fpdfsdk/jsapi/include/fxjs_v8.h" +#include "fxjs/include/fxjs_v8.h" class CJS_Context; class CJS_Object; diff --git a/fpdfsdk/javascript/JS_Value.h b/fpdfsdk/javascript/JS_Value.h index 958c5e070e..e8544504d2 100644 --- a/fpdfsdk/javascript/JS_Value.h +++ b/fpdfsdk/javascript/JS_Value.h @@ -10,7 +10,7 @@ #include <vector> #include "core/fxcrt/include/fx_basic.h" -#include "fpdfsdk/jsapi/include/fxjs_v8.h" +#include "fxjs/include/fxjs_v8.h" class CJS_Array; class CJS_Date; diff --git a/fpdfsdk/javascript/cjs_runtime.h b/fpdfsdk/javascript/cjs_runtime.h index 2668367c1b..c43a34b720 100644 --- a/fpdfsdk/javascript/cjs_runtime.h +++ b/fpdfsdk/javascript/cjs_runtime.h @@ -16,7 +16,7 @@ #include "core/fxcrt/include/fx_basic.h" #include "fpdfsdk/javascript/JS_EventHandler.h" #include "fpdfsdk/javascript/ijs_runtime.h" -#include "fpdfsdk/jsapi/include/fxjs_v8.h" +#include "fxjs/include/fxjs_v8.h" class CJS_Context; @@ -1,6 +1,4 @@ include_rules = [ '+core/fxcrt/include', - # TODO(dsinclair): Layering violation. FXJSE can't include FPDFSDK. - '+fpdfsdk/jsapi/include', '+v8/include', ] diff --git a/fxjs/cfxjse_runtimedata.cpp b/fxjs/cfxjse_runtimedata.cpp index f58f5f852d..b203cb71ac 100644 --- a/fxjs/cfxjse_runtimedata.cpp +++ b/fxjs/cfxjse_runtimedata.cpp @@ -6,8 +6,8 @@ #include "fxjs/cfxjse_runtimedata.h" -#include "fpdfsdk/jsapi/include/fxjs_v8.h" #include "fxjs/cfxjse_isolatetracker.h" +#include "fxjs/include/fxjs_v8.h" namespace { diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fxjs/fxjs_v8.cpp index ddeb28f237..c98de070ab 100644 --- a/fpdfsdk/jsapi/fxjs_v8.cpp +++ b/fxjs/fxjs_v8.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/jsapi/include/fxjs_v8.h" +#include "fxjs/include/fxjs_v8.h" #include <vector> @@ -514,8 +514,8 @@ v8::Local<v8::Object> FXJS_NewFxDynamicObj(v8::Isolate* pIsolate, pObjDef->m_pConstructor(pIRuntime, obj); if (!bStatic && FXJS_PerIsolateData::Get(pIsolate)->m_pDynamicObjsMap) { - FXJS_PerIsolateData::Get(pIsolate) - ->m_pDynamicObjsMap->set(pPerObjData, obj); + FXJS_PerIsolateData::Get(pIsolate)->m_pDynamicObjsMap->set(pPerObjData, + obj); } return obj; } diff --git a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp b/fxjs/fxjs_v8_embeddertest.cpp index b33ddca32d..b33ddca32d 100644 --- a/fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp +++ b/fxjs/fxjs_v8_embeddertest.cpp diff --git a/fpdfsdk/jsapi/include/fxjs_v8.h b/fxjs/include/fxjs_v8.h index 3ae1d5e0ca..465feef5e8 100644 --- a/fpdfsdk/jsapi/include/fxjs_v8.h +++ b/fxjs/include/fxjs_v8.h @@ -11,8 +11,8 @@ // PDFium code should include this file rather than including V8 headers // directly. -#ifndef FPDFSDK_JSAPI_INCLUDE_FXJS_V8_H_ -#define FPDFSDK_JSAPI_INCLUDE_FXJS_V8_H_ +#ifndef FXJS_INCLUDE_FXJS_V8_H_ +#define FXJS_INCLUDE_FXJS_V8_H_ #include <v8-util.h> #include <v8.h> @@ -287,4 +287,4 @@ v8::Local<v8::Array> FXJS_ToArray(v8::Isolate* pIsolate, v8::Local<v8::Value> pValue); void FXJS_ValueCopy(v8::Local<v8::Value>& pTo, v8::Local<v8::Value> pFrom); -#endif // FPDFSDK_JSAPI_INCLUDE_FXJS_V8_H_ +#endif // FXJS_INCLUDE_FXJS_V8_H_ diff --git a/pdfium.gyp b/pdfium.gyp index 76a22a9f8a..79ff0886d5 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -779,15 +779,8 @@ ], 'conditions': [ ['pdf_enable_v8==1', { - 'include_dirs': [ - '<(DEPTH)/v8', - '<(DEPTH)/v8/include', - ], 'dependencies': [ - '<(DEPTH)/v8/src/v8.gyp:v8', - ], - 'export_dependent_settings': [ - '<(DEPTH)/v8/src/v8.gyp:v8', + ':fxjs' ], 'sources!': [ 'fpdfsdk/javascript/JS_Runtime_Stub.cpp', @@ -835,8 +828,6 @@ 'fpdfsdk/javascript/resource.h', 'fpdfsdk/javascript/util.cpp', 'fpdfsdk/javascript/util.h', - 'fpdfsdk/jsapi/include/fxjs_v8.h', - 'fpdfsdk/jsapi/fxjs_v8.cpp', ], }], ], @@ -977,7 +968,7 @@ ], 'sources': [ 'fpdfsdk/javascript/public_methods_embeddertest.cpp', - 'fpdfsdk/jsapi/fxjs_v8_embeddertest.cpp', + 'fxjs/fxjs_v8_embeddertest.cpp', 'testing/js_embedder_test.cpp', 'testing/js_embedder_test.h', ], @@ -1013,12 +1004,57 @@ }, ], 'conditions': [ + ['pdf_enable_v8==1', { + 'targets': [ + { + "target_name": "fxjs", + "type": "static_library", + 'include_dirs': [ + # This is implicit in GN. + '<(DEPTH)', + '.', + '<(DEPTH)/v8', + '<(DEPTH)/v8/include', + ], + 'dependencies': [ + '<(DEPTH)/v8/src/v8.gyp:v8', + ], + 'export_dependent_settings': [ + '<(DEPTH)/v8/src/v8.gyp:v8', + ], + "sources": [ + "fxjs/fxjs_v8.cpp", + "fxjs/include/fxjs_v8.h", + ], + "conditions": [ + ['pdf_enable_xfa==1', { + 'sources': [ + "fxjs/cfxjse_arguments.cpp", + "fxjs/cfxjse_class.cpp", + "fxjs/cfxjse_context.cpp", + "fxjs/cfxjse_isolatetracker.cpp", + "fxjs/cfxjse_isolatetracker.h", + "fxjs/cfxjse_runtimedata.cpp", + "fxjs/cfxjse_runtimedata.h", + "fxjs/cfxjse_value.cpp", + "fxjs/include/cfxjse_arguments.h", + "fxjs/include/cfxjse_class.h", + "fxjs/include/cfxjse_context.h", + "fxjs/include/cfxjse_value.h", + "fxjs/include/fxjse.h", + ] + }], + ], + }, + ] + }], ['pdf_enable_xfa==1', { 'targets': [ { 'target_name': 'fpdfxfa', 'type': 'static_library', 'dependencies': [ + 'fxjs', 'javascript', 'xfa.gyp:xfa', ], diff --git a/testing/DEPS b/testing/DEPS index 44e064607f..babefb8593 100644 --- a/testing/DEPS +++ b/testing/DEPS @@ -3,7 +3,7 @@ include_rules = [ '+core/fxcodec', '+core/fxcrt/include', '+core/fxge/include', - '+fpdfsdk/jsapi/include', + '+fxjs/include', '+public', '+v8', '+xfa/fde', diff --git a/testing/js_embedder_test.h b/testing/js_embedder_test.h index 5583e7e388..b2bd5a87b1 100644 --- a/testing/js_embedder_test.h +++ b/testing/js_embedder_test.h @@ -8,7 +8,7 @@ #include <memory> #include <vector> -#include "fpdfsdk/jsapi/include/fxjs_v8.h" +#include "fxjs/include/fxjs_v8.h" #include "testing/embedder_test.h" class JSEmbedderTest : public EmbedderTest { @@ -16,38 +16,6 @@ }, "targets":[ { - "target_name": "fxjs", - "type": "static_library", - 'include_dirs': [ - # This is implicit in GN. - '<(DEPTH)', - '.', - '<(DEPTH)/v8', - '<(DEPTH)/v8/include', - ], - 'dependencies': [ - '<(DEPTH)/v8/src/v8.gyp:v8', - ], - 'export_dependent_settings': [ - '<(DEPTH)/v8/src/v8.gyp:v8', - ], - "sources": [ - "fxjs/cfxjse_arguments.cpp", - "fxjs/cfxjse_class.cpp", - "fxjs/cfxjse_context.cpp", - "fxjs/cfxjse_isolatetracker.cpp", - "fxjs/cfxjse_isolatetracker.h", - "fxjs/cfxjse_runtimedata.cpp", - "fxjs/cfxjse_runtimedata.h", - "fxjs/cfxjse_value.cpp", - "fxjs/include/cfxjse_arguments.h", - "fxjs/include/cfxjse_class.h", - "fxjs/include/cfxjse_context.h", - "fxjs/include/cfxjse_value.h", - "fxjs/include/fxjse.h", - ] - }, - { "target_name":"xfa", "type":"static_library", 'include_dirs': [ @@ -60,9 +28,6 @@ 'defines' : [ 'FT2_BUILD_LIBRARY', ], - 'dependencies': [ - ':fxjs', - ], "sources":[ "xfa/fde/cfde_path.cpp", "xfa/fde/cfde_path.h", |