Commit 92bfb63c authored by Dan Elphick's avatar Dan Elphick Committed by V8 LUCI CQ

[build] Separate out inspector as a shared library

This makes src/inspector:inspector into a v8_component producing a
shared library in component builds. To enable this, all of its exported
are now marked with V8_INSPECTOR_EXPORT.

This also inverts the dependency between src/inspector:inspector and
:v8_base_without_compiler, and instead makes d8 and some tests depend on
inspector rather than getting it via v8.

As a result, the no_check_targets exclusions list in .gn is reduced.

Ultimately embedders like chromium should depend on :v8 and optionally
src/inspector:inspector, but to allow that transition to occur, this
renames :v8 to :v8_lib and introduces a new :v8 which depends on v8 and
inspector. Once all embedders have changed to reflect the new structure,
this part can be reverted.

Bug: v8:11917
Change-Id: Ia8b15f07fb15acc5e1f111b1a80248def4285fd0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2999088Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75532}
parent a615b127
...@@ -18,8 +18,6 @@ script_executable = "python3" ...@@ -18,8 +18,6 @@ script_executable = "python3"
no_check_targets = [ no_check_targets = [
"//:cppgc_base", "//:cppgc_base",
"//:v8_internal_headers", "//:v8_internal_headers",
"//src/inspector:inspector",
"//test/cctest:cctest_sources",
"//third_party/icu:*", "//third_party/icu:*",
] ]
......
...@@ -716,8 +716,6 @@ filegroup( ...@@ -716,8 +716,6 @@ filegroup(
":generated_bytecode_builtins_list", ":generated_bytecode_builtins_list",
"base/trace_event/common/trace_event_common.h", "base/trace_event/common/trace_event_common.h",
"include/cppgc/common.h", "include/cppgc/common.h",
"include/v8-inspector-protocol.h",
"include/v8-inspector.h",
"include/v8-metrics.h", "include/v8-metrics.h",
"include/v8-unwinder-state.h", "include/v8-unwinder-state.h",
"include/v8-wasm-trap-handler-posix.h", "include/v8-wasm-trap-handler-posix.h",
...@@ -2541,6 +2539,8 @@ filegroup( ...@@ -2541,6 +2539,8 @@ filegroup(
filegroup( filegroup(
name = "v8_inspector_files", name = "v8_inspector_files",
srcs = [ srcs = [
"include/v8-inspector-protocol.h",
"include/v8-inspector.h",
"src/inspector/custom-preview.cc", "src/inspector/custom-preview.cc",
"src/inspector/custom-preview.h", "src/inspector/custom-preview.h",
"src/inspector/injected-script.cc", "src/inspector/injected-script.cc",
......
...@@ -2385,8 +2385,6 @@ v8_header_set("v8_internal_headers") { ...@@ -2385,8 +2385,6 @@ v8_header_set("v8_internal_headers") {
"$target_gen_dir/builtins-generated/bytecodes-builtins-list.h", "$target_gen_dir/builtins-generated/bytecodes-builtins-list.h",
"//base/trace_event/common/trace_event_common.h", "//base/trace_event/common/trace_event_common.h",
"include/cppgc/common.h", "include/cppgc/common.h",
"include/v8-inspector-protocol.h",
"include/v8-inspector.h",
"include/v8-metrics.h", "include/v8-metrics.h",
"include/v8-unwinder-state.h", "include/v8-unwinder-state.h",
"include/v8-wasm-trap-handler-posix.h", "include/v8-wasm-trap-handler-posix.h",
...@@ -4405,7 +4403,6 @@ v8_source_set("v8_base_without_compiler") { ...@@ -4405,7 +4403,6 @@ v8_source_set("v8_base_without_compiler") {
":v8_shared_internal_headers", ":v8_shared_internal_headers",
":v8_tracing", ":v8_tracing",
":v8_version", ":v8_version",
"src/inspector:inspector",
] ]
public_deps = [ public_deps = [
...@@ -5202,7 +5199,13 @@ if (v8_check_header_includes) { ...@@ -5202,7 +5199,13 @@ if (v8_check_header_includes) {
# if the "check_v8_header_includes" gclient variable is set. # if the "check_v8_header_includes" gclient variable is set.
import("check-header-includes/sources.gni") import("check-header-includes/sources.gni")
v8_source_set("check_headers") { v8_source_set("check_headers") {
configs = [ ":internal_config" ] # Doesn't include internal_config as that would bring in the
# BUILDING_V8_SHARED defines which breaks builds due to the dependency on
# inspector which brings in the USING_V8_SHARED define.
configs = [
":internal_config_base",
":v8_header_features",
]
sources = check_header_includes_sources sources = check_header_includes_sources
# Any rules that contain headers files should be added here either directly # Any rules that contain headers files should be added here either directly
...@@ -5559,9 +5562,20 @@ group("v8_fuzzers") { ...@@ -5559,9 +5562,20 @@ group("v8_fuzzers") {
} }
if (is_component_build) { if (is_component_build) {
# TODO(v8:11917) Remove this redirect to v8_lib (and rename that to v8), when
# chromium depends on inspector directly.
v8_component("v8") { v8_component("v8") {
sources = [ "src/utils/v8dll-main.cc" ] sources = [ "src/utils/v8dll-main.cc" ]
public_deps = [
":v8_lib",
"src/inspector:inspector",
]
configs = []
public_configs = [ ":external_config" ]
}
v8_component("v8_lib") {
public_deps = [ public_deps = [
":v8_base", ":v8_base",
":v8_snapshot", ":v8_snapshot",
...@@ -5626,7 +5640,16 @@ if (is_component_build) { ...@@ -5626,7 +5640,16 @@ if (is_component_build) {
public_configs = [ ":external_config" ] public_configs = [ ":external_config" ]
} }
} else { } else {
# TODO(v8:11917) Remove this redirect to v8_lib (and rename that to v8), when
# chromium depends on inspector directly.
group("v8") { group("v8") {
public_deps = [
":v8_lib",
"src/inspector:inspector",
]
}
group("v8_lib") {
public_deps = [ public_deps = [
":v8_base", ":v8_base",
":v8_snapshot", ":v8_snapshot",
...@@ -5716,6 +5739,7 @@ v8_executable("d8") { ...@@ -5716,6 +5739,7 @@ v8_executable("d8") {
":v8_libbase", ":v8_libbase",
":v8_libplatform", ":v8_libplatform",
":v8_tracing", ":v8_tracing",
"src/inspector:inspector",
"//build/win:default_exe_manifest", "//build/win:default_exe_manifest",
] ]
......
...@@ -35,7 +35,7 @@ class Domain; ...@@ -35,7 +35,7 @@ class Domain;
} }
} // namespace protocol } // namespace protocol
class V8_EXPORT StringView { class V8_INSPECTOR_EXPORT StringView {
public: public:
StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {} StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {}
...@@ -62,7 +62,7 @@ class V8_EXPORT StringView { ...@@ -62,7 +62,7 @@ class V8_EXPORT StringView {
}; };
}; };
class V8_EXPORT StringBuffer { class V8_INSPECTOR_EXPORT StringBuffer {
public: public:
virtual ~StringBuffer() = default; virtual ~StringBuffer() = default;
virtual StringView string() const = 0; virtual StringView string() const = 0;
...@@ -70,7 +70,7 @@ class V8_EXPORT StringBuffer { ...@@ -70,7 +70,7 @@ class V8_EXPORT StringBuffer {
static std::unique_ptr<StringBuffer> create(StringView); static std::unique_ptr<StringBuffer> create(StringView);
}; };
class V8_EXPORT V8ContextInfo { class V8_INSPECTOR_EXPORT V8ContextInfo {
public: public:
V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId, V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId,
StringView humanReadableName) StringView humanReadableName)
...@@ -98,7 +98,7 @@ class V8_EXPORT V8ContextInfo { ...@@ -98,7 +98,7 @@ class V8_EXPORT V8ContextInfo {
V8ContextInfo& operator=(const V8ContextInfo&) = delete; V8ContextInfo& operator=(const V8ContextInfo&) = delete;
}; };
class V8_EXPORT V8StackTrace { class V8_INSPECTOR_EXPORT V8StackTrace {
public: public:
virtual StringView firstNonEmptySourceURL() const = 0; virtual StringView firstNonEmptySourceURL() const = 0;
virtual bool isEmpty() const = 0; virtual bool isEmpty() const = 0;
...@@ -121,17 +121,17 @@ class V8_EXPORT V8StackTrace { ...@@ -121,17 +121,17 @@ class V8_EXPORT V8StackTrace {
virtual std::unique_ptr<V8StackTrace> clone() = 0; virtual std::unique_ptr<V8StackTrace> clone() = 0;
}; };
class V8_EXPORT V8InspectorSession { class V8_INSPECTOR_EXPORT V8InspectorSession {
public: public:
virtual ~V8InspectorSession() = default; virtual ~V8InspectorSession() = default;
// Cross-context inspectable values (DOM nodes in different worlds, etc.). // Cross-context inspectable values (DOM nodes in different worlds, etc.).
class V8_EXPORT Inspectable { class V8_INSPECTOR_EXPORT Inspectable {
public: public:
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0; virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
virtual ~Inspectable() = default; virtual ~Inspectable() = default;
}; };
class V8_EXPORT CommandLineAPIScope { class V8_INSPECTOR_EXPORT CommandLineAPIScope {
public: public:
virtual ~CommandLineAPIScope() = default; virtual ~CommandLineAPIScope() = default;
}; };
...@@ -173,7 +173,7 @@ class V8_EXPORT V8InspectorSession { ...@@ -173,7 +173,7 @@ class V8_EXPORT V8InspectorSession {
virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0; virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0;
}; };
class V8_EXPORT V8InspectorClient { class V8_INSPECTOR_EXPORT V8InspectorClient {
public: public:
virtual ~V8InspectorClient() = default; virtual ~V8InspectorClient() = default;
...@@ -246,7 +246,7 @@ class V8_EXPORT V8InspectorClient { ...@@ -246,7 +246,7 @@ class V8_EXPORT V8InspectorClient {
// These stack trace ids are intended to be passed between debuggers and be // These stack trace ids are intended to be passed between debuggers and be
// resolved later. This allows to track cross-debugger calls and step between // resolved later. This allows to track cross-debugger calls and step between
// them if a single client connects to multiple debuggers. // them if a single client connects to multiple debuggers.
struct V8_EXPORT V8StackTraceId { struct V8_INSPECTOR_EXPORT V8StackTraceId {
uintptr_t id; uintptr_t id;
std::pair<int64_t, int64_t> debugger_id; std::pair<int64_t, int64_t> debugger_id;
bool should_pause = false; bool should_pause = false;
...@@ -265,7 +265,7 @@ struct V8_EXPORT V8StackTraceId { ...@@ -265,7 +265,7 @@ struct V8_EXPORT V8StackTraceId {
std::unique_ptr<StringBuffer> ToString(); std::unique_ptr<StringBuffer> ToString();
}; };
class V8_EXPORT V8Inspector { class V8_INSPECTOR_EXPORT V8Inspector {
public: public:
static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*); static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*);
virtual ~V8Inspector() = default; virtual ~V8Inspector() = default;
...@@ -307,7 +307,7 @@ class V8_EXPORT V8Inspector { ...@@ -307,7 +307,7 @@ class V8_EXPORT V8Inspector {
v8::Local<v8::Value> value) = 0; v8::Local<v8::Value> value) = 0;
// Connection. // Connection.
class V8_EXPORT Channel { class V8_INSPECTOR_EXPORT Channel {
public: public:
virtual ~Channel() = default; virtual ~Channel() = default;
virtual void sendResponse(int callId, virtual void sendResponse(int callId,
...@@ -325,7 +325,8 @@ class V8_EXPORT V8Inspector { ...@@ -325,7 +325,8 @@ class V8_EXPORT V8Inspector {
virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0; virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
// Performance counters. // Performance counters.
class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> { class V8_INSPECTOR_EXPORT Counters
: public std::enable_shared_from_this<Counters> {
public: public:
explicit Counters(v8::Isolate* isolate); explicit Counters(v8::Isolate* isolate);
~Counters(); ~Counters();
......
...@@ -508,6 +508,37 @@ V8 shared library set USING_V8_SHARED. ...@@ -508,6 +508,37 @@ V8 shared library set USING_V8_SHARED.
#endif // V8_OS_WIN #endif // V8_OS_WIN
#ifdef V8_OS_WIN
// Setup for Windows DLL export/import. When building the V8 DLL the
// BUILDING_V8_INSPECTOR_SHARED needs to be defined. When building a program
// which uses the inspector DLL USING_V8_INSPECTOR_SHARED needs to be defined.
// When either building the V8 static library or building a program which uses
// the inspector static library neither BUILDING_V8_INSPECTOR_SHARED nor
// USING_V8_INSPECTOR_SHARED should be defined.
#ifdef BUILDING_V8_INSPECTOR_SHARED
# define V8_INSPECTOR_EXPORT __declspec(dllexport)
#elif USING_V8_INSPECTOR_SHARED
# define V8_INSPECTOR_EXPORT __declspec(dllimport)
#else
# define V8_INSPECTOR_EXPORT
#endif // BUILDING_V8_INSPECTOR_SHARED
#else // V8_OS_WIN
// Setup for Linux shared library export.
#if V8_HAS_ATTRIBUTE_VISIBILITY
# ifdef BUILDING_V8_INSPECTOR_SHARED
# define V8_INSPECTOR_EXPORT __attribute__ ((visibility("default")))
# else
# define V8_INSPECTOR_EXPORT
# endif
#else
# define V8_INSPECTOR_EXPORT
#endif
#endif // V8_OS_WIN
// clang-format on // clang-format on
#undef V8_HAS_CPP_ATTRIBUTE #undef V8_HAS_CPP_ATTRIBUTE
......
...@@ -35,21 +35,23 @@ class TypeProfile; ...@@ -35,21 +35,23 @@ class TypeProfile;
namespace debug { namespace debug {
void SetContextId(Local<Context> context, int id); V8_EXPORT_PRIVATE void SetContextId(Local<Context> context, int id);
int GetContextId(Local<Context> context); V8_EXPORT_PRIVATE int GetContextId(Local<Context> context);
void SetInspector(Isolate* isolate, v8_inspector::V8Inspector*); V8_EXPORT_PRIVATE void SetInspector(Isolate* isolate,
v8_inspector::V8Inspector* GetInspector(Isolate* isolate); v8_inspector::V8Inspector*);
V8_EXPORT_PRIVATE v8_inspector::V8Inspector* GetInspector(Isolate* isolate);
// Returns the debug name for the function, which is supposed to be used // Returns the debug name for the function, which is supposed to be used
// by the debugger and the developer tools. This can thus be different from // by the debugger and the developer tools. This can thus be different from
// the name returned by the StackFrame::GetFunctionName() method. For example, // the name returned by the StackFrame::GetFunctionName() method. For example,
// in case of WebAssembly, the debug name is WAT-compatible and thus always // in case of WebAssembly, the debug name is WAT-compatible and thus always
// preceeded by a dollar ('$'). // preceeded by a dollar ('$').
Local<String> GetFunctionDebugName(Local<StackFrame> frame); V8_EXPORT_PRIVATE Local<String> GetFunctionDebugName(Local<StackFrame> frame);
// Returns a debug string representation of the function. // Returns a debug string representation of the function.
Local<String> GetFunctionDescription(Local<Function> function); V8_EXPORT_PRIVATE Local<String> GetFunctionDescription(
Local<Function> function);
// Schedule a debugger break to happen when function is called inside given // Schedule a debugger break to happen when function is called inside given
// isolate. // isolate.
...@@ -64,7 +66,8 @@ V8_EXPORT_PRIVATE void ClearBreakOnNextFunctionCall(Isolate* isolate); ...@@ -64,7 +66,8 @@ V8_EXPORT_PRIVATE void ClearBreakOnNextFunctionCall(Isolate* isolate);
* the following format: [<name>, <value>,...,<name>, <value>]. Result array * the following format: [<name>, <value>,...,<name>, <value>]. Result array
* will be allocated in the current context. * will be allocated in the current context.
*/ */
MaybeLocal<Array> GetInternalProperties(Isolate* isolate, Local<Value> value); V8_EXPORT_PRIVATE MaybeLocal<Array> GetInternalProperties(Isolate* isolate,
Local<Value> value);
/** /**
* Returns through the out parameters names_out a vector of names * Returns through the out parameters names_out a vector of names
...@@ -86,7 +89,7 @@ V8_EXPORT_PRIVATE bool GetPrivateMembers(Local<Context> context, ...@@ -86,7 +89,7 @@ V8_EXPORT_PRIVATE bool GetPrivateMembers(Local<Context> context,
* Forwards to v8::Object::CreationContext, but with special handling for * Forwards to v8::Object::CreationContext, but with special handling for
* JSGlobalProxy objects. * JSGlobalProxy objects.
*/ */
MaybeLocal<Context> GetCreationContext(Local<Object> value); V8_EXPORT_PRIVATE MaybeLocal<Context> GetCreationContext(Local<Object> value);
enum ExceptionBreakState { enum ExceptionBreakState {
NoBreakOnException = 0, NoBreakOnException = 0,
...@@ -100,10 +103,11 @@ enum ExceptionBreakState { ...@@ -100,10 +103,11 @@ enum ExceptionBreakState {
* exception, if BreakOnUncaughtException is set then VM will pause only on * exception, if BreakOnUncaughtException is set then VM will pause only on
* uncaught exception, otherwise VM won't stop on any exception. * uncaught exception, otherwise VM won't stop on any exception.
*/ */
void ChangeBreakOnException(Isolate* isolate, ExceptionBreakState state); V8_EXPORT_PRIVATE void ChangeBreakOnException(Isolate* isolate,
ExceptionBreakState state);
void RemoveBreakpoint(Isolate* isolate, BreakpointId id); V8_EXPORT_PRIVATE void RemoveBreakpoint(Isolate* isolate, BreakpointId id);
void SetBreakPointsActive(Isolate* isolate, bool is_active); V8_EXPORT_PRIVATE void SetBreakPointsActive(Isolate* isolate, bool is_active);
enum StepAction { enum StepAction {
StepOut = 0, // Step out of the current function. StepOut = 0, // Step out of the current function.
...@@ -112,8 +116,8 @@ enum StepAction { ...@@ -112,8 +116,8 @@ enum StepAction {
// in the current function. // in the current function.
}; };
void PrepareStep(Isolate* isolate, StepAction action); V8_EXPORT_PRIVATE void PrepareStep(Isolate* isolate, StepAction action);
void ClearStepping(Isolate* isolate); V8_EXPORT_PRIVATE void ClearStepping(Isolate* isolate);
V8_EXPORT_PRIVATE void BreakRightNow(Isolate* isolate); V8_EXPORT_PRIVATE void BreakRightNow(Isolate* isolate);
// Use `SetTerminateOnResume` to indicate that an TerminateExecution interrupt // Use `SetTerminateOnResume` to indicate that an TerminateExecution interrupt
...@@ -123,7 +127,7 @@ V8_EXPORT_PRIVATE void BreakRightNow(Isolate* isolate); ...@@ -123,7 +127,7 @@ V8_EXPORT_PRIVATE void BreakRightNow(Isolate* isolate);
// the isolate to be entered for further JavaScript execution. // the isolate to be entered for further JavaScript execution.
V8_EXPORT_PRIVATE void SetTerminateOnResume(Isolate* isolate); V8_EXPORT_PRIVATE void SetTerminateOnResume(Isolate* isolate);
bool CanBreakProgram(Isolate* isolate); V8_EXPORT_PRIVATE bool CanBreakProgram(Isolate* isolate);
class Script; class Script;
...@@ -183,7 +187,7 @@ class V8_EXPORT_PRIVATE Script { ...@@ -183,7 +187,7 @@ class V8_EXPORT_PRIVATE Script {
#if V8_ENABLE_WEBASSEMBLY #if V8_ENABLE_WEBASSEMBLY
// Specialization for wasm Scripts. // Specialization for wasm Scripts.
class WasmScript : public Script { class V8_EXPORT_PRIVATE WasmScript : public Script {
public: public:
static WasmScript* Cast(Script* script); static WasmScript* Cast(Script* script);
...@@ -207,8 +211,8 @@ class WasmScript : public Script { ...@@ -207,8 +211,8 @@ class WasmScript : public Script {
V8_EXPORT_PRIVATE void GetLoadedScripts(Isolate* isolate, V8_EXPORT_PRIVATE void GetLoadedScripts(Isolate* isolate,
PersistentValueVector<Script>& scripts); PersistentValueVector<Script>& scripts);
MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* isolate, V8_EXPORT_PRIVATE MaybeLocal<UnboundScript> CompileInspectorScript(
Local<String> source); Isolate* isolate, Local<String> source);
enum ExceptionType { kException, kPromiseRejection }; enum ExceptionType { kException, kPromiseRejection };
...@@ -252,16 +256,18 @@ class AsyncEventDelegate { ...@@ -252,16 +256,18 @@ class AsyncEventDelegate {
bool is_blackboxed) = 0; bool is_blackboxed) = 0;
}; };
void SetAsyncEventDelegate(Isolate* isolate, AsyncEventDelegate* delegate); V8_EXPORT_PRIVATE void SetAsyncEventDelegate(Isolate* isolate,
AsyncEventDelegate* delegate);
void ResetBlackboxedStateCache(Isolate* isolate, V8_EXPORT_PRIVATE void ResetBlackboxedStateCache(
v8::Local<debug::Script> script); Isolate* isolate, v8::Local<debug::Script> script);
int EstimatedValueSize(Isolate* isolate, v8::Local<v8::Value> value); V8_EXPORT_PRIVATE int EstimatedValueSize(Isolate* isolate,
v8::Local<v8::Value> value);
enum Builtin { kStringToLowerCase }; enum Builtin { kStringToLowerCase };
Local<Function> GetBuiltin(Isolate* isolate, Builtin builtin); V8_EXPORT_PRIVATE Local<Function> GetBuiltin(Isolate* isolate, Builtin builtin);
V8_EXPORT_PRIVATE void SetConsoleDelegate(Isolate* isolate, V8_EXPORT_PRIVATE void SetConsoleDelegate(Isolate* isolate,
ConsoleDelegate* delegate); ConsoleDelegate* delegate);
...@@ -269,13 +275,13 @@ V8_EXPORT_PRIVATE void SetConsoleDelegate(Isolate* isolate, ...@@ -269,13 +275,13 @@ V8_EXPORT_PRIVATE void SetConsoleDelegate(Isolate* isolate,
V8_DEPRECATED("See http://crbug.com/v8/10566.") V8_DEPRECATED("See http://crbug.com/v8/10566.")
int GetStackFrameId(v8::Local<v8::StackFrame> frame); int GetStackFrameId(v8::Local<v8::StackFrame> frame);
v8::Local<v8::StackTrace> GetDetailedStackTrace(Isolate* isolate, V8_EXPORT_PRIVATE v8::Local<v8::StackTrace> GetDetailedStackTrace(
v8::Local<v8::Object> error); Isolate* isolate, v8::Local<v8::Object> error);
/** /**
* Native wrapper around v8::internal::JSGeneratorObject object. * Native wrapper around v8::internal::JSGeneratorObject object.
*/ */
class GeneratorObject { class V8_EXPORT_PRIVATE GeneratorObject {
public: public:
v8::MaybeLocal<debug::Script> Script(); v8::MaybeLocal<debug::Script> Script();
v8::Local<v8::Function> Function(); v8::Local<v8::Function> Function();
...@@ -498,14 +504,16 @@ class QueryObjectPredicate { ...@@ -498,14 +504,16 @@ class QueryObjectPredicate {
virtual bool Filter(v8::Local<v8::Object> object) = 0; virtual bool Filter(v8::Local<v8::Object> object) = 0;
}; };
void QueryObjects(v8::Local<v8::Context> context, V8_EXPORT_PRIVATE void QueryObjects(
QueryObjectPredicate* predicate, v8::Local<v8::Context> context, QueryObjectPredicate* predicate,
v8::PersistentValueVector<v8::Object>* objects); v8::PersistentValueVector<v8::Object>* objects);
void GlobalLexicalScopeNames(v8::Local<v8::Context> context, V8_EXPORT_PRIVATE void GlobalLexicalScopeNames(
v8::PersistentValueVector<v8::String>* names); v8::Local<v8::Context> context,
v8::PersistentValueVector<v8::String>* names);
void SetReturnValue(v8::Isolate* isolate, v8::Local<v8::Value> value); V8_EXPORT_PRIVATE void SetReturnValue(v8::Isolate* isolate,
v8::Local<v8::Value> value);
enum class NativeAccessorType { enum class NativeAccessorType {
None = 0, None = 0,
...@@ -513,12 +521,12 @@ enum class NativeAccessorType { ...@@ -513,12 +521,12 @@ enum class NativeAccessorType {
HasSetter = 1 << 1 HasSetter = 1 << 1
}; };
int64_t GetNextRandomInt64(v8::Isolate* isolate); V8_EXPORT_PRIVATE int64_t GetNextRandomInt64(v8::Isolate* isolate);
using RuntimeCallCounterCallback = using RuntimeCallCounterCallback =
std::function<void(const char* name, int64_t count, base::TimeDelta time)>; std::function<void(const char* name, int64_t count, base::TimeDelta time)>;
void EnumerateRuntimeCallCounters(v8::Isolate* isolate, V8_EXPORT_PRIVATE void EnumerateRuntimeCallCounters(
RuntimeCallCounterCallback callback); v8::Isolate* isolate, RuntimeCallCounterCallback callback);
enum class EvaluateGlobalMode { enum class EvaluateGlobalMode {
kDefault, kDefault,
...@@ -534,14 +542,15 @@ V8_EXPORT_PRIVATE v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting( ...@@ -534,14 +542,15 @@ V8_EXPORT_PRIVATE v8::MaybeLocal<v8::Value> EvaluateGlobalForTesting(
v8::Isolate* isolate, v8::Local<v8::Script> function, v8::Isolate* isolate, v8::Local<v8::Script> function,
v8::debug::EvaluateGlobalMode mode, bool repl); v8::debug::EvaluateGlobalMode mode, bool repl);
int GetDebuggingId(v8::Local<v8::Function> function); V8_EXPORT_PRIVATE int GetDebuggingId(v8::Local<v8::Function> function);
bool SetFunctionBreakpoint(v8::Local<v8::Function> function, V8_EXPORT_PRIVATE bool SetFunctionBreakpoint(v8::Local<v8::Function> function,
v8::Local<v8::String> condition, BreakpointId* id); v8::Local<v8::String> condition,
BreakpointId* id);
v8::Platform* GetCurrentPlatform(); V8_EXPORT_PRIVATE v8::Platform* GetCurrentPlatform();
void ForceGarbageCollection( V8_EXPORT_PRIVATE void ForceGarbageCollection(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::EmbedderHeapTracer::EmbedderStackState embedder_stack_state); v8::EmbedderHeapTracer::EmbedderStackState embedder_stack_state);
...@@ -554,7 +563,7 @@ class V8_NODISCARD PostponeInterruptsScope { ...@@ -554,7 +563,7 @@ class V8_NODISCARD PostponeInterruptsScope {
std::unique_ptr<i::PostponeInterruptsScope> scope_; std::unique_ptr<i::PostponeInterruptsScope> scope_;
}; };
class V8_NODISCARD DisableBreakScope { class V8_EXPORT_PRIVATE V8_NODISCARD DisableBreakScope {
public: public:
explicit DisableBreakScope(v8::Isolate* isolate); explicit DisableBreakScope(v8::Isolate* isolate);
~DisableBreakScope(); ~DisableBreakScope();
...@@ -609,7 +618,7 @@ struct PropertyDescriptor { ...@@ -609,7 +618,7 @@ struct PropertyDescriptor {
v8::Local<v8::Value> set; v8::Local<v8::Value> set;
}; };
class PropertyIterator { class V8_EXPORT_PRIVATE PropertyIterator {
public: public:
// Creating a PropertyIterator can potentially throw an exception. // Creating a PropertyIterator can potentially throw an exception.
// The returned std::unique_ptr is empty iff that happens. // The returned std::unique_ptr is empty iff that happens.
...@@ -661,7 +670,8 @@ AccessorPair* AccessorPair::Cast(v8::Value* value) { ...@@ -661,7 +670,8 @@ AccessorPair* AccessorPair::Cast(v8::Value* value) {
return static_cast<AccessorPair*>(value); return static_cast<AccessorPair*>(value);
} }
MaybeLocal<Message> GetMessageFromPromise(Local<Promise> promise); V8_EXPORT_PRIVATE MaybeLocal<Message> GetMessageFromPromise(
Local<Promise> promise);
} // namespace debug } // namespace debug
} // namespace v8 } // namespace v8
......
...@@ -94,7 +94,8 @@ class V8_EXPORT_PRIVATE BreakLocation : public Location { ...@@ -94,7 +94,8 @@ class V8_EXPORT_PRIVATE BreakLocation : public Location {
BreakLocationType type_; BreakLocationType type_;
}; };
class ConsoleCallArguments : private v8::FunctionCallbackInfo<v8::Value> { class V8_EXPORT_PRIVATE ConsoleCallArguments
: private v8::FunctionCallbackInfo<v8::Value> {
public: public:
int Length() const { return v8::FunctionCallbackInfo<v8::Value>::Length(); } int Length() const { return v8::FunctionCallbackInfo<v8::Value>::Length(); }
V8_INLINE Local<Value> operator[](int i) const { V8_INLINE Local<Value> operator[](int i) const {
......
...@@ -55,19 +55,18 @@ inspector_protocol_generate("protocol_generated_sources") { ...@@ -55,19 +55,18 @@ inspector_protocol_generate("protocol_generated_sources") {
outputs = _protocol_generated outputs = _protocol_generated
} }
config("inspector_config") { config("external_config") {
visibility = [ ":*" ] # Only targets in this file can depend on this. if (is_component_build) {
defines = [ "USING_V8_INSPECTOR_SHARED" ]
configs = [ "../../:internal_config" ] }
include_dirs = [ "../../include" ]
} }
v8_header_set("inspector_test_headers") { config("internal_config") {
configs = [ ":inspector_config" ] visibility = [ ":*" ]
configs = [ "../../:internal_config_base" ]
public_deps = [ "../..:v8_headers" ] if (is_component_build) {
defines = [ "BUILDING_V8_INSPECTOR_SHARED" ]
sources = [ "test-interface.h" ] }
} }
v8_source_set("inspector_string_conversions") { v8_source_set("inspector_string_conversions") {
...@@ -79,7 +78,7 @@ v8_source_set("inspector_string_conversions") { ...@@ -79,7 +78,7 @@ v8_source_set("inspector_string_conversions") {
deps = [ "../..:v8_libbase" ] deps = [ "../..:v8_libbase" ]
} }
v8_source_set("inspector") { v8_component("inspector") {
deps = [ deps = [
":inspector_string_conversions", ":inspector_string_conversions",
"../..:v8_tracing", "../..:v8_tracing",
...@@ -88,12 +87,14 @@ v8_source_set("inspector") { ...@@ -88,12 +87,14 @@ v8_source_set("inspector") {
] ]
public_deps = [ public_deps = [
":inspector_test_headers",
":protocol_generated_sources", ":protocol_generated_sources",
"../../:v8_lib",
"../../:v8_libbase", "../../:v8_libbase",
] ]
configs = [ ":inspector_config" ] configs = [ ":internal_config" ]
public_configs = [ ":external_config" ]
sources = rebase_path(_protocol_generated, ".", target_gen_dir) sources = rebase_path(_protocol_generated, ".", target_gen_dir)
sources += [ sources += [
...@@ -116,6 +117,7 @@ v8_source_set("inspector") { ...@@ -116,6 +117,7 @@ v8_source_set("inspector") {
"string-util.cc", "string-util.cc",
"string-util.h", "string-util.h",
"test-interface.cc", "test-interface.cc",
"test-interface.h",
"v8-console-agent-impl.cc", "v8-console-agent-impl.cc",
"v8-console-agent-impl.h", "v8-console-agent-impl.h",
"v8-console-message.cc", "v8-console-message.cc",
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
"string_in": "StringView", "string_in": "StringView",
"string_out": "std::unique_ptr<StringBuffer>", "string_out": "std::unique_ptr<StringBuffer>",
"to_string_out": "StringBufferFrom(std::move(%s))", "to_string_out": "StringBufferFrom(std::move(%s))",
"export_macro": "V8_EXPORT" "export_macro": "V8_INSPECTOR_EXPORT"
}, },
"lib": { "lib": {
......
...@@ -27,8 +27,8 @@ class String16 { ...@@ -27,8 +27,8 @@ class String16 {
String16(const String16&) V8_NOEXCEPT = default; String16(const String16&) V8_NOEXCEPT = default;
String16(String16&&) V8_NOEXCEPT = default; String16(String16&&) V8_NOEXCEPT = default;
String16(const UChar* characters, size_t size); String16(const UChar* characters, size_t size);
V8_EXPORT String16(const UChar* characters); V8_INSPECTOR_EXPORT String16(const UChar* characters);
V8_EXPORT String16(const char* characters); V8_INSPECTOR_EXPORT String16(const char* characters);
String16(const char* characters, size_t size); String16(const char* characters, size_t size);
explicit String16(const std::basic_string<UChar>& impl); explicit String16(const std::basic_string<UChar>& impl);
explicit String16(std::basic_string<UChar>&& impl); explicit String16(std::basic_string<UChar>&& impl);
...@@ -70,13 +70,14 @@ class String16 { ...@@ -70,13 +70,14 @@ class String16 {
} }
// Convenience methods. // Convenience methods.
V8_EXPORT std::string utf8() const; V8_INSPECTOR_EXPORT std::string utf8() const;
V8_EXPORT static String16 fromUTF8(const char* stringStart, size_t length); V8_INSPECTOR_EXPORT static String16 fromUTF8(const char* stringStart,
size_t length);
// Instantiates a String16 in native endianness from UTF16 LE. // Instantiates a String16 in native endianness from UTF16 LE.
// On Big endian architectures, byte order needs to be flipped. // On Big endian architectures, byte order needs to be flipped.
V8_EXPORT static String16 fromUTF16LE(const UChar* stringStart, V8_INSPECTOR_EXPORT static String16 fromUTF16LE(const UChar* stringStart,
size_t length); size_t length);
std::size_t hash() const { std::size_t hash() const {
if (!hash_code) { if (!hash_code) {
......
...@@ -42,7 +42,7 @@ class StringUtil { ...@@ -42,7 +42,7 @@ class StringUtil {
}; };
// A read-only sequence of uninterpreted bytes with reference-counted storage. // A read-only sequence of uninterpreted bytes with reference-counted storage.
class V8_EXPORT Binary { class V8_INSPECTOR_EXPORT Binary {
public: public:
Binary() = default; Binary() = default;
......
...@@ -11,8 +11,10 @@ namespace v8_inspector { ...@@ -11,8 +11,10 @@ namespace v8_inspector {
class V8Inspector; class V8Inspector;
V8_EXPORT void SetMaxAsyncTaskStacksForTest(V8Inspector* inspector, int limit); V8_INSPECTOR_EXPORT void SetMaxAsyncTaskStacksForTest(V8Inspector* inspector,
V8_EXPORT void DumpAsyncTaskStacksStateForTest(V8Inspector* inspector); int limit);
V8_INSPECTOR_EXPORT void DumpAsyncTaskStacksStateForTest(
V8Inspector* inspector);
} // namespace v8_inspector } // namespace v8_inspector
......
...@@ -127,7 +127,7 @@ V8_EXPORT_PRIVATE const char* IntToCString(int n, base::Vector<char> buffer); ...@@ -127,7 +127,7 @@ V8_EXPORT_PRIVATE const char* IntToCString(int n, base::Vector<char> buffer);
// The caller is responsible for calling free on the returned pointer. // The caller is responsible for calling free on the returned pointer.
char* DoubleToFixedCString(double value, int f); char* DoubleToFixedCString(double value, int f);
char* DoubleToExponentialCString(double value, int f); char* DoubleToExponentialCString(double value, int f);
char* DoubleToPrecisionCString(double value, int f); V8_EXPORT_PRIVATE char* DoubleToPrecisionCString(double value, int f);
char* DoubleToRadixCString(double value, int radix); char* DoubleToRadixCString(double value, int radix);
static inline bool IsMinusZero(double value) { static inline bool IsMinusZero(double value) {
......
...@@ -61,6 +61,7 @@ v8_header_set("cctest_headers") { ...@@ -61,6 +61,7 @@ v8_header_set("cctest_headers") {
"../..:v8_internal_headers", "../..:v8_internal_headers",
"../..:v8_libbase", "../..:v8_libbase",
"../..:v8_libplatform", "../..:v8_libplatform",
"../../src/inspector:inspector",
] ]
sources = [ "cctest.h" ] sources = [ "cctest.h" ]
...@@ -469,6 +470,7 @@ v8_source_set("cctest_sources") { ...@@ -469,6 +470,7 @@ v8_source_set("cctest_sources") {
deps = [ deps = [
"../..:run_torque", "../..:run_torque",
"../..:v8_shared_internal_headers", "../..:v8_shared_internal_headers",
"../../src/inspector:inspector",
] ]
if (v8_enable_i18n_support) { if (v8_enable_i18n_support) {
......
...@@ -23,7 +23,7 @@ v8_source_set("inspector_test") { ...@@ -23,7 +23,7 @@ v8_source_set("inspector_test") {
"../..:v8", "../..:v8",
"../..:v8_libbase", "../..:v8_libbase",
"../..:v8_libplatform", "../..:v8_libplatform",
"../../src/inspector:inspector_test_headers", "../../src/inspector:inspector",
] ]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment