From 70156345b2a7bc57b8bfca5f3d58c34505ad6518 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 18 Oct 2018 19:29:59 +0000 Subject: Forward declare some fxjs/ classes. And remove unnecessary fxjs/ #includes in header files. Change-Id: If89dd2717b6ba93dbb7493e8ca80d78deaa64b06 Reviewed-on: https://pdfium-review.googlesource.com/c/44270 Reviewed-by: Tom Sepez Commit-Queue: Lei Zhang --- fxjs/cfx_v8_unittest.cpp | 1 + fxjs/cfx_v8_unittest.h | 9 +++++++-- fxjs/cfxjse_arguments.h | 1 - fxjs/cfxjse_class.cpp | 1 + fxjs/cfxjse_class.h | 1 + fxjs/cfxjse_context.cpp | 2 ++ fxjs/cfxjse_context.h | 3 ++- fxjs/cfxjse_engine.cpp | 1 + fxjs/cfxjse_formcalc_context.cpp | 1 + fxjs/cfxjse_formcalc_context.h | 2 +- fxjs/cfxjse_formcalc_context_embeddertest.cpp | 1 + fxjs/cfxjse_isolatetracker.cpp | 2 ++ fxjs/cfxjse_isolatetracker.h | 1 - fxjs/cfxjse_value.cpp | 1 + fxjs/cfxjse_value.h | 2 -- fxjs/cjs_object.cpp | 2 ++ fxjs/cjs_object.h | 3 ++- fxjs/cjs_result.h | 2 +- fxjs/ijs_runtime.h | 5 +---- fxjs/jse_define.h | 3 ++- fxjs/xfa/cjx_desc.cpp | 1 + fxjs/xfa/cjx_field.cpp | 1 + fxjs/xfa/cjx_manifest.cpp | 1 + fxjs/xfa/cjx_packet.cpp | 1 + fxjs/xfa/cjx_signaturepseudomodel.cpp | 1 + fxjs/xfa/cjx_subform.cpp | 1 + fxjs/xfa/cjx_template.cpp | 1 + fxjs/xfa/cjx_wsdlconnection.cpp | 1 + testing/js_embedder_test.cpp | 1 + testing/js_embedder_test.h | 6 +++++- testing/xfa_js_embedder_test.cpp | 1 + testing/xfa_js_embedder_test.h | 4 ++-- 32 files changed, 46 insertions(+), 18 deletions(-) diff --git a/fxjs/cfx_v8_unittest.cpp b/fxjs/cfx_v8_unittest.cpp index 879d90462d..f6051ad935 100644 --- a/fxjs/cfx_v8_unittest.cpp +++ b/fxjs/cfx_v8_unittest.cpp @@ -6,6 +6,7 @@ #include +#include "fxjs/cfx_v8.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" #include "third_party/base/ptr_util.h" diff --git a/fxjs/cfx_v8_unittest.h b/fxjs/cfx_v8_unittest.h index 196a10f3ff..e5d4e3f15e 100644 --- a/fxjs/cfx_v8_unittest.h +++ b/fxjs/cfx_v8_unittest.h @@ -5,12 +5,17 @@ #ifndef FXJS_CFX_V8_UNITTEST_H_ #define FXJS_CFX_V8_UNITTEST_H_ -#include "fxjs/cfx_v8.h" - #include #include "testing/gtest/include/gtest/gtest.h" +class CFX_V8; +class CFX_V8ArrayBufferAllocator; + +namespace v8 { +class Isolate; +} // namespace v8 + class FXV8UnitTest : public ::testing::Test { public: struct V8IsolateDeleter { diff --git a/fxjs/cfxjse_arguments.h b/fxjs/cfxjse_arguments.h index d523d6f906..05fb97411a 100644 --- a/fxjs/cfxjse_arguments.h +++ b/fxjs/cfxjse_arguments.h @@ -11,7 +11,6 @@ #include "core/fxcrt/unowned_ptr.h" #include "fxjs/cfxjse_class.h" -#include "fxjs/fxjse.h" class CFXJSE_Arguments { public: diff --git a/fxjs/cfxjse_class.cpp b/fxjs/cfxjse_class.cpp index deecf8b179..266e0f1696 100644 --- a/fxjs/cfxjse_class.cpp +++ b/fxjs/cfxjse_class.cpp @@ -11,6 +11,7 @@ #include "fxjs/cfxjse_arguments.h" #include "fxjs/cfxjse_context.h" +#include "fxjs/cfxjse_isolatetracker.h" #include "fxjs/cfxjse_value.h" #include "fxjs/cjs_result.h" #include "fxjs/js_resources.h" diff --git a/fxjs/cfxjse_class.h b/fxjs/cfxjse_class.h index fd9786ea3b..9b4444a79a 100644 --- a/fxjs/cfxjse_class.h +++ b/fxjs/cfxjse_class.h @@ -13,6 +13,7 @@ class CFXJSE_Context; class CFXJSE_Value; +struct FXJSE_CLASS_DESCRIPTOR; class CFXJSE_Class { public: diff --git a/fxjs/cfxjse_context.cpp b/fxjs/cfxjse_context.cpp index eac4caf9b2..03778b0a02 100644 --- a/fxjs/cfxjse_context.cpp +++ b/fxjs/cfxjse_context.cpp @@ -10,6 +10,8 @@ #include "fxjs/cfxjs_engine.h" #include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_isolatetracker.h" +#include "fxjs/cfxjse_runtimedata.h" #include "fxjs/cfxjse_value.h" #include "third_party/base/ptr_util.h" diff --git a/fxjs/cfxjse_context.h b/fxjs/cfxjse_context.h index 2e47adb65f..306cefd68c 100644 --- a/fxjs/cfxjse_context.h +++ b/fxjs/cfxjse_context.h @@ -10,12 +10,13 @@ #include #include +#include "core/fxcrt/fx_string.h" #include "core/fxcrt/unowned_ptr.h" -#include "fxjs/fxjse.h" #include "v8/include/v8.h" class CFXJS_Engine; class CFXJSE_Class; +class CFXJSE_HostObject; class CFXJSE_Value; struct FXJSE_CLASS_DESCRIPTOR; diff --git a/fxjs/cfxjse_engine.cpp b/fxjs/cfxjse_engine.cpp index d5c43137db..92dc2d548f 100644 --- a/fxjs/cfxjse_engine.cpp +++ b/fxjs/cfxjse_engine.cpp @@ -12,6 +12,7 @@ #include "core/fxcrt/cfx_widetextbuf.h" #include "core/fxcrt/fx_extension.h" #include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_context.h" #include "fxjs/cfxjse_resolveprocessor.h" #include "fxjs/cfxjse_value.h" #include "fxjs/cjs_runtime.h" diff --git a/fxjs/cfxjse_formcalc_context.cpp b/fxjs/cfxjse_formcalc_context.cpp index 41ec5783ff..771c53ab36 100644 --- a/fxjs/cfxjse_formcalc_context.cpp +++ b/fxjs/cfxjse_formcalc_context.cpp @@ -16,6 +16,7 @@ #include "core/fxcrt/fx_random.h" #include "core/fxcrt/locale_iface.h" #include "fxjs/cfxjse_class.h" +#include "fxjs/cfxjse_context.h" #include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "fxjs/xfa/cjx_object.h" diff --git a/fxjs/cfxjse_formcalc_context.h b/fxjs/cfxjse_formcalc_context.h index a03c66f5ba..b1023308f3 100644 --- a/fxjs/cfxjse_formcalc_context.h +++ b/fxjs/cfxjse_formcalc_context.h @@ -12,9 +12,9 @@ #include "core/fxcrt/unowned_ptr.h" #include "fxjs/cfxjse_arguments.h" -#include "fxjs/cfxjse_context.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" +class CFXJSE_Context; class CFX_WideTextBuf; class CXFA_Document; diff --git a/fxjs/cfxjse_formcalc_context_embeddertest.cpp b/fxjs/cfxjse_formcalc_context_embeddertest.cpp index 22e6b25afc..d348f5bfb9 100644 --- a/fxjs/cfxjse_formcalc_context_embeddertest.cpp +++ b/fxjs/cfxjse_formcalc_context_embeddertest.cpp @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "fxjs/cfxjse_engine.h" +#include "fxjs/cfxjse_value.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/xfa_js_embedder_test.h" #include "xfa/fxfa/cxfa_eventparam.h" diff --git a/fxjs/cfxjse_isolatetracker.cpp b/fxjs/cfxjse_isolatetracker.cpp index 2a66a74a8b..c126575018 100644 --- a/fxjs/cfxjse_isolatetracker.cpp +++ b/fxjs/cfxjse_isolatetracker.cpp @@ -6,6 +6,8 @@ #include "fxjs/cfxjse_isolatetracker.h" +#include "fxjs/cfxjse_runtimedata.h" + CFXJSE_ScopeUtil_IsolateHandle::CFXJSE_ScopeUtil_IsolateHandle( v8::Isolate* pIsolate) : m_iscope(pIsolate), m_hscope(pIsolate) {} diff --git a/fxjs/cfxjse_isolatetracker.h b/fxjs/cfxjse_isolatetracker.h index 4e95498270..0f336e257e 100644 --- a/fxjs/cfxjse_isolatetracker.h +++ b/fxjs/cfxjse_isolatetracker.h @@ -7,7 +7,6 @@ #ifndef FXJS_CFXJSE_ISOLATETRACKER_H_ #define FXJS_CFXJSE_ISOLATETRACKER_H_ -#include "fxjs/cfxjse_runtimedata.h" #include "v8/include/v8.h" class CFXJSE_ScopeUtil_IsolateHandle { diff --git a/fxjs/cfxjse_value.cpp b/fxjs/cfxjse_value.cpp index 7559f02e49..8bc243e097 100644 --- a/fxjs/cfxjse_value.cpp +++ b/fxjs/cfxjse_value.cpp @@ -10,6 +10,7 @@ #include "fxjs/cfxjse_class.h" #include "fxjs/cfxjse_context.h" +#include "fxjs/cfxjse_isolatetracker.h" namespace { diff --git a/fxjs/cfxjse_value.h b/fxjs/cfxjse_value.h index f83ddc31c7..55b214f71e 100644 --- a/fxjs/cfxjse_value.h +++ b/fxjs/cfxjse_value.h @@ -13,8 +13,6 @@ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" #include "core/fxcrt/unowned_ptr.h" -#include "fxjs/cfxjse_isolatetracker.h" -#include "fxjs/cfxjse_runtimedata.h" #include "v8/include/v8.h" class CFXJSE_Class; diff --git a/fxjs/cjs_object.cpp b/fxjs/cjs_object.cpp index e30f6b4070..e13a5095db 100644 --- a/fxjs/cjs_object.cpp +++ b/fxjs/cjs_object.cpp @@ -6,6 +6,8 @@ #include "fxjs/cjs_object.h" +#include "fxjs/cfxjs_engine.h" + // static void CJS_Object::DefineConsts(CFXJS_Engine* pEngine, int objId, diff --git a/fxjs/cjs_object.h b/fxjs/cjs_object.h index c8a4451ef0..2bb08fea45 100644 --- a/fxjs/cjs_object.h +++ b/fxjs/cjs_object.h @@ -9,10 +9,11 @@ #include "core/fxcrt/unowned_ptr.h" #include "fpdfsdk/cpdfsdk_helpers.h" -#include "fxjs/cfxjs_engine.h" #include "fxjs/cjs_runtime.h" #include "third_party/base/span.h" +class CFXJS_Engine; + struct JSConstSpec { enum Type { Number = 0, String = 1 }; diff --git a/fxjs/cjs_result.h b/fxjs/cjs_result.h index dc65d18c73..5e1ed7cee9 100644 --- a/fxjs/cjs_result.h +++ b/fxjs/cjs_result.h @@ -7,9 +7,9 @@ #ifndef FXJS_CJS_RESULT_H_ #define FXJS_CJS_RESULT_H_ -#include "fxjs/cfxjs_engine.h" #include "fxjs/js_resources.h" #include "third_party/base/optional.h" +#include "v8/include/v8.h" class CJS_Result { public: diff --git a/fxjs/ijs_runtime.h b/fxjs/ijs_runtime.h index 61aeda5600..781e86c576 100644 --- a/fxjs/ijs_runtime.h +++ b/fxjs/ijs_runtime.h @@ -14,10 +14,7 @@ #include "core/fxcrt/unowned_ptr.h" #include "third_party/base/optional.h" -#ifdef PDF_ENABLE_XFA -#include "fxjs/fxjse.h" -#endif // PDF_ENABLE_XFA - +class CFXJSE_Value; class CJS_Runtime; class CPDFSDK_FormFillEnvironment; class IJS_EventContext; diff --git a/fxjs/jse_define.h b/fxjs/jse_define.h index 373917fe6a..669ecefb23 100644 --- a/fxjs/jse_define.h +++ b/fxjs/jse_define.h @@ -9,9 +9,10 @@ #include -#include "fxjs/cfx_v8.h" #include "fxjs/cjs_result.h" +class CFX_V8; + template >& params)> diff --git a/fxjs/xfa/cjx_desc.cpp b/fxjs/xfa/cjx_desc.cpp index 004fa447b1..84659b1785 100644 --- a/fxjs/xfa/cjx_desc.cpp +++ b/fxjs/xfa/cjx_desc.cpp @@ -8,6 +8,7 @@ #include +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/parser/cxfa_desc.h" diff --git a/fxjs/xfa/cjx_field.cpp b/fxjs/xfa/cjx_field.cpp index bb84588ece..453bac0aa8 100644 --- a/fxjs/xfa/cjx_field.cpp +++ b/fxjs/xfa/cjx_field.cpp @@ -9,6 +9,7 @@ #include #include "core/fxcrt/cfx_decimal.h" +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/cxfa_eventparam.h" diff --git a/fxjs/xfa/cjx_manifest.cpp b/fxjs/xfa/cjx_manifest.cpp index b53c7edd85..458ae011a6 100644 --- a/fxjs/xfa/cjx_manifest.cpp +++ b/fxjs/xfa/cjx_manifest.cpp @@ -8,6 +8,7 @@ #include +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/parser/cxfa_manifest.h" diff --git a/fxjs/xfa/cjx_packet.cpp b/fxjs/xfa/cjx_packet.cpp index 5673f8aecd..2f5f307484 100644 --- a/fxjs/xfa/cjx_packet.cpp +++ b/fxjs/xfa/cjx_packet.cpp @@ -11,6 +11,7 @@ #include "core/fxcrt/xml/cfx_xmldocument.h" #include "core/fxcrt/xml/cfx_xmltext.h" +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/cxfa_ffdoc.h" diff --git a/fxjs/xfa/cjx_signaturepseudomodel.cpp b/fxjs/xfa/cjx_signaturepseudomodel.cpp index 0a604a5b40..1cda7c91b6 100644 --- a/fxjs/xfa/cjx_signaturepseudomodel.cpp +++ b/fxjs/xfa/cjx_signaturepseudomodel.cpp @@ -8,6 +8,7 @@ #include +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp index c08d2e684c..2fd09570f6 100644 --- a/fxjs/xfa/cjx_subform.cpp +++ b/fxjs/xfa/cjx_subform.cpp @@ -8,6 +8,7 @@ #include +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/cxfa_eventparam.h" diff --git a/fxjs/xfa/cjx_template.cpp b/fxjs/xfa/cjx_template.cpp index b97d5e3634..fa0b979130 100644 --- a/fxjs/xfa/cjx_template.cpp +++ b/fxjs/xfa/cjx_template.cpp @@ -8,6 +8,7 @@ #include +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/parser/cxfa_document.h" diff --git a/fxjs/xfa/cjx_wsdlconnection.cpp b/fxjs/xfa/cjx_wsdlconnection.cpp index dec20d7163..07e786eacd 100644 --- a/fxjs/xfa/cjx_wsdlconnection.cpp +++ b/fxjs/xfa/cjx_wsdlconnection.cpp @@ -8,6 +8,7 @@ #include +#include "fxjs/cfx_v8.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" #include "xfa/fxfa/parser/cxfa_wsdlconnection.h" diff --git a/testing/js_embedder_test.cpp b/testing/js_embedder_test.cpp index 9821a21166..57e6c4d317 100644 --- a/testing/js_embedder_test.cpp +++ b/testing/js_embedder_test.cpp @@ -4,6 +4,7 @@ #include "testing/js_embedder_test.h" +#include "fxjs/cfxjs_engine.h" #include "third_party/base/ptr_util.h" JSEmbedderTest::JSEmbedderTest() diff --git a/testing/js_embedder_test.h b/testing/js_embedder_test.h index 6f694a7438..dca0bd76c2 100644 --- a/testing/js_embedder_test.h +++ b/testing/js_embedder_test.h @@ -7,8 +7,12 @@ #include -#include "fxjs/cfxjs_engine.h" +#include "fxjs/cfx_v8.h" #include "testing/embedder_test.h" +#include "v8/include/v8.h" + +class CFXJS_Engine; +class CFX_V8ArrayBufferAllocator; class JSEmbedderTest : public EmbedderTest { public: diff --git a/testing/xfa_js_embedder_test.cpp b/testing/xfa_js_embedder_test.cpp index 8d2f64eaa7..483d61154c 100644 --- a/testing/xfa_js_embedder_test.cpp +++ b/testing/xfa_js_embedder_test.cpp @@ -9,6 +9,7 @@ #include "fpdfsdk/cpdfsdk_helpers.h" #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" #include "fxjs/cfxjse_engine.h" +#include "fxjs/cfxjse_value.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/base/ptr_util.h" #include "xfa/fxfa/cxfa_ffapp.h" diff --git a/testing/xfa_js_embedder_test.h b/testing/xfa_js_embedder_test.h index 3534280676..0c8b08e670 100644 --- a/testing/xfa_js_embedder_test.h +++ b/testing/xfa_js_embedder_test.h @@ -8,14 +8,14 @@ #include #include -#include "fxjs/cfxjs_engine.h" -#include "fxjs/cfxjse_value.h" #include "testing/embedder_test.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/cxfa_object.h" class CFXJSE_Engine; +class CFXJSE_Value; +class CFX_V8ArrayBufferAllocator; class XFAJSEmbedderTest : public EmbedderTest { public: -- cgit v1.2.3