From ac3471ca232aa3373516055f4380a9196115c93e Mon Sep 17 00:00:00 2001 From: Eugene Ostroukhov Date: Tue, 23 Aug 2016 06:00:35 -0700 Subject: [PATCH] deps: v8_inspector update Pick up latest from [1] corresponding to the Blink commit 60cd6e859b. [1]: https://github.com/pavelfeldman/v8_inspector/commit/55f21a5611 PR-URL: https://github.com/nodejs/node/pull/8150 Reviewed-By: bnoordhuis - Ben Noordhuis --- .../v8_inspector/platform/PlatformExport.h | 66 +++ .../{Allocator.h => Allocator_h.template} | 0 .../{Array.h => Array_h.template} | 12 +- ...dCallback.h => BackendCallback_h.template} | 7 +- .../inspector_protocol/CodeGenerator.py | 387 ++++++++++-------- .../{Collections.h => Collections_h.template} | 0 ...erBase.cpp => DispatcherBase_cpp.template} | 7 +- ...atcherBase.h => DispatcherBase_h.template} | 21 +- ...rSupport.cpp => ErrorSupport_cpp.template} | 4 - ...ErrorSupport.h => ErrorSupport_h.template} | 7 +- .../inspector_protocol/Exported_h.template | 14 +- ...ndChannel.h => FrontendChannel_h.template} | 5 +- .../inspector_protocol/Imported_h.template | 6 +- .../InspectorProtocol_cpp.template | 5 + .../{Maybe.h => Maybe_h.template} | 12 +- .../{Object.cpp => Object_cpp.template} | 2 - .../{Object.h => Object_h.template} | 9 +- .../inspector_protocol/ParserTest.cpp | 5 +- .../{Parser.cpp => Parser_cpp.template} | 7 +- .../{Parser.h => Parser_h.template} | 7 +- .../{Platform.h => Platform_h.template} | 6 +- .../platform/inspector_protocol/String16.h | 14 - .../platform/inspector_protocol/String16STL.h | 263 ------------ .../inspector_protocol/String16WTF.cpp | 47 --- .../platform/inspector_protocol/String16WTF.h | 154 ------- .../inspector_protocol/String16_cpp.template | 99 +++++ .../inspector_protocol/String16_h.template | 181 ++++++++ .../TypeBuilder_cpp.template | 8 +- .../inspector_protocol/TypeBuilder_h.template | 43 +- ...versions.h => ValueConversions_h.template} | 14 +- .../{Values.cpp => Values_cpp.template} | 24 +- .../{Values.h => Values_h.template} | 21 +- .../generate-inspector-protocol-version | 15 +- .../inspector_protocol/sample_config.json | 34 ++ .../platform/v8_inspector/Atomics.h | 4 +- .../platform/v8_inspector/DebuggerScript.js | 16 +- .../platform/v8_inspector/InjectedScript.cpp | 54 +-- .../platform/v8_inspector/InjectedScript.h | 17 +- .../v8_inspector/InjectedScriptNative.cpp | 6 +- .../v8_inspector/InjectedScriptNative.h | 10 +- .../v8_inspector/InjectedScriptSource.js | 2 +- .../v8_inspector/InspectedContext.cpp | 4 +- .../platform/v8_inspector/InspectedContext.h | 10 +- .../v8_inspector/JavaScriptCallFrame.cpp | 4 +- .../v8_inspector/JavaScriptCallFrame.h | 10 +- .../PlatformSTL.h | 31 +- .../PlatformWTF.h | 0 .../platform/v8_inspector/RemoteObjectId.cpp | 8 +- .../platform/v8_inspector/RemoteObjectId.h | 12 +- .../platform/v8_inspector/ScriptBreakpoint.h | 9 +- .../String16STL.cpp | 189 +-------- .../platform/v8_inspector/String16STL.h | 104 +++++ .../platform/v8_inspector/String16WTF.h | 111 +++++ .../platform/v8_inspector/V8Console.cpp | 15 +- .../platform/v8_inspector/V8Console.h | 8 +- .../v8_inspector/V8ConsoleAgentImpl.cpp | 4 +- .../v8_inspector/V8ConsoleAgentImpl.h | 9 +- .../v8_inspector/V8ConsoleMessage.cpp | 36 +- .../platform/v8_inspector/V8ConsoleMessage.h | 9 +- .../platform/v8_inspector/V8Debugger.cpp | 73 ++-- .../platform/v8_inspector/V8Debugger.h | 18 +- .../v8_inspector/V8DebuggerAgentImpl.cpp | 67 +-- .../v8_inspector/V8DebuggerAgentImpl.h | 29 +- .../v8_inspector/V8DebuggerScript.cpp | 19 +- .../platform/v8_inspector/V8DebuggerScript.h | 11 +- .../platform/v8_inspector/V8FunctionCall.cpp | 5 +- .../platform/v8_inspector/V8FunctionCall.h | 8 +- .../v8_inspector/V8HeapProfilerAgentImpl.cpp | 8 +- .../v8_inspector/V8HeapProfilerAgentImpl.h | 10 +- .../v8_inspector/V8InjectedScriptHost.cpp | 7 +- .../v8_inspector/V8InjectedScriptHost.h | 7 +- .../platform/v8_inspector/V8InspectorImpl.cpp | 8 +- .../platform/v8_inspector/V8InspectorImpl.h | 11 +- .../v8_inspector/V8InspectorSessionImpl.cpp | 41 +- .../v8_inspector/V8InspectorSessionImpl.h | 17 +- .../v8_inspector/V8InternalValueType.cpp | 5 +- .../v8_inspector/V8InternalValueType.h | 5 +- .../v8_inspector/V8ProfilerAgentImpl.cpp | 81 ++-- .../v8_inspector/V8ProfilerAgentImpl.h | 9 +- .../platform/v8_inspector/V8Regex.cpp | 4 +- .../platform/v8_inspector/V8Regex.h | 7 +- .../v8_inspector/V8RuntimeAgentImpl.cpp | 61 ++- .../v8_inspector/V8RuntimeAgentImpl.h | 22 +- .../v8_inspector/V8SchemaAgentImpl.cpp | 29 ++ .../platform/v8_inspector/V8SchemaAgentImpl.h | 33 ++ .../v8_inspector/V8StackTraceImpl.cpp | 10 +- .../platform/v8_inspector/V8StackTraceImpl.h | 9 +- .../platform/v8_inspector/V8StringUtil.cpp | 47 +-- .../platform/v8_inspector/V8StringUtil.h | 13 +- .../platform/v8_inspector/V8ValueCopier.cpp | 90 ++++ .../platform/v8_inspector/V8ValueCopier.h | 16 + .../v8_inspector/debugger_script_externs.js | 3 +- .../inspector_protocol_config.json | 29 ++ .../inspector_protocol_config_stl.json | 29 ++ .../platform/v8_inspector/js_protocol.json | 132 +++--- .../v8_inspector/public/InspectorVersion.h | 2 +- .../v8_inspector/public/V8ContextInfo.h | 6 +- .../v8_inspector/public/V8Inspector.h | 13 +- .../v8_inspector/public/V8InspectorClient.h | 9 +- .../v8_inspector/public/V8InspectorSession.h | 13 +- .../v8_inspector/public/V8StackTrace.h | 9 +- .../platform/v8_inspector/v8_inspector.gyp | 237 +++++++---- 102 files changed, 1852 insertions(+), 1598 deletions(-) create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/PlatformExport.h rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Allocator.h => Allocator_h.template} (100%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Array.h => Array_h.template} (91%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{BackendCallback.h => BackendCallback_h.template} (75%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Collections.h => Collections_h.template} (100%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{DispatcherBase.cpp => DispatcherBase_cpp.template} (96%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{DispatcherBase.h => DispatcherBase_h.template} (83%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{ErrorSupport.cpp => ErrorSupport_cpp.template} (93%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{ErrorSupport.h => ErrorSupport_h.template} (84%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{FrontendChannel.h => FrontendChannel_h.template} (83%) create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/InspectorProtocol_cpp.template rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Maybe.h => Maybe_h.template} (89%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Object.cpp => Object_cpp.template} (95%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Object.h => Object_h.template} (78%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Parser.cpp => Parser_cpp.template} (98%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Parser.h => Parser_h.template} (65%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Platform.h => Platform_h.template} (61%) delete mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16.h delete mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.h delete mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.cpp delete mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.h create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_cpp.template create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_h.template rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{ValueConversions.h => ValueConversions_h.template} (92%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Values.cpp => Values_cpp.template} (94%) rename deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/{Values.h => Values_h.template} (92%) create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/sample_config.json rename deps/v8_inspector/third_party/v8_inspector/platform/{inspector_protocol => v8_inspector}/PlatformSTL.h (90%) rename deps/v8_inspector/third_party/v8_inspector/platform/{inspector_protocol => v8_inspector}/PlatformWTF.h (100%) rename deps/v8_inspector/third_party/v8_inspector/platform/{inspector_protocol => v8_inspector}/String16STL.cpp (69%) create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.h create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16WTF.h create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.cpp create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.h create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.cpp create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.h create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config.json create mode 100644 deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config_stl.json diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/PlatformExport.h b/deps/v8_inspector/third_party/v8_inspector/platform/PlatformExport.h new file mode 100644 index 00000000000000..8230fbb80fe30d --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/PlatformExport.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2013 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#ifndef PlatformExport_h +#define PlatformExport_h + +#if !defined(BLINK_PLATFORM_IMPLEMENTATION) +#define BLINK_PLATFORM_IMPLEMENTATION 0 +#endif + +#if defined(COMPONENT_BUILD) +#if defined(WIN32) +#if BLINK_PLATFORM_IMPLEMENTATION +#define PLATFORM_EXPORT __declspec(dllexport) +#else +#define PLATFORM_EXPORT __declspec(dllimport) +#endif +#else // defined(WIN32) +#define PLATFORM_EXPORT __attribute__((visibility("default"))) +#endif +#else // defined(COMPONENT_BUILD) +#define PLATFORM_EXPORT +#endif + +#if defined(_MSC_VER) +// MSVC Compiler warning C4275: +// non dll-interface class 'Bar' used as base for dll-interface class 'Foo'. +// Note that this is intended to be used only when no access to the base class' +// static data is done through derived classes or inline methods. For more info, +// see http://msdn.microsoft.com/en-us/library/3tdb471s(VS.80).aspx +// +// This pragma will allow exporting a class that inherits from a non-exported +// base class, anywhere in the Blink platform component. This is only +// a problem when using the MSVC compiler on Windows. +#pragma warning(suppress:4275) +#endif + +#endif // PlatformExport_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Allocator.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Allocator_h.template similarity index 100% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Allocator.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Allocator_h.template diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Array.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Array_h.template similarity index 91% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Array.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Array_h.template index 720182258b9533..40abb2d467c161 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Array.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Array_h.template @@ -5,11 +5,11 @@ #ifndef Array_h #define Array_h -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/ValueConversions.h" -#include "platform/inspector_protocol/Values.h" +//#include "ErrorSupport.h" +//#include "Platform.h" +//#include "String16.h" +//#include "ValueConversions.h" +//#include "Values.h" #include @@ -126,7 +126,7 @@ class ArrayBase { std::vector m_vector; }; -template<> class Array : public ArrayBase {}; +template<> class Array : public ArrayBase {}; template<> class Array : public ArrayBase {}; template<> class Array : public ArrayBase {}; template<> class Array : public ArrayBase {}; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/BackendCallback.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/BackendCallback_h.template similarity index 75% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/BackendCallback.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/BackendCallback_h.template index 870fbb5555ba9b..0eb44bf2fcfb67 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/BackendCallback.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/BackendCallback_h.template @@ -5,13 +5,14 @@ #ifndef BackendCallback_h #define BackendCallback_h -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/Platform.h" +//#include "ErrorSupport.h" +//#include "Platform.h" +#include "{{config.class_export.header}}" namespace blink { namespace protocol { -class PLATFORM_EXPORT BackendCallback { +class {{config.class_export.macro}} BackendCallback { public: virtual ~BackendCallback() { } virtual void sendFailure(const ErrorString&) = 0; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/CodeGenerator.py b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/CodeGenerator.py index 0b09c8e90401dd..985236821316c6 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/CodeGenerator.py +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/CodeGenerator.py @@ -5,6 +5,8 @@ import os.path import sys import optparse +import collections +import functools try: import json except ImportError: @@ -47,84 +49,52 @@ import jinja2 -cmdline_parser = optparse.OptionParser() -cmdline_parser.add_option("--protocol") -cmdline_parser.add_option("--include") -cmdline_parser.add_option("--include_package") -cmdline_parser.add_option("--string_type") -cmdline_parser.add_option("--export_macro") -cmdline_parser.add_option("--output_dir") -cmdline_parser.add_option("--output_package") -cmdline_parser.add_option("--exported_dir") -cmdline_parser.add_option("--exported_package") -try: - arg_options, arg_values = cmdline_parser.parse_args() - protocol_file = arg_options.protocol - if not protocol_file: - raise Exception("Protocol directory must be specified") - include_file = arg_options.include - include_package = arg_options.include_package - if include_file and not include_package: - raise Exception("Include package must be specified when using include file") - if include_package and not include_file: - raise Exception("Include file must be specified when using include package") - output_dirname = arg_options.output_dir - if not output_dirname: - raise Exception("Output directory must be specified") - output_package = arg_options.output_package - if not output_package: - raise Exception("Output package must be specified") - exported_dirname = arg_options.exported_dir - if not exported_dirname: - exported_dirname = os.path.join(output_dirname, "exported") - exported_package = arg_options.exported_package - if not exported_package: - exported_package = os.path.join(output_package, "exported") - string_type = arg_options.string_type - if not string_type: - raise Exception("String type must be specified") - export_macro = arg_options.export_macro - if not export_macro: - raise Exception("Export macro must be specified") -except Exception: - # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html - exc = sys.exc_info()[1] - sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) - exit(1) - - -input_file = open(protocol_file, "r") -json_string = input_file.read() -parsed_json = json.loads(json_string) - - -# Make gyp / make generatos happy, otherwise make rebuilds world. -def up_to_date(): - template_ts = max( - os.path.getmtime(__file__), - os.path.getmtime(os.path.join(templates_dir, "TypeBuilder_h.template")), - os.path.getmtime(os.path.join(templates_dir, "TypeBuilder_cpp.template")), - os.path.getmtime(os.path.join(templates_dir, "Exported_h.template")), - os.path.getmtime(os.path.join(templates_dir, "Imported_h.template")), - os.path.getmtime(protocol_file)) - - for domain in parsed_json["domains"]: - name = domain["domain"] - paths = [] - if name in generate_domains: - paths = [os.path.join(output_dirname, name + ".h"), os.path.join(output_dirname, name + ".cpp")] - if domain["has_exports"]: - paths.append(os.path.join(exported_dirname, name + ".h")) - if name in include_domains and domain["has_exports"]: - paths = [os.path.join(output_dirname, name + '.h')] - for path in paths: - if not os.path.exists(path): - return False - generated_ts = os.path.getmtime(path) - if generated_ts < template_ts: - return False - return True +def read_config(): + # pylint: disable=W0703 + def json_to_object(data, output_base, config_base): + def json_object_hook(object_dict): + items = [(k, os.path.join(config_base, v) if k == "path" else v) for (k, v) in object_dict.items()] + items = [(k, os.path.join(output_base, v) if k == "output" else v) for (k, v) in items] + keys, values = zip(*items) + return collections.namedtuple('X', keys)(*values) + return json.loads(data, object_hook=json_object_hook) + + try: + cmdline_parser = optparse.OptionParser() + cmdline_parser.add_option("--output_base") + cmdline_parser.add_option("--config") + arg_options, _ = cmdline_parser.parse_args() + output_base = arg_options.output_base + if not output_base: + raise Exception("Base output directory must be specified") + config_file = arg_options.config + if not config_file: + raise Exception("Config file name must be specified") + config_base = os.path.dirname(config_file) + except Exception: + # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html + exc = sys.exc_info()[1] + sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc) + exit(1) + + try: + config_json_file = open(config_file, "r") + config_json_string = config_json_file.read() + config_partial = json_to_object(config_json_string, output_base, config_base) + keys = list(config_partial._fields) # pylint: disable=E1101 + values = [getattr(config_partial, k) for k in keys] + for optional in ["imported", "exported", "lib"]: + if optional not in keys: + keys.append(optional) + values.append(False) + config_json_file.close() + return (config_file, collections.namedtuple('X', keys)(*values)) + except Exception: + # Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html + exc = sys.exc_info()[1] + sys.stderr.write("Failed to parse config file: %s\n\n" % exc) + exit(1) def to_title_case(name): @@ -153,11 +123,7 @@ def initialize_jinja_env(cache_dir): return jinja_env -def output_file(file_name): - return open(file_name, "w") - - -def patch_full_qualified_refs(): +def patch_full_qualified_refs(protocol): def patch_full_qualified_refs_in_domain(json, domain_name): if isinstance(json, list): for item in json: @@ -175,11 +141,11 @@ def patch_full_qualified_refs_in_domain(json, domain_name): json["$ref"] = domain_name + "." + json["$ref"] return - for domain in json_api["domains"]: + for domain in protocol.json_api["domains"]: patch_full_qualified_refs_in_domain(domain, domain["domain"]) -def calculate_exports(): +def calculate_exports(protocol): def calculate_exports_in_json(json_value): has_exports = False if isinstance(json_value, list): @@ -191,13 +157,14 @@ def calculate_exports_in_json(json_value): has_exports = calculate_exports_in_json(json_value[key]) or has_exports return has_exports - json_api["has_exports"] = False - for domain_json in json_api["domains"]: + protocol.json_api["has_exports"] = False + for domain_json in protocol.json_api["domains"]: domain_json["has_exports"] = calculate_exports_in_json(domain_json) - json_api["has_exports"] = json_api["has_exports"] or domain_json["has_exports"] + if domain_json["has_exports"] and domain_json["domain"] in protocol.generate_domains: + protocol.json_api["has_exports"] = True -def create_include_type_definition(domain_name, type): +def create_imported_type_definition(domain_name, type): # pylint: disable=W0622 return { "return_type": "std::unique_ptr" % (domain_name, type["id"]), @@ -257,7 +224,7 @@ def create_any_type_definition(): } -def create_string_type_definition(domain): +def create_string_type_definition(string_type): # pylint: disable=W0622 return { "return_type": string_type, @@ -303,14 +270,6 @@ def create_primitive_type_definition(type): } -type_definitions = {} -type_definitions["number"] = create_primitive_type_definition("number") -type_definitions["integer"] = create_primitive_type_definition("integer") -type_definitions["boolean"] = create_primitive_type_definition("boolean") -type_definitions["object"] = create_object_type_definition() -type_definitions["any"] = create_any_type_definition() - - def wrap_array_definition(type): # pylint: disable=W0622 return { @@ -328,36 +287,42 @@ def wrap_array_definition(type): } -def create_type_definitions(): - for domain in json_api["domains"]: - type_definitions[domain["domain"] + ".string"] = create_string_type_definition(domain["domain"]) +def create_type_definitions(protocol, string_type): + protocol.type_definitions = {} + protocol.type_definitions["number"] = create_primitive_type_definition("number") + protocol.type_definitions["integer"] = create_primitive_type_definition("integer") + protocol.type_definitions["boolean"] = create_primitive_type_definition("boolean") + protocol.type_definitions["object"] = create_object_type_definition() + protocol.type_definitions["any"] = create_any_type_definition() + for domain in protocol.json_api["domains"]: + protocol.type_definitions[domain["domain"] + ".string"] = create_string_type_definition(string_type) if not ("types" in domain): continue for type in domain["types"]: type_name = domain["domain"] + "." + type["id"] - if type["type"] == "object" and domain["domain"] in include_domains: - type_definitions[type_name] = create_include_type_definition(domain["domain"], type) + if type["type"] == "object" and domain["domain"] in protocol.imported_domains: + protocol.type_definitions[type_name] = create_imported_type_definition(domain["domain"], type) elif type["type"] == "object": - type_definitions[type_name] = create_user_type_definition(domain["domain"], type) + protocol.type_definitions[type_name] = create_user_type_definition(domain["domain"], type) elif type["type"] == "array": items_type = type["items"]["type"] - type_definitions[type_name] = wrap_array_definition(type_definitions[items_type]) + protocol.type_definitions[type_name] = wrap_array_definition(protocol.type_definitions[items_type]) elif type["type"] == domain["domain"] + ".string": - type_definitions[type_name] = create_string_type_definition(domain["domain"]) + protocol.type_definitions[type_name] = create_string_type_definition(string_type) else: - type_definitions[type_name] = create_primitive_type_definition(type["type"]) + protocol.type_definitions[type_name] = create_primitive_type_definition(type["type"]) -def type_definition(name): - return type_definitions[name] +def type_definition(protocol, name): + return protocol.type_definitions[name] -def resolve_type(property): - if "$ref" in property: - return type_definitions[property["$ref"]] - if property["type"] == "array": - return wrap_array_definition(resolve_type(property["items"])) - return type_definitions[property["type"]] +def resolve_type(protocol, prop): + if "$ref" in prop: + return protocol.type_definitions[prop["$ref"]] + if prop["type"] == "array": + return wrap_array_definition(resolve_type(protocol, prop["items"])) + return protocol.type_definitions[prop["type"]] def join_arrays(dict, keys): @@ -375,62 +340,146 @@ def has_disable(commands): return False -def generate(domain_object, template, file_name): - template_context = { - "domain": domain_object, - "join_arrays": join_arrays, - "resolve_type": resolve_type, - "type_definition": type_definition, - "has_disable": has_disable, - "export_macro": export_macro, - "output_package": output_package, - "exported_package": exported_package, - "include_package": include_package - } - out_file = output_file(file_name) - out_file.write(template.render(template_context)) - out_file.close() - - -generate_domains = [] -include_domains = [] -json_api = {} -json_api["domains"] = parsed_json["domains"] - -for domain in parsed_json["domains"]: - generate_domains.append(domain["domain"]) - -if include_file: - input_file = open(include_file, "r") +def read_protocol_file(file_name, json_api): + input_file = open(file_name, "r") json_string = input_file.read() + input_file.close() parsed_json = json.loads(json_string) + version = parsed_json["version"]["major"] + "." + parsed_json["version"]["minor"] + domains = [] for domain in parsed_json["domains"]: - include_domains.append(domain["domain"]) + domains.append(domain["domain"]) + domain["version"] = version json_api["domains"] += parsed_json["domains"] - -patch_full_qualified_refs() -calculate_exports() -create_type_definitions() - -if up_to_date(): - sys.exit() -if not os.path.exists(output_dirname): - os.mkdir(output_dirname) -if json_api["has_exports"] and not os.path.exists(exported_dirname): - os.mkdir(exported_dirname) - -jinja_env = initialize_jinja_env(output_dirname) -h_template = jinja_env.get_template("/TypeBuilder_h.template") -cpp_template = jinja_env.get_template("/TypeBuilder_cpp.template") -exported_template = jinja_env.get_template("/Exported_h.template") -imported_template = jinja_env.get_template("/Imported_h.template") - -for domain in json_api["domains"]: - class_name = domain["domain"] - if domain["domain"] in generate_domains: - generate(domain, h_template, output_dirname + "/" + class_name + ".h") - generate(domain, cpp_template, output_dirname + "/" + class_name + ".cpp") - if domain["has_exports"]: - generate(domain, exported_template, exported_dirname + "/" + class_name + ".h") - if domain["domain"] in include_domains and domain["has_exports"]: - generate(domain, imported_template, output_dirname + "/" + class_name + ".h") + return domains + + +class Protocol(object): + def __init__(self): + self.json_api = {} + self.generate_domains = [] + self.imported_domains = [] + + +def main(): + config_file, config = read_config() + + protocol = Protocol() + protocol.json_api = {"domains": []} + protocol.generate_domains = read_protocol_file(config.protocol.path, protocol.json_api) + protocol.imported_domains = read_protocol_file(config.imported.path, protocol.json_api) if config.imported else [] + patch_full_qualified_refs(protocol) + calculate_exports(protocol) + create_type_definitions(protocol, config.string.class_name) + + if not config.exported: + for domain_json in protocol.json_api["domains"]: + if domain_json["has_exports"] and domain_json["domain"] in protocol.generate_domains: + sys.stderr.write("Domain %s is exported, but config is missing export entry\n\n" % domain_json["domain"]) + exit(1) + + if not os.path.exists(config.protocol.output): + os.mkdir(config.protocol.output) + if protocol.json_api["has_exports"] and not os.path.exists(config.exported.output): + os.mkdir(config.exported.output) + jinja_env = initialize_jinja_env(config.protocol.output) + + inputs = [] + inputs.append(__file__) + inputs.append(config_file) + inputs.append(config.protocol.path) + if config.imported: + inputs.append(config.imported.path) + inputs.append(os.path.join(templates_dir, "TypeBuilder_h.template")) + inputs.append(os.path.join(templates_dir, "TypeBuilder_cpp.template")) + inputs.append(os.path.join(templates_dir, "Exported_h.template")) + inputs.append(os.path.join(templates_dir, "Imported_h.template")) + + h_template = jinja_env.get_template("TypeBuilder_h.template") + cpp_template = jinja_env.get_template("TypeBuilder_cpp.template") + exported_template = jinja_env.get_template("Exported_h.template") + imported_template = jinja_env.get_template("Imported_h.template") + + outputs = dict() + + for domain in protocol.json_api["domains"]: + class_name = domain["domain"] + template_context = { + "config": config, + "domain": domain, + "join_arrays": join_arrays, + "resolve_type": functools.partial(resolve_type, protocol), + "type_definition": functools.partial(type_definition, protocol), + "has_disable": has_disable + } + + if domain["domain"] in protocol.generate_domains: + outputs[os.path.join(config.protocol.output, class_name + ".h")] = h_template.render(template_context) + outputs[os.path.join(config.protocol.output, class_name + ".cpp")] = cpp_template.render(template_context) + if domain["has_exports"]: + outputs[os.path.join(config.exported.output, class_name + ".h")] = exported_template.render(template_context) + if domain["domain"] in protocol.imported_domains and domain["has_exports"]: + outputs[os.path.join(config.protocol.output, class_name + ".h")] = imported_template.render(template_context) + + if config.lib: + template_context = { + "config": config + } + + # Note these should be sorted in the right order. + # TODO(dgozman): sort them programmatically based on commented includes. + lib_h_templates = [ + "Allocator_h.template", + "Platform_h.template", + "Collections_h.template", + "String16_h.template", + "ErrorSupport_h.template", + "Values_h.template", + "Object_h.template", + "ValueConversions_h.template", + "Maybe_h.template", + "Array_h.template", + "FrontendChannel_h.template", + "BackendCallback_h.template", + "DispatcherBase_h.template", + "Parser_h.template", + ] + + lib_cpp_templates = [ + "InspectorProtocol_cpp.template", + "String16_cpp.template", + "ErrorSupport_cpp.template", + "Values_cpp.template", + "Object_cpp.template", + "DispatcherBase_cpp.template", + "Parser_cpp.template", + ] + + def generate_lib_file(file_name, template_files): + parts = [] + for template_file in template_files: + inputs.append(os.path.join(templates_dir, template_file)) + template = jinja_env.get_template(template_file) + parts.append(template.render(template_context)) + outputs[file_name] = "\n\n".join(parts) + + generate_lib_file(os.path.join(config.lib.output, "InspectorProtocol.h"), lib_h_templates) + generate_lib_file(os.path.join(config.lib.output, "InspectorProtocol.cpp"), lib_cpp_templates) + + # Make gyp / make generatos happy, otherwise make rebuilds world. + inputs_ts = max(map(os.path.getmtime, inputs)) + up_to_date = True + for output_file in outputs.iterkeys(): + if not os.path.exists(output_file) or os.path.getmtime(output_file) < inputs_ts: + up_to_date = False + break + if up_to_date: + sys.exit() + + for file_name, content in outputs.iteritems(): + out_file = open(file_name, "w") + out_file.write(content) + out_file.close() + + +main() diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Collections.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Collections_h.template similarity index 100% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Collections.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Collections_h.template diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase_cpp.template similarity index 96% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase.cpp rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase_cpp.template index 8f154f42ac286f..2f842e7fa1177c 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase_cpp.template @@ -2,11 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/DispatcherBase.h" - -#include "platform/inspector_protocol/FrontendChannel.h" -#include "platform/inspector_protocol/Parser.h" - namespace blink { namespace protocol { @@ -154,7 +149,7 @@ void UberDispatcher::dispatch(const String16& message) return; size_t dotIndex = method.find("."); - if (dotIndex == kNotFound) { + if (dotIndex == String16::kNotFound) { reportProtocolError(m_frontendChannel, callId, DispatcherBase::MethodNotFound, "'" + method + "' wasn't found", nullptr); return; } diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase_h.template similarity index 83% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase_h.template index 6e8ae28f9e5f0d..4402d9674ab246 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/DispatcherBase_h.template @@ -5,12 +5,13 @@ #ifndef DispatcherBase_h #define DispatcherBase_h -#include "platform/inspector_protocol/BackendCallback.h" -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" +//#include "BackendCallback.h" +//#include "Collections.h" +//#include "ErrorSupport.h" +//#include "Platform.h" +//#include "String16.h" +//#include "Values.h" +#include "{{config.class_export.header}}" namespace blink { namespace protocol { @@ -18,11 +19,11 @@ namespace protocol { class FrontendChannel; class WeakPtr; -class PLATFORM_EXPORT DispatcherBase { +class {{config.class_export.macro}} DispatcherBase { PROTOCOL_DISALLOW_COPY(DispatcherBase); public: static const char kInvalidRequest[]; - class PLATFORM_EXPORT WeakPtr { + class {{config.class_export.macro}} WeakPtr { public: explicit WeakPtr(DispatcherBase*); ~WeakPtr(); @@ -33,7 +34,7 @@ class PLATFORM_EXPORT DispatcherBase { DispatcherBase* m_dispatcher; }; - class PLATFORM_EXPORT Callback : public protocol::BackendCallback { + class {{config.class_export.macro}} Callback : public protocol::BackendCallback { public: Callback(std::unique_ptr backendImpl, int callId); virtual ~Callback(); @@ -77,7 +78,7 @@ class PLATFORM_EXPORT DispatcherBase { protocol::HashSet m_weakPtrs; }; -class PLATFORM_EXPORT UberDispatcher { +class {{config.class_export.macro}} UberDispatcher { PROTOCOL_DISALLOW_COPY(UberDispatcher); public: explicit UberDispatcher(FrontendChannel*); diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport_cpp.template similarity index 93% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport.cpp rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport_cpp.template index 0ad89ade1c47d0..695cb58dc3867f 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport_cpp.template @@ -2,10 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/ErrorSupport.h" - -#include "platform/inspector_protocol/String16.h" - namespace blink { namespace protocol { diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport_h.template similarity index 84% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport_h.template index 56ac442435262b..f837bff388e154 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ErrorSupport_h.template @@ -5,8 +5,9 @@ #ifndef ErrorSupport_h #define ErrorSupport_h -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +//#include "Platform.h" +//#include "String16.h" +#include "{{config.class_export.header}}" #include @@ -15,7 +16,7 @@ namespace protocol { using ErrorString = String16; -class PLATFORM_EXPORT ErrorSupport { +class {{config.class_export.macro}} ErrorSupport { public: ErrorSupport(); ErrorSupport(String16* errorString); diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Exported_h.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Exported_h.template index 5cfabc53cf1fbe..66cf7f9018537a 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Exported_h.template +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Exported_h.template @@ -7,12 +7,8 @@ #ifndef protocol_{{domain.domain}}_api_h #define protocol_{{domain.domain}}_api_h -{% if export_macro == "PLATFORM_EXPORT" %} -#include "platform/inspector_protocol/Platform.h" -{% else %} -#include "core/CoreExport.h" -{% endif %} -#include "platform/inspector_protocol/String16.h" +#include "{{config.class_export.header}}" +#include "{{config.lib_package}}/InspectorProtocol.h" namespace blink { namespace protocol { @@ -25,7 +21,7 @@ namespace API { namespace {{type.id}}Enum { {% for literal in type.enum %} -{{export_macro}} extern const char* {{ literal | dash_to_camelcase}}; +{{config.class_export.macro}} extern const char* {{ literal | dash_to_camelcase}}; {% endfor %} } // {{type.id}}Enum {% endif %} @@ -37,7 +33,7 @@ namespace {{type.id}}Enum { namespace {{command.name | to_title_case}} { namespace {{param.name | to_title_case}}Enum { {% for literal in param.enum %} -{{export_macro}} extern const char* {{ literal | dash_to_camelcase}}; +{{config.class_export.macro}} extern const char* {{ literal | dash_to_camelcase}}; {% endfor %} } // {{param.name | to_title_case}}Enum } // {{command.name | to_title_case }} @@ -49,7 +45,7 @@ namespace {{param.name | to_title_case}}Enum { {% for type in domain.types %} {% if not (type.type == "object") or not ("properties" in type) or not (type.exported) %}{% continue %}{% endif %} -class {{export_macro}} {{type.id}} { +class {{config.class_export.macro}} {{type.id}} { public: virtual String16 toJSONString() const = 0; virtual ~{{type.id}}() { } diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/FrontendChannel.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/FrontendChannel_h.template similarity index 83% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/FrontendChannel.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/FrontendChannel_h.template index ee81e951ed8d15..ead1491ed28262 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/FrontendChannel.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/FrontendChannel_h.template @@ -5,12 +5,13 @@ #ifndef FrontendChannel_h #define FrontendChannel_h -#include "platform/inspector_protocol/Values.h" +//#include "String16.h" +#include "{{config.class_export.header}}" namespace blink { namespace protocol { -class PLATFORM_EXPORT FrontendChannel { +class {{config.class_export.macro}} FrontendChannel { public: virtual ~FrontendChannel() { } virtual void sendProtocolResponse(int callId, const String16& message) = 0; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Imported_h.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Imported_h.template index a9abdad172642e..2d4e11a4690807 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Imported_h.template +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Imported_h.template @@ -7,10 +7,8 @@ #ifndef protocol_{{domain.domain}}_imported_h #define protocol_{{domain.domain}}_imported_h -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/ValueConversions.h" -#include "platform/inspector_protocol/Values.h" -#include "{{include_package}}/{{domain.domain}}.h" +#include "{{config.lib_package}}/InspectorProtocol.h" +#include "{{config.imported.package}}/{{domain.domain}}.h" namespace blink { namespace protocol { diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/InspectorProtocol_cpp.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/InspectorProtocol_cpp.template new file mode 100644 index 00000000000000..e7c49fdda189e5 --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/InspectorProtocol_cpp.template @@ -0,0 +1,5 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "{{config.lib_package}}/InspectorProtocol.h" diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Maybe.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Maybe_h.template similarity index 89% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Maybe.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Maybe_h.template index cf372e0bbe2015..e15ac070da1287 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Maybe.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Maybe_h.template @@ -5,16 +5,12 @@ #ifndef Maybe_h #define Maybe_h -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" - -#include +//#include "Platform.h" +//#include "String16.h" namespace blink { namespace protocol { -class String16; - template class Maybe { public: @@ -70,10 +66,10 @@ class Maybe : public MaybeBase { }; template<> -class Maybe : public MaybeBase { +class Maybe : public MaybeBase { public: Maybe() { } - Maybe(const String& value) : MaybeBase(value) { } + Maybe(const InspectorProtocolConvenienceStringType& value) : MaybeBase(value) { } using MaybeBase::operator=; }; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object_cpp.template similarity index 95% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object.cpp rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object_cpp.template index 7bb007d4b73f84..4480d853ef0184 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object_cpp.template @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/Object.h" - namespace blink { namespace protocol { diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object_h.template similarity index 78% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object_h.template index 22506c08d4570d..dc7f44b6b335d6 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Object_h.template @@ -5,14 +5,15 @@ #ifndef Object_h #define Object_h -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/Values.h" +//#include "ErrorSupport.h" +//#include "Platform.h" +//#include "Values.h" +#include "{{config.class_export.header}}" namespace blink { namespace protocol { -class PLATFORM_EXPORT Object { +class {{config.class_export.macro}} Object { public: static std::unique_ptr parse(protocol::Value*, ErrorSupport*); ~Object(); diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ParserTest.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ParserTest.cpp index 1a8f44289f2a7b..40c6af754cedbe 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ParserTest.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ParserTest.cpp @@ -2,10 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/Parser.h" - -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser_cpp.template similarity index 98% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser.cpp rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser_cpp.template index 4193108b279162..34d8ff0720d046 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser_cpp.template @@ -2,11 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/Parser.h" - -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" - namespace blink { namespace protocol { @@ -200,7 +195,7 @@ bool skipComment(const UChar* start, const UChar* end, const UChar** commentEnd) void skipWhitespaceAndComments(const UChar* start, const UChar* end, const UChar** whitespaceEnd) { while (start < end) { - if (isSpaceOrNewline(*start)) { + if (String16::isSpaceOrNewLine(*start)) { ++start; } else if (*start == '/') { const UChar* commentEnd; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser_h.template similarity index 65% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser_h.template index c6f700ee3040d2..1f3a1b65c06e40 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Parser_h.template @@ -5,15 +5,16 @@ #ifndef Parser_h #define Parser_h -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +//#include "Platform.h" +//#include "String16.h" +#include "{{config.class_export.header}}" namespace blink { namespace protocol { class Value; -PLATFORM_EXPORT std::unique_ptr parseJSON(const String16& json); +{{config.class_export.macro}} std::unique_ptr parseJSON(const String16& json); } // namespace platform } // namespace blink diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Platform.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Platform_h.template similarity index 61% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Platform.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Platform_h.template index 76ba9302abc047..41b8ef2140cc14 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Platform.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Platform_h.template @@ -5,10 +5,6 @@ #ifndef protocol_Platform_h #define protocol_Platform_h -#if V8_INSPECTOR_USE_STL -#include "platform/inspector_protocol/PlatformSTL.h" -#else -#include "platform/inspector_protocol/PlatformWTF.h" -#endif // V8_INSPECTOR_USE_STL +#include "{{config.lib.platform_header}}" #endif // !defined(protocol_Platform_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16.h deleted file mode 100644 index 6a1b4a09de3346..00000000000000 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef String16_h -#define String16_h - -#if V8_INSPECTOR_USE_STL -#include "platform/inspector_protocol/String16STL.h" -#else -#include "platform/inspector_protocol/String16WTF.h" -#endif // V8_INSPECTOR_USE_STL - -#endif // !defined(String16_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.h deleted file mode 100644 index 4dd4369ebdd788..00000000000000 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.h +++ /dev/null @@ -1,263 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef String16STL_h -#define String16STL_h - -#include -#include -#include -#include -#include -#include - -using UChar = uint16_t; -using UChar32 = uint32_t; -using LChar = unsigned char; -// presubmit: allow wstring -using wstring = std::basic_string; -const size_t kNotFound = static_cast(-1); - -namespace blink { -namespace protocol { - -class String16 { -public: - String16() { } - String16(const String16& other) : m_impl(other.m_impl) { } - // presubmit: allow wstring - String16(const wstring& impl) : m_impl(impl) { } - String16(const UChar* characters) : m_impl(characters) { } - String16(const char* characters) : String16(characters, std::strlen(characters)) { } - String16(const char* characters, size_t size) - { - m_impl.resize(size); - for (size_t i = 0; i < size; ++i) - m_impl[i] = characters[i]; - } - String16(const UChar* characters, size_t size) : m_impl(characters, size) { } - String16 isolatedCopy() const { return String16(m_impl); } - - unsigned sizeInBytes() const { return m_impl.size() * sizeof(UChar); } - const UChar* characters16() const { return m_impl.c_str(); } - std::string utf8() const; - static String16 fromUTF8(const char* stringStart, size_t length); - static String16 fromInteger(int i) { return String16(String16::intToString(i).c_str()); } - static String16 fromDouble(double d) { return String16(String16::doubleToString(d).c_str()); } - static String16 fromDoubleFixedPrecision(double d, int len) { return String16(String16::doubleToString(d).c_str()); } - - static double charactersToDouble(const UChar* characters, size_t length, bool* ok = 0) - { - std::string str; - str.resize(length); - for (size_t i = 0; i < length; ++i) - str[i] = static_cast(characters[i]); - - const char* buffer = str.c_str(); - char* endptr; - double result = strtod(buffer, &endptr); - if (ok) - *ok = buffer + length == endptr; - return result; - } - - String16 substring(unsigned pos, unsigned len = 0xFFFFFFFF) const - { - return String16(m_impl.substr(pos, len)); - } - - String16 stripWhiteSpace() const; - - int toInt(bool* ok = 0) const - { - size_t length = m_impl.length(); - std::string str; - str.resize(length); - for (size_t i = 0; i < length; ++i) - str[i] = static_cast(m_impl[i]); - - const char* buffer = str.c_str(); - char* endptr; - int result = strtol(buffer, &endptr, 10); - if (ok) - *ok = buffer + length == endptr; - return result; - } - - size_t length() const { return m_impl.length(); } - bool isEmpty() const { return !m_impl.length(); } - UChar operator[](unsigned index) const { return m_impl[index]; } - - size_t find(UChar c, unsigned start = 0) const - { - return m_impl.find(c, start); - } - - size_t find(const String16& str, unsigned start = 0) const - { - return m_impl.find(str.m_impl, start); - } - - size_t reverseFind(const String16& str, unsigned start = 0xFFFFFFFF) const - { - return m_impl.rfind(str.m_impl, start); - } - - bool startWith(const String16& s) const - { - if (m_impl.length() < s.m_impl.length()) - return false; - return m_impl.substr(0, s.m_impl.length()) == s.m_impl; - } - - bool endsWith(UChar character) const - { - return m_impl.length() && m_impl[m_impl.length() - 1] == character; - } - - // presubmit: allow wstring - const wstring& impl() const { return m_impl; } - - std::size_t hash() const - { - if (!has_hash) { - size_t hash = 0; - for (size_t i = 0; i < length(); ++i) - hash = 31 * hash + m_impl[i]; - hash_code = hash; - has_hash = true; - } - return hash_code; - } - -private: - static std::string intToString(int); - static std::string doubleToString(double); - // presubmit: allow wstring - wstring m_impl; - mutable bool has_hash = false; - mutable std::size_t hash_code = 0; -}; - -static inline bool isSpaceOrNewline(UChar c) -{ - return std::isspace(c); // NOLINT -} - -class String16Builder { -public: - String16Builder() { } - - void append(const String16& str) - { - m_impl += str.impl(); - } - - void append(UChar c) - { - m_impl += c; - } - - void append(LChar c) - { - m_impl += c; - } - - void append(char c) - { - m_impl += c; - } - - void appendNumber(int i) - { - m_impl = m_impl + String16::fromInteger(i).impl(); - } - - void appendNumber(double d) - { - m_impl = m_impl + String16::fromDoubleFixedPrecision(d, 6).impl(); - } - - void append(const UChar* c, size_t length) - { - // presubmit: allow wstring - m_impl += wstring(c, length); - } - - void append(const char* c, size_t length) - { - m_impl += String16(c, length).impl(); - } - - String16 toString() - { - return String16(m_impl); - } - - void reserveCapacity(unsigned newCapacity) - { - } - -private: - // presubmit: allow wstring - wstring m_impl; -}; - -inline bool operator==(const String16& a, const String16& b) { return a.impl() == b.impl(); } -inline bool operator!=(const String16& a, const String16& b) { return a.impl() != b.impl(); } -inline bool operator==(const String16& a, const char* b) { return a.impl() == String16(b).impl(); } -inline bool operator<(const String16& a, const String16& b) { return a.impl() < b.impl(); } - -inline String16 operator+(const String16& a, const char* b) -{ - return String16(a.impl() + String16(b).impl()); -} - -inline String16 operator+(const char* a, const String16& b) -{ - return String16(String16(a).impl() + b.impl()); -} - -inline String16 operator+(const String16& a, const String16& b) -{ - return String16(a.impl() + b.impl()); -} - -} // namespace protocol -} // namespace blink - -using String16 = blink::protocol::String16; -using String16Builder = blink::protocol::String16Builder; - - -namespace WTF { -// Interim solution for those headers that reference WTF::String for overrides. -// It does nothing. If the code actually relies on WTF:String, it will not -// compile! -// TODO(eostroukhov): Eradicate -class String { -public: - String() {}; - String(const String16& other) {}; - operator String16() const { return String16(); }; -}; -} // namespace WTF - -#if !defined(__APPLE__) || defined(_LIBCPP_VERSION) - -namespace std { -template<> struct hash { - std::size_t operator()(const String16& string) const - { - return string.hash(); - } -}; - -} // namespace std - -#endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION) - -using String = WTF::String; - -#endif // !defined(String16STL_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.cpp deleted file mode 100644 index 387ecc3f48c45c..00000000000000 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "platform/inspector_protocol/String16WTF.h" - -namespace blink { -namespace protocol { - -String16::String16(const String16& other) : m_impl(other.m_impl) { } - -String16::String16(const UChar* u, unsigned length) : m_impl(u, length) { } - -String16::String16(const char* characters) : String16(characters, strlen(characters)) { } - -String16::String16(const WTF::String& other) -{ - if (other.isNull()) - return; - if (!other.is8Bit()) { - m_impl = other; - return; - } - - UChar* data; - const LChar* characters = other.characters8(); - size_t length = other.length(); - m_impl = String::createUninitialized(length, data); - for (size_t i = 0; i < length; ++i) - data[i] = characters[i]; -} - -String16::String16(const char* characters, size_t length) -{ - UChar* data; - m_impl = String::createUninitialized(length, data); - for (size_t i = 0; i < length; ++i) - data[i] = characters[i]; -} - -String16 String16::createUninitialized(unsigned length, UChar*& data) -{ - return String::createUninitialized(length, data); -} - -} // namespace protocol -} // namespace blink diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.h deleted file mode 100644 index 19c56256f0dec4..00000000000000 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16WTF.h +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef String16WTF_h -#define String16WTF_h - -#include "platform/Decimal.h" -#include "public/platform/WebString.h" -#include "wtf/text/StringBuilder.h" -#include "wtf/text/StringConcatenate.h" -#include "wtf/text/StringHash.h" -#include "wtf/text/StringToNumber.h" -#include "wtf/text/StringView.h" -#include "wtf/text/WTFString.h" - -namespace blink { -namespace protocol { - -class PLATFORM_EXPORT String16 { -public: - String16() { } - String16(const String16& other); - String16(const UChar*, unsigned); - String16(const char*); - String16(const char*, size_t); - static String16 createUninitialized(unsigned length, UChar*& data); - - // WTF convenience constructors and helper methods. - String16(const WebString& other) : String16(String(other)) { } - template - String16(const WTF::StringAppend& impl) : String16(String(impl)) { } - String16(const WTF::AtomicString& impl) : String16(String(impl)) { } - String16(const WTF::String& impl); - String16(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { } - bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); } - operator WTF::String() const { return m_impl; } - operator WTF::StringView() const { return StringView(m_impl); } - operator WebString() { return m_impl; } - const WTF::String& impl() const { return m_impl; } - String16 isolatedCopy() const { return String16(m_impl.isolatedCopy()); } - - ~String16() { } - - static String16 fromInteger(int i) { return String::number(i); } - static String16 fromDouble(double number) { return Decimal::fromDouble(number).toString(); } - static String16 fromDoubleFixedPrecision(double number, int precision) { return String::numberToStringFixedWidth(number, precision); } - - size_t length() const { return m_impl.length(); } - bool isEmpty() const { return m_impl.isEmpty(); } - UChar operator[](unsigned index) const { return m_impl[index]; } - - unsigned sizeInBytes() const { return m_impl.sizeInBytes(); } - const UChar* characters16() const { return m_impl.isEmpty() ? nullptr : m_impl.characters16(); } - - static double charactersToDouble(const LChar* characters, size_t length, bool* ok = 0) { return ::charactersToDouble(characters, length, ok); } - static double charactersToDouble(const UChar* characters, size_t length, bool* ok = 0) { return ::charactersToDouble(characters, length, ok); } - - String16 substring(unsigned pos, unsigned len = UINT_MAX) const { return m_impl.substring(pos, len); } - String16 stripWhiteSpace() const { return m_impl.stripWhiteSpace(); } - - int toInt(bool* ok = 0) const { return m_impl.toInt(ok); } - - size_t find(UChar c, unsigned start = 0) const { return m_impl.find(c, start); } - size_t find(const String16& str, unsigned start = 0) const { return m_impl.find(str.impl(), start); } - size_t reverseFind(const String16& str, unsigned start = UINT_MAX) const { return m_impl.reverseFind(str.impl(), start); } - - bool startWith(const String16& s) const { return m_impl.startsWith(s); } - bool startWith(UChar character) const { return m_impl.startsWith(character); } - bool endsWith(const String16& s) const { return m_impl.endsWith(s); } - bool endsWith(UChar character) const { return m_impl.endsWith(character); } - -private: - WTF::String m_impl; -}; - -class String16Builder { -public: - String16Builder() { } - void append(const String16& str) { m_impl.append(str); }; - void append(UChar c) { m_impl.append(c); }; - void append(LChar c) { m_impl.append(c); }; - void append(char c) { m_impl.append(c); }; - void append(const UChar* c, size_t size) { m_impl.append(c, size); }; - void append(const char* characters, unsigned length) { m_impl.append(characters, length); } - void appendNumber(int number) { m_impl.appendNumber(number); } - void appendNumber(double number) { m_impl.appendNumber(number); } - String16 toString() { return m_impl.toString(); } - void reserveCapacity(unsigned newCapacity) { m_impl.reserveCapacity(newCapacity); } - -private: - WTF::StringBuilder m_impl; -}; - -inline bool operator==(const String16& a, const String16& b) { return a.impl() == b.impl(); } -inline bool operator!=(const String16& a, const String16& b) { return a.impl() != b.impl(); } -inline bool operator==(const String16& a, const char* b) { return a.impl() == b; } - -inline String16 operator+(const String16& a, const char* b) -{ - return String(a.impl() + b); -} - -inline String16 operator+(const char* a, const String16& b) -{ - return String(a + b.impl()); -} - -inline String16 operator+(const String16& a, const String16& b) -{ - return String(a.impl() + b.impl()); -} - -} // namespace protocol -} // namespace blink - -using String16 = blink::protocol::String16; -using String16Builder = blink::protocol::String16Builder; - -namespace WTF { - -struct String16Hash { - static unsigned hash(const String16& key) { return StringHash::hash(key.impl()); } - static bool equal(const String16& a, const String16& b) - { - return StringHash::equal(a.impl(), b.impl()); - } - static const bool safeToCompareToEmptyOrDeleted = false; -}; - -template struct DefaultHash; -template<> struct DefaultHash { - typedef String16Hash Hash; -}; - -template<> -struct HashTraits : SimpleClassHashTraits { - static const bool hasIsEmptyValueFunction = true; - static bool isEmptyValue(const String16& a) { return a.impl().isNull(); } -}; - -} // namespace WTF - -namespace std { -template<> struct hash { - std::size_t operator()(const String16& string) const - { - return StringHash::hash(string.impl()); - } -}; - -} // namespace std - -#endif // !defined(String16WTF_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_cpp.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_cpp.template new file mode 100644 index 00000000000000..d795aefa0c2f25 --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_cpp.template @@ -0,0 +1,99 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include +#include +#include + +namespace blink { +namespace protocol { + +namespace internal { + +void intToStr(int number, char* buffer, size_t length) +{ + std::snprintf(buffer, length, "%d", number); +} + +void doubleToStr(double number, char* buffer, size_t length) +{ + std::snprintf(buffer, length, "%f", number); +} + +void doubleToStr3(double number, char* buffer, size_t length) +{ + std::snprintf(buffer, length, "%.3g", number); +} + +void doubleToStr6(double number, char* buffer, size_t length) +{ + std::snprintf(buffer, length, "%.6g", number); +} + +double strToDouble(const char* buffer, bool* ok) +{ + char* endptr; + double result = std::strtod(buffer, &endptr); + if (ok) + *ok = !(*endptr); + return result; +} + +int strToInt(const char* buffer, bool* ok) +{ + char* endptr; + int result = std::strtol(buffer, &endptr, 10); + if (ok) + *ok = !(*endptr); + return result; +} + +} // namespace internal + +String16Builder::String16Builder() +{ +} + +void String16Builder::append(const String16& s) +{ + m_buffer.insert(m_buffer.end(), s.characters16(), s.characters16() + s.length()); +} + +void String16Builder::append(UChar c) +{ + m_buffer.push_back(c); +} + +void String16Builder::append(char c) +{ + UChar u = c; + m_buffer.push_back(u); +} + +void String16Builder::append(const UChar* characters, size_t length) +{ + m_buffer.insert(m_buffer.end(), characters, characters + length); +} + +void String16Builder::append(const char* characters, size_t length) +{ + m_buffer.reserve(m_buffer.size() + length); + for (size_t i = 0; i < length; ++i, ++characters) { + UChar u = *characters; + m_buffer.push_back(u); + } +} + +String16 String16Builder::toString() +{ + return String16(m_buffer.data(), m_buffer.size()); +} + +void String16Builder::reserveCapacity(size_t capacity) +{ + m_buffer.reserve(capacity); +} + +} // namespace protocol +} // namespace blink diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_h.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_h.template new file mode 100644 index 00000000000000..e6f8f0c78465ae --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16_h.template @@ -0,0 +1,181 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef String16_h +#define String16_h + +//#include "Collections.h" +//#include "Platform.h" +#include "{{config.class_export.header}}" + +#include + +namespace blink { +namespace protocol { + +namespace internal { +{{config.class_export.macro}} void intToStr(int, char*, size_t); +{{config.class_export.macro}} void doubleToStr(double, char*, size_t); +{{config.class_export.macro}} void doubleToStr3(double, char*, size_t); +{{config.class_export.macro}} void doubleToStr6(double, char*, size_t); +{{config.class_export.macro}} double strToDouble(const char*, bool*); +{{config.class_export.macro}} int strToInt(const char*, bool*); +} // namespace internal + +template +class {{config.class_export.macro}} String16Base { +public: + static bool isASCII(C c) + { + return !(c & ~0x7F); + } + + static bool isSpaceOrNewLine(C c) + { + return isASCII(c) && c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); + } + + static T fromInteger(int number) + { + char buffer[50]; + internal::intToStr(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer)); + return T(buffer); + } + + static T fromDouble(double number) + { + char buffer[100]; + internal::doubleToStr(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer)); + return T(buffer); + } + + static T fromDoublePrecision3(double number) + { + char buffer[100]; + internal::doubleToStr3(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer)); + return T(buffer); + } + + static T fromDoublePrecision6(double number) + { + char buffer[100]; + internal::doubleToStr6(number, buffer, PROTOCOL_ARRAY_LENGTH(buffer)); + return T(buffer); + } + + static double charactersToDouble(const C* characters, size_t length, bool* ok = nullptr) + { + std::vector buffer; + buffer.reserve(length + 1); + for (size_t i = 0; i < length; ++i) { + if (!isASCII(characters[i])) { + if (ok) + *ok = false; + return 0; + } + buffer.push_back(static_cast(characters[i])); + } + buffer.push_back('\0'); + return internal::strToDouble(buffer.data(), ok); + } + + static int charactersToInteger(const C* characters, size_t length, bool* ok = nullptr) + { + std::vector buffer; + buffer.reserve(length + 1); + for (size_t i = 0; i < length; ++i) { + if (!isASCII(characters[i])) { + if (ok) + *ok = false; + return 0; + } + buffer.push_back(static_cast(characters[i])); + } + buffer.push_back('\0'); + return internal::strToInt(buffer.data(), ok); + } + + double toDouble(bool* ok = nullptr) const + { + const C* characters = static_cast(*this).characters16(); + size_t length = static_cast(*this).length(); + return charactersToDouble(characters, length, ok); + } + + int toInteger(bool* ok = nullptr) const + { + const C* characters = static_cast(*this).characters16(); + size_t length = static_cast(*this).length(); + return charactersToInteger(characters, length, ok); + } + + T stripWhiteSpace() const + { + size_t length = static_cast(*this).length(); + if (!length) + return T(); + + unsigned start = 0; + unsigned end = length - 1; + const C* characters = static_cast(*this).characters16(); + + // skip white space from start + while (start <= end && isSpaceOrNewLine(characters[start])) + ++start; + + // only white space + if (start > end) + return T(); + + // skip white space from end + while (end && isSpaceOrNewLine(characters[end])) + --end; + + if (!start && end == length - 1) + return T(static_cast(*this)); + return T(characters + start, end + 1 - start); + } + + bool startsWith(const char* prefix) const + { + const C* characters = static_cast(*this).characters16(); + size_t length = static_cast(*this).length(); + for (size_t i = 0, j = 0; prefix[j] && i < length; ++i, ++j) { + if (characters[i] != prefix[j]) + return false; + } + return true; + } +}; + +} // namespace protocol +} // namespace blink + +#include "{{config.lib.string16_header}}" + +namespace blink { +namespace protocol { + +class {{config.class_export.macro}} String16Builder { +public: + String16Builder(); + void append(const String16&); + void append(UChar); + void append(char); + void append(const UChar*, size_t); + void append(const char*, size_t); + String16 toString(); + void reserveCapacity(size_t); + +private: + std::vector m_buffer; +}; + +} // namespace protocol +} // namespace blink + +using String16 = blink::protocol::String16; +using String16Builder = blink::protocol::String16Builder; + +#endif // !defined(String16_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_cpp.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_cpp.template index e3c2fa1de6761d..84a3acf670f144 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_cpp.template +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_cpp.template @@ -4,10 +4,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "{{output_package}}/{{domain.domain}}.h" - -#include "platform/inspector_protocol/DispatcherBase.h" -#include "platform/inspector_protocol/Parser.h" +#include "{{config.protocol.package}}/{{domain.domain}}.h" namespace blink { namespace protocol { @@ -17,6 +14,7 @@ namespace {{domain.domain}} { const char Metainfo::domainName[] = "{{domain.domain}}"; const char Metainfo::commandPrefix[] = "{{domain.domain}}."; +const char Metainfo::version[] = "{{domain.version}}"; {% for type in domain.types %} {% if "enum" in type %} @@ -40,7 +38,7 @@ const char* {{ literal | dash_to_camelcase}} = "{{literal}}"; {% if "enum" in property %} {% for literal in property.enum %} -const char* {{type.id}}::{{property.name | to_title_case}}Enum::{{ literal | dash_to_camelcase}} = "{{literal}}"; +const char* {{type.id}}::{{property.name | to_title_case}}Enum::{{literal | dash_to_camelcase}} = "{{literal}}"; {% endfor %} {% endif %} {% endfor %} diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_h.template b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_h.template index 83310065e0f0da..b5cf09621d4b2b 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_h.template +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/TypeBuilder_h.template @@ -7,29 +7,15 @@ #ifndef protocol_{{domain.domain}}_h #define protocol_{{domain.domain}}_h -{% if export_macro == "PLATFORM_EXPORT" %} -#include "platform/inspector_protocol/Platform.h" -{% else %} -#include "core/CoreExport.h" -{% endif %} -#include "platform/inspector_protocol/Array.h" -#include "platform/inspector_protocol/BackendCallback.h" -#include "platform/inspector_protocol/DispatcherBase.h" -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/FrontendChannel.h" -#include "platform/inspector_protocol/Maybe.h" -#include "platform/inspector_protocol/Object.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" -#include "platform/inspector_protocol/ValueConversions.h" +#include "{{config.class_export.header}}" +#include "{{config.lib_package}}/InspectorProtocol.h" // For each imported domain we generate a ValueConversions struct instead of a full domain definition // and include Domain::API version from there. {% for name in domain.dependencies %} -#include "{{output_package}}/{{name}}.h" +#include "{{config.protocol.package}}/{{name}}.h" {% endfor %} {% if domain["has_exports"] %} -#include "{{exported_package}}/{{domain.domain}}.h" +#include "{{config.exported.package}}/{{domain.domain}}.h" {% endif %} namespace blink { @@ -56,7 +42,7 @@ using {{type.id}} = {{resolve_type(type).type}}; namespace {{type.id}}Enum { {% for literal in type.enum %} -{{export_macro}} extern const char* {{ literal | dash_to_camelcase}}; +{{config.class_export.macro}} extern const char* {{ literal | dash_to_camelcase}}; {% endfor %} } // namespace {{type.id}}Enum {% endif %} @@ -68,7 +54,7 @@ namespace {{type.id}}Enum { namespace {{command.name | to_title_case}} { namespace {{param.name | to_title_case}}Enum { {% for literal in param.enum %} -{{export_macro}} extern const char* {{ literal | dash_to_camelcase}}; +{{config.class_export.macro}} extern const char* {{literal | dash_to_camelcase}}; {% endfor %} } // {{param.name | to_title_case}}Enum } // {{command.name | to_title_case }} @@ -82,7 +68,7 @@ namespace {{param.name | to_title_case}}Enum { {% set type_def = type_definition(domain.domain + "." + type.id)%} // {{type.description}} -class {{export_macro}} {{type.id}} {% if type.exported %}: public API::{{type.id}} {% endif %}{ +class {{config.class_export.macro}} {{type.id}} {% if type.exported %}: public API::{{type.id}} {% endif %}{ PROTOCOL_DISALLOW_COPY({{type.id}}); public: static std::unique_ptr<{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors); @@ -91,9 +77,9 @@ public: {% for property in type.properties %} {% if "enum" in property %} - struct {{export_macro}} {{property.name | to_title_case}}Enum { + struct {{config.class_export.macro}} {{property.name | to_title_case}}Enum { {% for literal in property.enum %} - static const char* {{ literal | dash_to_camelcase}}; + static const char* {{literal | dash_to_camelcase}}; {% endfor %} }; // {{property.name | to_title_case}}Enum {% endif %} @@ -194,13 +180,13 @@ private: // ------------- Backend interface. -class {{export_macro}} Backend { +class {{config.class_export.macro}} Backend { public: {% for command in domain.commands %} {% if "redirect" in command %}{% continue %}{% endif %} {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %}{% continue %}{% endif %} {% if "async" in command %} - class {{export_macro}} {{command.name | to_title_case}}Callback : public BackendCallback { + class {{config.class_export.macro}} {{command.name | to_title_case}}Callback : public BackendCallback { public: virtual void sendSuccess( {%- for parameter in command.returns -%} @@ -251,7 +237,7 @@ protected: // ------------- Frontend interface. -class {{export_macro}} Frontend { +class {{config.class_export.macro}} Frontend { public: Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } {% for event in domain.events %} @@ -274,7 +260,7 @@ private: // ------------- Dispatcher. -class {{export_macro}} Dispatcher { +class {{config.class_export.macro}} Dispatcher { public: static void wire(UberDispatcher*, blink::protocol::{{domain.domain}}::Backend*); @@ -284,13 +270,14 @@ private: // ------------- Metainfo. -class {{export_macro}} Metainfo { +class {{config.class_export.macro}} Metainfo { public: using BackendClass = Backend; using FrontendClass = Frontend; using DispatcherClass = Dispatcher; static const char domainName[]; static const char commandPrefix[]; + static const char version[]; }; } // namespace {{domain.domain}} diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ValueConversions.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ValueConversions_h.template similarity index 92% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ValueConversions.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ValueConversions_h.template index ba1d08047aa6bf..3b7eaa4f79d58f 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ValueConversions.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/ValueConversions_h.template @@ -5,10 +5,10 @@ #ifndef ValueConversions_h #define ValueConversions_h -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" +//#include "ErrorSupport.h" +//#include "Platform.h" +//#include "String16.h" +//#include "Values.h" namespace blink { namespace protocol { @@ -83,8 +83,8 @@ struct ValueConversions { }; template<> -struct ValueConversions { - static String parse(protocol::Value* value, ErrorSupport* errors) +struct ValueConversions { + static InspectorProtocolConvenienceStringType parse(protocol::Value* value, ErrorSupport* errors) { String16 result; bool success = value ? value->asString(&result) : false; @@ -93,7 +93,7 @@ struct ValueConversions { return result; } - static std::unique_ptr serialize(const String& value) + static std::unique_ptr serialize(const InspectorProtocolConvenienceStringType& value) { return StringValue::create(value); } diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values_cpp.template similarity index 94% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values.cpp rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values_cpp.template index 5b8f13b4930e27..482ec46ab44af7 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values_cpp.template @@ -2,11 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/Values.h" - -#include "platform/inspector_protocol/Parser.h" -#include "platform/inspector_protocol/String16.h" - #include #include @@ -15,9 +10,9 @@ namespace protocol { namespace { -const char* const nullString = "null"; -const char* const trueString = "true"; -const char* const falseString = "false"; +const char* const nullValueString = "null"; +const char* const trueValueString = "true"; +const char* const falseValueString = "false"; inline bool escapeChar(UChar c, String16Builder* dst) { @@ -35,13 +30,14 @@ inline bool escapeChar(UChar c, String16Builder* dst) return true; } -const LChar hexDigits[17] = "0123456789ABCDEF"; +const char hexDigits[17] = "0123456789ABCDEF"; void appendUnsignedAsHex(UChar number, String16Builder* dst) { dst->append("\\u"); for (size_t i = 0; i < 4; ++i) { - dst->append(hexDigits[(number & 0xF000) >> 12]); + UChar c = hexDigits[(number & 0xF000) >> 12]; + dst->append(c); number <<= 4; } } @@ -108,7 +104,7 @@ String16 Value::toJSONString() const void Value::writeJSON(String16Builder* output) const { DCHECK(m_type == TypeNull); - output->append(nullString, 4); + output->append(nullValueString, 4); } std::unique_ptr Value::clone() const @@ -150,12 +146,12 @@ void FundamentalValue::writeJSON(String16Builder* output) const DCHECK(type() == TypeBoolean || type() == TypeInteger || type() == TypeDouble); if (type() == TypeBoolean) { if (m_boolValue) - output->append(trueString, 4); + output->append(trueValueString, 4); else - output->append(falseString, 5); + output->append(falseValueString, 5); } else if (type() == TypeDouble) { if (!std::isfinite(m_doubleValue)) { - output->append(nullString, 4); + output->append(nullValueString, 4); return; } output->append(String16::fromDouble(m_doubleValue)); diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values.h b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values_h.template similarity index 92% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values.h rename to deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values_h.template index 48a2012758a16b..9874183a773628 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/Values_h.template @@ -5,10 +5,11 @@ #ifndef Values_h #define Values_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +//#include "Allocator.h" +//#include "Collections.h" +//#include "Platform.h" +//#include "String16.h" +#include "{{config.class_export.header}}" #include @@ -19,7 +20,7 @@ class ListValue; class DictionaryValue; class Value; -class PLATFORM_EXPORT Value { +class {{config.class_export.macro}} Value { PROTOCOL_DISALLOW_COPY(Value); public: static const int maxDepth = 1000; @@ -67,7 +68,7 @@ class PLATFORM_EXPORT Value { ValueType m_type; }; -class PLATFORM_EXPORT FundamentalValue : public Value { +class {{config.class_export.macro}} FundamentalValue : public Value { public: static std::unique_ptr create(bool value) { @@ -102,7 +103,7 @@ class PLATFORM_EXPORT FundamentalValue : public Value { }; }; -class PLATFORM_EXPORT StringValue : public Value { +class {{config.class_export.macro}} StringValue : public Value { public: static std::unique_ptr create(const String16& value) { @@ -125,7 +126,7 @@ class PLATFORM_EXPORT StringValue : public Value { String16 m_stringValue; }; -class PLATFORM_EXPORT SerializedValue : public Value { +class {{config.class_export.macro}} SerializedValue : public Value { public: static std::unique_ptr create(const String16& value) { @@ -143,7 +144,7 @@ class PLATFORM_EXPORT SerializedValue : public Value { String16 m_serializedValue; }; -class PLATFORM_EXPORT DictionaryValue : public Value { +class {{config.class_export.macro}} DictionaryValue : public Value { public: using Entry = std::pair; static std::unique_ptr create() @@ -210,7 +211,7 @@ class PLATFORM_EXPORT DictionaryValue : public Value { std::vector m_order; }; -class PLATFORM_EXPORT ListValue : public Value { +class {{config.class_export.macro}} ListValue : public Value { public: static std::unique_ptr create() { diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/generate-inspector-protocol-version b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/generate-inspector-protocol-version index 0c01e163bbd3f8..8c13092541378d 100755 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/generate-inspector-protocol-version +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/generate-inspector-protocol-version @@ -4,7 +4,7 @@ # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: -# +# # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above @@ -14,7 +14,7 @@ # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR @@ -28,7 +28,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # Inspector protocol validator. -# +# # Tests that subsequent protocol changes are not breaking backwards compatibility. # Following violations are reported: # @@ -39,7 +39,7 @@ # - Event has been removed # - Required event parameter was removed or changed to optional # - Parameter type has changed. -# +# # For the parameters with composite types the above checks are also applied # recursively to every property of the type. # @@ -197,7 +197,7 @@ def extract_type(typed_object, types_map, errors): ref = typed_object["$ref"] if not ref in types_map: errors.append("Can not resolve type: %s" % ref) - types_map[ref] = { "id": "", "type": "object" } + types_map[ref] = { "id": "", "type": "object" } return types_map[ref] @@ -452,7 +452,10 @@ def main(): expected_errors = [ "Debugger.globalObjectCleared: event has been removed", - "Runtime.executionContextCreated.context parameter->Runtime.ExecutionContextDescription.frameId: required property has been removed" + "Runtime.executionContextCreated.context parameter->Runtime.ExecutionContextDescription.frameId: required property has been removed", + "Debugger.canSetScriptSource: command has been removed", + "Console.messageRepeatCountUpdated: event has been removed", + "Console.messagesCleared: event has been removed" ] errors = compare_schemas(baseline_domains, domains, False) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/sample_config.json b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/sample_config.json new file mode 100644 index 00000000000000..5ad6722cb27d5c --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/sample_config.json @@ -0,0 +1,34 @@ +{ + "protocol": { + "path": "protocol/sample_protocol.json", + "package": "include/generated/files/like/this", + "output": "place/generated/files/here" + }, + + "imported": { + "path": "../relative/path/imported_protocol.json", + "package": "include/imported/files/like/this" + }, + + "exported": { + "package": "include/exported/files/like/this", + "output": "place/exported/files/here" + }, + + "string": { + "class_name": "String16" + }, + + "lib": { + "output": "place/generated/lib/files/here", + "string16_header": "sting16/implementation.h", + "platform_header": "platform/implementation.h" + }, + + "lib_package": "include/lib/files/like/this", + + "class_export": { + "macro": "LIB_EXPORT", + "header": "lib/export.h" + } +} diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/Atomics.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/Atomics.h index 56cb3ab7ab9129..8523df6294158e 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/Atomics.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/Atomics.h @@ -11,7 +11,7 @@ #include #endif -namespace blink { +namespace v8_inspector { #if defined(_MSC_VER) @@ -24,6 +24,6 @@ inline int atomicIncrement(int volatile* addend) { return atomicAdd(addend, 1); #endif -} // namespace blink +} // namespace v8_inspector #endif /* Atomics_h */ diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/DebuggerScript.js b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/DebuggerScript.js index cd9a2bd56dd860..18beac0e03ceea 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/DebuggerScript.js +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/DebuggerScript.js @@ -45,11 +45,14 @@ Debug.clearBreakOnException(); Debug.clearBreakOnUncaughtException(); /** - * @param {!CompileEvent} eventData + * @param {?CompileEvent} eventData */ DebuggerScript.getAfterCompileScript = function(eventData) { - return DebuggerScript._formatScript(eventData.script().value()); + var script = eventData.script().value(); + if (!script.is_debugger_script) + return DebuggerScript._formatScript(eventData.script().value()); + return null; } /** @type {!Map} */ @@ -180,6 +183,8 @@ DebuggerScript.getScripts = function(contextGroupId) if (script.context_data.indexOf(contextDataPrefix) !== 0) continue; } + if (script.is_debugger_script) + continue; result.push(DebuggerScript._formatScript(script)); } return result; @@ -217,8 +222,7 @@ DebuggerScript._formatScript = function(script) endColumn: endColumn, executionContextId: DebuggerScript._executionContextId(script.context_data), // Note that we cannot derive aux data from context id because of compilation cache. - executionContextAuxData: DebuggerScript._executionContextAuxData(script.context_data), - isInternalScript: script.is_debugger_script + executionContextAuxData: DebuggerScript._executionContextAuxData(script.context_data) }; } @@ -229,9 +233,7 @@ DebuggerScript._formatScript = function(script) */ DebuggerScript.setBreakpoint = function(execState, info) { - var positionAlignment = info.interstatementLocation ? Debug.BreakPositionAlignment.BreakPosition : Debug.BreakPositionAlignment.Statement; - var breakId = Debug.setScriptBreakPointById(info.sourceID, info.lineNumber, info.columnNumber, info.condition, undefined, positionAlignment); - + var breakId = Debug.setScriptBreakPointById(info.sourceID, info.lineNumber, info.columnNumber, info.condition, undefined, Debug.BreakPositionAlignment.Statement); var locations = Debug.findBreakPointActualLocations(breakId); if (!locations.length) return undefined; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.cpp index 3b4552ee8d9147..dfe5b923be1ba9 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.cpp @@ -30,9 +30,6 @@ #include "platform/v8_inspector/InjectedScript.h" -#include "platform/inspector_protocol/Parser.h" -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/InjectedScriptNative.h" #include "platform/v8_inspector/InjectedScriptSource.h" #include "platform/v8_inspector/InspectedContext.h" @@ -54,7 +51,7 @@ using blink::protocol::Runtime::InternalPropertyDescriptor; using blink::protocol::Runtime::RemoteObject; using blink::protocol::Maybe; -namespace blink { +namespace v8_inspector { static bool hasInternalError(ErrorString* errorString, bool hasError) { @@ -120,7 +117,7 @@ void InjectedScript::getProperties(ErrorString* errorString, v8::Localisolate()); v8::Local resultValue = function.callWithoutExceptionHandling(); if (tryCatch.HasCaught()) { - *exceptionDetails = createExceptionDetails(tryCatch.Message()); + *exceptionDetails = createExceptionDetails(errorString, tryCatch, groupName, generatePreview); // FIXME: make properties optional *properties = Array::create(); return; @@ -303,22 +300,35 @@ v8::MaybeLocal InjectedScript::resolveCallArgument(ErrorString* error return v8::Undefined(m_context->isolate()); } -std::unique_ptr InjectedScript::createExceptionDetails(v8::Local message) +std::unique_ptr InjectedScript::createExceptionDetails(ErrorString* errorString, const v8::TryCatch& tryCatch, const String16& objectGroup, bool generatePreview) { - std::unique_ptr exceptionDetailsObject = protocol::Runtime::ExceptionDetails::create() - .setText(toProtocolString(message->Get())) - .setScriptId(String16::fromInteger(message->GetScriptOrigin().ScriptID()->Value())) - .setLineNumber(message->GetLineNumber(m_context->context()).FromMaybe(1) - 1) - .setColumnNumber(message->GetStartColumn(m_context->context()).FromMaybe(0)) + if (!tryCatch.HasCaught()) + return nullptr; + v8::Local message = tryCatch.Message(); + v8::Local exception = tryCatch.Exception(); + String16 messageText = message.IsEmpty() ? String16() : toProtocolString(message->Get()); + std::unique_ptr exceptionDetails = protocol::Runtime::ExceptionDetails::create() + .setExceptionId(m_context->inspector()->nextExceptionId()) + .setText(exception.IsEmpty() ? messageText : String16("Uncaught")) + .setLineNumber(message.IsEmpty() ? 0 : message->GetLineNumber(m_context->context()).FromMaybe(1) - 1) + .setColumnNumber(message.IsEmpty() ? 0 : message->GetStartColumn(m_context->context()).FromMaybe(0)) .build(); - - v8::Local stackTrace = message->GetStackTrace(); - if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) - exceptionDetailsObject->setStackTrace(m_context->inspector()->debugger()->createStackTrace(stackTrace)->buildInspectorObjectImpl()); - return exceptionDetailsObject; + if (!message.IsEmpty()) { + exceptionDetails->setScriptId(String16::fromInteger(message->GetScriptOrigin().ScriptID()->Value())); + v8::Local stackTrace = message->GetStackTrace(); + if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) + exceptionDetails->setStackTrace(m_context->inspector()->debugger()->createStackTrace(stackTrace)->buildInspectorObjectImpl()); + } + if (!exception.IsEmpty()) { + std::unique_ptr wrapped = wrapObject(errorString, exception, objectGroup, false /* forceValueType */, generatePreview && !exception->IsNativeError()); + if (!wrapped) + return nullptr; + exceptionDetails->setException(std::move(wrapped)); + } + return exceptionDetails; } -void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal maybeResultValue, const v8::TryCatch& tryCatch, const String16& objectGroup, bool returnByValue, bool generatePreview, std::unique_ptr* result, Maybe* wasThrown, Maybe* exceptionDetails) +void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal maybeResultValue, const v8::TryCatch& tryCatch, const String16& objectGroup, bool returnByValue, bool generatePreview, std::unique_ptr* result, Maybe* exceptionDetails) { v8::Local resultValue; if (!tryCatch.HasCaught()) { @@ -330,18 +340,14 @@ void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal if (objectGroup == "console") m_lastEvaluationResult.Reset(m_context->isolate(), resultValue); *result = std::move(remoteObject); - if (wasThrown) - *wasThrown = false; } else { v8::Local exception = tryCatch.Exception(); std::unique_ptr remoteObject = wrapObject(errorString, exception, objectGroup, false, generatePreview && !exception->IsNativeError()); if (!remoteObject) return; + // We send exception in result for compatibility reasons, even though it's accessible through exceptionDetails.exception. *result = std::move(remoteObject); - if (exceptionDetails) - *exceptionDetails = createExceptionDetails(tryCatch.Message()); - if (wasThrown) - *wasThrown = true; + *exceptionDetails = createExceptionDetails(errorString, tryCatch, objectGroup, generatePreview); } } @@ -494,4 +500,4 @@ void InjectedScript::CallFrameScope::findInjectedScript(V8InspectorSessionImpl* m_injectedScript = session->findInjectedScript(m_errorString, remoteId.get()); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.h index b65a857eb90fe6..9c674d313eb629 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScript.h @@ -31,8 +31,7 @@ #ifndef InjectedScript_h #define InjectedScript_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/Platform.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/InjectedScriptNative.h" #include "platform/v8_inspector/InspectedContext.h" #include "platform/v8_inspector/V8Console.h" @@ -41,18 +40,15 @@ #include -namespace blink { +namespace v8_inspector { class RemoteObjectId; class V8FunctionCall; class V8InspectorImpl; class V8InspectorSessionImpl; -namespace protocol { -class DictionaryValue; -} - -using protocol::Maybe; +namespace protocol = blink::protocol; +using blink::protocol::Maybe; class InjectedScript final { PROTOCOL_DISALLOW_COPY(InjectedScript); @@ -77,7 +73,7 @@ class InjectedScript final { void setCustomObjectFormatterEnabled(bool); v8::MaybeLocal resolveCallArgument(ErrorString*, protocol::Runtime::CallArgument*); - std::unique_ptr createExceptionDetails(v8::Local); + std::unique_ptr createExceptionDetails(ErrorString*, const v8::TryCatch&, const String16& groupName, bool generatePreview); void wrapEvaluateResult(ErrorString*, v8::MaybeLocal maybeResultValue, const v8::TryCatch&, @@ -85,7 +81,6 @@ class InjectedScript final { bool returnByValue, bool generatePreview, std::unique_ptr* result, - Maybe* wasThrown, Maybe*); v8::Local lastEvaluationResult() const; @@ -171,6 +166,6 @@ class InjectedScript final { v8::Global m_commandLineAPI; }; -} // namespace blink +} // namespace v8_inspector #endif diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.cpp index 4f0eff93c41aaa..44f1c8b97d9182 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.cpp @@ -4,9 +4,7 @@ #include "platform/v8_inspector/InjectedScriptNative.h" -#include "platform/inspector_protocol/Values.h" - -namespace blink { +namespace v8_inspector { InjectedScriptNative::InjectedScriptNative(v8::Isolate* isolate) : m_lastBoundObjectId(1) @@ -90,5 +88,5 @@ String16 InjectedScriptNative::groupName(int objectId) const return iterator != m_idToObjectGroupName.end() ? iterator->second : String16(); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.h index c8082fe95edd61..036939366e0b50 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptNative.h @@ -5,14 +5,14 @@ #ifndef InjectedScriptNative_h #define InjectedScriptNative_h -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include #include -namespace blink { +namespace v8_inspector { + +namespace protocol = blink::protocol; class InjectedScriptNative final { public: @@ -41,6 +41,6 @@ class InjectedScriptNative final { NameToObjectGroup m_nameToObjectGroup; }; -} // namespace blink +} // namespace v8_inspector #endif diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptSource.js b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptSource.js index 7e8b2cb41ba437..92457fdfbdc068 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptSource.js +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InjectedScriptSource.js @@ -171,7 +171,7 @@ function doesAttributeHaveObservableSideEffectOnGet(object, attribute) { for (var interfaceName in domAttributesWithObservableSideEffectOnGet) { var interfaceFunction = inspectedGlobalObject[interfaceName]; - // instanceof call looks safe after typeof check. + // Call to instanceOf looks safe after typeof check. var isInstance = typeof interfaceFunction === "function" && /* suppressBlacklist */ object instanceof interfaceFunction; if (isInstance) return attribute in domAttributesWithObservableSideEffectOnGet[interfaceName]; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.cpp index 16e0f02732265b..f2bf9527696a53 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.cpp @@ -11,7 +11,7 @@ #include "platform/v8_inspector/public/V8ContextInfo.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { void InspectedContext::weakCallback(const v8::WeakCallbackInfo& data) { @@ -79,4 +79,4 @@ void InspectedContext::discardInjectedScript() m_injectedScript.reset(); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.h index 421d3dfe03a419..fcb8af6c01fc75 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/InspectedContext.h @@ -5,18 +5,18 @@ #ifndef InspectedContext_h #define InspectedContext_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class InjectedScript; class InjectedScriptHost; class V8ContextInfo; class V8InspectorImpl; +namespace protocol = blink::protocol; + class InspectedContext { PROTOCOL_DISALLOW_COPY(InspectedContext); public: @@ -57,6 +57,6 @@ class InspectedContext { v8::Global m_console; }; -} // namespace blink +} // namespace v8_inspector #endif diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.cpp index 8bcc475f401d72..573b14a9e8c20b 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.cpp @@ -35,7 +35,7 @@ #include -namespace blink { +namespace v8_inspector { JavaScriptCallFrame::JavaScriptCallFrame(v8::Local debuggerContext, v8::Local callFrame) : m_isolate(debuggerContext->GetIsolate()) @@ -130,4 +130,4 @@ v8::MaybeLocal JavaScriptCallFrame::setVariableValue(int scopeNumber, return setVariableValueFunction->Call(m_debuggerContext.Get(m_isolate), callFrame, PROTOCOL_ARRAY_LENGTH(argv), argv); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.h index 959f8172ee31da..d9a3e6accd5212 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/JavaScriptCallFrame.h @@ -31,14 +31,14 @@ #ifndef JavaScriptCallFrame_h #define JavaScriptCallFrame_h -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include #include -namespace blink { +namespace v8_inspector { + +namespace protocol = blink::protocol; class JavaScriptCallFrame { public: @@ -71,6 +71,6 @@ class JavaScriptCallFrame { using JavaScriptCallFrames = std::vector>; -} // namespace blink +} // namespace v8_inspector #endif // JavaScriptCallFrame_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/PlatformSTL.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/PlatformSTL.h similarity index 90% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/PlatformSTL.h rename to deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/PlatformSTL.h index 33ca199b1f4e3b..bfba971e698add 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/PlatformSTL.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/PlatformSTL.h @@ -158,7 +158,7 @@ template class unique_ptr { static T* hashTableDeletedValue() { return reinterpret_cast(-1); } - explicit unique_ptr(PtrType ptr) : m_ptr(ptr) {} + explicit unique_ptr(PtrType ptr) : m_ptr(ptr) {} // NOLINT private: PtrType internalRelease() const @@ -202,12 +202,12 @@ template inline typename unique_ptr::ValueType& unique_ptr::o return m_ptr[i]; } -template inline unique_ptr::unique_ptr(const unique_ptr& o) +template inline unique_ptr::unique_ptr(const unique_ptr& o) // NOLINT : m_ptr(o.internalRelease()) { } -template inline unique_ptr::unique_ptr(unique_ptr&& o) +template inline unique_ptr::unique_ptr(unique_ptr&& o) // NOLINT : m_ptr(o.internalRelease()) { } @@ -289,4 +289,29 @@ std::unique_ptr wrapUnique(T* ptr) return std::unique_ptr(ptr); } +// emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer +// on overflow... +// VS 2015 added a standard conform snprintf +#if defined(_WIN32) && defined( _MSC_VER ) && (_MSC_VER < 1900) +#include +namespace std { + +inline static int snprintf(char *buffer, size_t n, const char *format, ...) +{ + va_list argp; + va_start(argp, format); + int ret = _vscprintf(format, argp); + vsnprintf_s(buffer, n, _TRUNCATE, format, argp); + va_end(argp); + return ret; +} +} // namespace std +#endif // (_WIN32) && defined( _MSC_VER ) && (_MSC_VER < 1900) + +#ifdef __sun +namespace std { +using ::snprintf; +} // namespace std +#endif // __sun + #endif // PlatformSTL_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/PlatformWTF.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/PlatformWTF.h similarity index 100% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/PlatformWTF.h rename to deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/PlatformWTF.h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.cpp index e9aaf26d51e028..ccdd5bef101264 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.cpp @@ -4,11 +4,7 @@ #include "platform/v8_inspector/RemoteObjectId.h" -#include "platform/inspector_protocol/Parser.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/Values.h" - -namespace blink { +namespace v8_inspector { RemoteObjectIdBase::RemoteObjectIdBase() : m_injectedScriptId(0) { } @@ -69,4 +65,4 @@ String16 RemoteCallFrameId::serialize(int injectedScriptId, int frameOrdinal) return "{\"ordinal\":" + String16::fromInteger(frameOrdinal) + ",\"injectedScriptId\":" + String16::fromInteger(injectedScriptId) + "}"; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.h index af3c4b801f12a8..128326ab4bcd0e 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/RemoteObjectId.h @@ -5,15 +5,11 @@ #ifndef RemoteObjectId_h #define RemoteObjectId_h -#include "platform/inspector_protocol/ErrorSupport.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" -namespace blink { +namespace v8_inspector { -namespace protocol { -class DictionaryValue; -} +namespace protocol = blink::protocol; class RemoteObjectIdBase { public: @@ -54,6 +50,6 @@ class RemoteCallFrameId final : public RemoteObjectIdBase { int m_frameOrdinal; }; -} // namespace blink +} // namespace v8_inspector #endif // !defined(RemoteObjectId_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/ScriptBreakpoint.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/ScriptBreakpoint.h index 6b2db214985c85..52e8f995aa7fb2 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/ScriptBreakpoint.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/ScriptBreakpoint.h @@ -30,10 +30,11 @@ #ifndef ScriptBreakpoint_h #define ScriptBreakpoint_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" -namespace blink { +namespace v8_inspector { + +namespace protocol = blink::protocol; struct ScriptBreakpoint { ScriptBreakpoint() : ScriptBreakpoint(0, 0, String16()) { } @@ -50,6 +51,6 @@ struct ScriptBreakpoint { String16 condition; }; -} // namespace blink +} // namespace v8_inspector #endif // !defined(ScriptBreakpoint_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.cpp similarity index 69% rename from deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.cpp rename to deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.cpp index 10c7fa61017dd7..990932d47f18c6 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/inspector_protocol/String16STL.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.cpp @@ -2,116 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "platform/inspector_protocol/String16STL.h" - -#include "platform/inspector_protocol/Platform.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include #include #include -#include #include namespace blink { namespace protocol { const UChar replacementCharacter = 0xFFFD; - -template inline bool isASCII(CharType c) -{ - return !(c & ~0x7F); -} - -template inline bool isASCIIAlpha(CharType c) -{ - return (c | 0x20) >= 'a' && (c | 0x20) <= 'z'; -} - -template inline bool isASCIIDigit(CharType c) -{ - return c >= '0' && c <= '9'; -} - -template inline bool isASCIIAlphanumeric(CharType c) -{ - return isASCIIDigit(c) || isASCIIAlpha(c); -} - -template inline bool isASCIIHexDigit(CharType c) -{ - return isASCIIDigit(c) || ((c | 0x20) >= 'a' && (c | 0x20) <= 'f'); -} - -template inline bool isASCIIOctalDigit(CharType c) -{ - return (c >= '0') & (c <= '7'); -} - -template inline bool isASCIIPrintable(CharType c) -{ - return c >= ' ' && c <= '~'; -} - -/* - Statistics from a run of Apple's page load test for callers of isASCIISpace: - - character count - --------- ----- - non-spaces 689383 - 20 space 294720 - 0A \n 89059 - 09 \t 28320 - 0D \r 0 - 0C \f 0 - 0B \v 0 - */ -template inline bool isASCIISpace(CharType c) -{ - return c <= ' ' && (c == ' ' || (c <= 0xD && c >= 0x9)); -} - -extern const LChar ASCIICaseFoldTable[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff -}; - -template inline int toASCIIHexValue(CharType c) -{ - DCHECK(isASCIIHexDigit(c)); - return c < 'A' ? c - '0' : (c - 'A' + 10) & 0xF; -} - -template inline int toASCIIHexValue(CharType upperValue, CharType lowerValue) -{ - DCHECK(isASCIIHexDigit(upperValue) && isASCIIHexDigit(lowerValue)); - return ((toASCIIHexValue(upperValue) << 4) & 0xF0) | toASCIIHexValue(lowerValue); -} - -inline char lowerNibbleToASCIIHexDigit(char c) -{ - char nibble = c & 0xF; - return nibble < 10 ? '0' + nibble : 'A' + nibble - 10; -} - -inline char upperNibbleToASCIIHexDigit(char c) -{ - char nibble = (c >> 4) & 0xF; - return nibble < 10 ? '0' + nibble : 'A' + nibble - 10; -} +using UChar32 = uint32_t; inline int inlineUTF8SequenceLengthNonASCII(char b0) { @@ -128,7 +30,7 @@ inline int inlineUTF8SequenceLengthNonASCII(char b0) inline int inlineUTF8SequenceLength(char b0) { - return isASCII(b0) ? 1 : inlineUTF8SequenceLengthNonASCII(b0); + return String16::isASCII(b0) ? 1 : inlineUTF8SequenceLengthNonASCII(b0); } // Once the bits are split out into bytes of UTF-8, this is a mask OR-ed @@ -145,48 +47,6 @@ typedef enum { sourceIllegal // source sequence is illegal/malformed } ConversionResult; -ConversionResult convertLatin1ToUTF8( - const LChar** sourceStart, const LChar* sourceEnd, - char** targetStart, char* targetEnd) -{ - ConversionResult result = conversionOK; - const LChar* source = *sourceStart; - char* target = *targetStart; - while (source < sourceEnd) { - UChar32 ch; - unsigned short bytesToWrite = 0; - const UChar32 byteMask = 0xBF; - const UChar32 byteMark = 0x80; - const LChar* oldSource = source; // In case we have to back up because of target overflow. - ch = static_cast(*source++); - - // Figure out how many bytes the result will require - if (ch < (UChar32)0x80) - bytesToWrite = 1; - else - bytesToWrite = 2; - - target += bytesToWrite; - if (target > targetEnd) { - source = oldSource; // Back up source pointer! - target -= bytesToWrite; - result = targetExhausted; - break; - } - switch (bytesToWrite) { // note: everything falls through. - case 2: - *--target = (char)((ch | byteMark) & byteMask); - ch >>= 6; - case 1: - *--target = (char)(ch | firstByteMark[bytesToWrite]); - } - target += bytesToWrite; - } - *sourceStart = source; - *targetStart = target; - return result; -} - ConversionResult convertUTF16ToUTF8( const UChar** sourceStart, const UChar* sourceEnd, char** targetStart, char* targetEnd, bool strict) @@ -495,42 +355,6 @@ String16 String16::fromUTF8(const char* stringStart, size_t length) return String16(bufferStart, utf16Length); } -// trim from start -static inline wstring <rim(wstring &s) -{ - s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); - return s; -} - -// trim from end -static inline wstring &rtrim(wstring &s) -{ - s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); - return s; -} - -// trim from both ends -static inline wstring &trim(wstring &s) -{ - return ltrim(rtrim(s)); -} - -// static -std::string String16::intToString(int i) -{ - char buffer[50]; - std::sprintf(buffer, "%d", i); - return std::string(buffer); -} - -// static -std::string String16::doubleToString(double d) -{ - char buffer[100]; - std::sprintf(buffer, "%f", d); - return std::string(buffer); -} - std::string String16::utf8() const { unsigned length = this->length(); @@ -577,12 +401,5 @@ std::string String16::utf8() const return std::string(bufferVector.data(), buffer - bufferVector.data()); } -String16 String16::stripWhiteSpace() const -{ - wstring result(m_impl); - trim(result); - return result; -} - } // namespace protocol } // namespace blink diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.h new file mode 100644 index 00000000000000..ffde6c72f52afd --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16STL.h @@ -0,0 +1,104 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef String16STL_h +#define String16STL_h + +#include +#include +#include +#include +#include +#include +#include + +using UChar = uint16_t; + +namespace blink { +namespace protocol { + +class String16 : public String16Base { +public: + static const size_t kNotFound = static_cast(-1); + + String16() { } + String16(const String16& other) : m_impl(other.m_impl) { } + String16(const UChar* characters, size_t size) : m_impl(characters, size) { } + String16(const UChar* characters) : m_impl(characters) { } + String16(const char* characters) : String16(characters, std::strlen(characters)) { } + String16(const char* characters, size_t size) + { + m_impl.resize(size); + for (size_t i = 0; i < size; ++i) + m_impl[i] = characters[i]; + } + + String16 isolatedCopy() const { return String16(m_impl); } + const UChar* characters16() const { return m_impl.c_str(); } + size_t length() const { return m_impl.length(); } + bool isEmpty() const { return !m_impl.length(); } + UChar operator[](unsigned index) const { return m_impl[index]; } + String16 substring(unsigned pos, unsigned len = UINT_MAX) const { return String16(m_impl.substr(pos, len)); } + size_t find(const String16& str, unsigned start = 0) const { return m_impl.find(str.m_impl, start); } + size_t reverseFind(const String16& str, unsigned start = UINT_MAX) const { return m_impl.rfind(str.m_impl, start); } + + // Convenience methods. + std::string utf8() const; + static String16 fromUTF8(const char* stringStart, size_t length); + + const std::basic_string& impl() const { return m_impl; } + explicit String16(const std::basic_string& impl) : m_impl(impl) { } + + std::size_t hash() const + { + if (!has_hash) { + size_t hash = 0; + for (size_t i = 0; i < length(); ++i) + hash = 31 * hash + m_impl[i]; + hash_code = hash; + has_hash = true; + } + return hash_code; + } + +private: + std::basic_string m_impl; + mutable bool has_hash = false; + mutable std::size_t hash_code = 0; +}; + +inline bool operator==(const String16& a, const String16& b) { return a.impl() == b.impl(); } +inline bool operator<(const String16& a, const String16& b) { return a.impl() < b.impl(); } +inline bool operator!=(const String16& a, const String16& b) { return a.impl() != b.impl(); } +inline bool operator==(const String16& a, const char* b) { return a.impl() == String16(b).impl(); } +inline String16 operator+(const String16& a, const char* b) { return String16(a.impl() + String16(b).impl()); } +inline String16 operator+(const char* a, const String16& b) { return String16(String16(a).impl() + b.impl()); } +inline String16 operator+(const String16& a, const String16& b) { return String16(a.impl() + b.impl()); } + +} // namespace protocol +} // namespace blink + +#if !defined(__APPLE__) || defined(_LIBCPP_VERSION) + +namespace std { +template<> struct hash { + std::size_t operator()(const blink::protocol::String16& string) const + { + return string.hash(); + } +}; + +} // namespace std + +#endif // !defined(__APPLE__) || defined(_LIBCPP_VERSION) + +class InspectorProtocolConvenienceStringType { +public: + // This class should not be ever instantiated, so we don't implement constructors. + InspectorProtocolConvenienceStringType(); + InspectorProtocolConvenienceStringType(const blink::protocol::String16& other); + operator blink::protocol::String16() const { return blink::protocol::String16(); }; +}; + +#endif // !defined(String16STL_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16WTF.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16WTF.h new file mode 100644 index 00000000000000..b65383a3cfa0b6 --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/String16WTF.h @@ -0,0 +1,111 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef String16WTF_h +#define String16WTF_h + +#include "platform/Decimal.h" +#include "public/platform/WebString.h" +#include "wtf/text/StringBuilder.h" +#include "wtf/text/StringConcatenate.h" +#include "wtf/text/StringHash.h" +#include "wtf/text/StringToNumber.h" +#include "wtf/text/StringView.h" +#include "wtf/text/WTFString.h" + +namespace blink { +namespace protocol { + +class PLATFORM_EXPORT String16 : public String16Base { +public: + static const size_t kNotFound = WTF::kNotFound; + + String16() { } + String16(const String16& other) : m_impl(other.m_impl) { } + String16(const UChar* characters, unsigned length) : m_impl(characters, length) { } + String16(const char* characters) : String16(characters, strlen(characters)) { } + String16(const char* characters, size_t length) + { + UChar* data; + m_impl = WTF::String::createUninitialized(length, data); + for (size_t i = 0; i < length; ++i) + data[i] = characters[i]; + } + + ~String16() { } + + String16 isolatedCopy() const { return String16(m_impl.isolatedCopy()); } + const UChar* characters16() const { return m_impl.isEmpty() ? nullptr : m_impl.characters16(); } + size_t length() const { return m_impl.length(); } + bool isEmpty() const { return m_impl.isEmpty(); } + UChar operator[](unsigned index) const { return m_impl[index]; } + String16 substring(unsigned pos, unsigned len = UINT_MAX) const { return m_impl.substring(pos, len); } + size_t find(const String16& str, unsigned start = 0) const { return m_impl.find(str.impl(), start); } + size_t reverseFind(const String16& str, unsigned start = UINT_MAX) const { return m_impl.reverseFind(str.impl(), start); } + + // WTF convenience constructors and helper methods. + String16(const WebString& other) : String16(String(other)) { } + template + String16(const WTF::StringAppend& impl) : String16(String(impl)) { } + String16(const WTF::AtomicString& impl) : String16(String(impl)) { } + String16(const WTF::String& impl) : m_impl(impl) { m_impl.ensure16Bit(); } + String16(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { } + bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); } + operator WTF::String() const { return m_impl; } + operator WTF::StringView() const { return StringView(m_impl); } + operator WebString() { return m_impl; } + const WTF::String& impl() const { return m_impl; } + +private: + WTF::String m_impl; +}; + +inline bool operator==(const String16& a, const String16& b) { return a.impl() == b.impl(); } +inline bool operator!=(const String16& a, const String16& b) { return a.impl() != b.impl(); } +inline bool operator==(const String16& a, const char* b) { return a.impl() == b; } +inline String16 operator+(const String16& a, const char* b) { return String16(a.impl() + b); } +inline String16 operator+(const char* a, const String16& b) { return String16(a + b.impl()); } +inline String16 operator+(const String16& a, const String16& b) { return String16(a.impl() + b.impl()); } + +} // namespace protocol +} // namespace blink + +namespace std { +template<> struct hash { + std::size_t operator()(const blink::protocol::String16& string) const + { + return StringHash::hash(string.impl()); + } +}; +} // namespace std + +using InspectorProtocolConvenienceStringType = WTF::String; + +// WTF helpers below this line. + +namespace WTF { + +struct String16Hash { + static unsigned hash(const blink::protocol::String16& key) { return StringHash::hash(key.impl()); } + static bool equal(const blink::protocol::String16& a, const blink::protocol::String16& b) + { + return StringHash::equal(a.impl(), b.impl()); + } + static const bool safeToCompareToEmptyOrDeleted = false; +}; + +template struct DefaultHash; +template<> struct DefaultHash { + typedef String16Hash Hash; +}; + +template<> +struct HashTraits : SimpleClassHashTraits { + static const bool hasIsEmptyValueFunction = true; + static bool isEmptyValue(const blink::protocol::String16& a) { return a.impl().isNull(); } +}; + +} // namespace WTF + +#endif // !defined(String16WTF_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.cpp index 1bd738a8660aea..73a90e225e11ae 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.cpp @@ -4,8 +4,6 @@ #include "platform/v8_inspector/V8Console.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" #include "platform/v8_inspector/InjectedScript.h" #include "platform/v8_inspector/InspectedContext.h" #include "platform/v8_inspector/V8Compat.h" @@ -19,7 +17,7 @@ #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { namespace { @@ -439,7 +437,7 @@ static void timeEndFunction(const v8::FunctionCallbackInfo& info, boo if (!helper.privateMap("V8Console#timeMap").ToLocal(&timeMap)) return; double elapsed = client->currentTimeMS() - helper.getDoubleFromMap(timeMap, protocolTitle, 0.0); - String16 message = protocolTitle + ": " + String16::fromDoubleFixedPrecision(elapsed, 3) + "ms"; + String16 message = protocolTitle + ": " + String16::fromDoublePrecision3(elapsed) + "ms"; helper.reportCallWithArgument(ConsoleAPIType::kTimeEnd, message); } } @@ -661,6 +659,8 @@ v8::Local V8Console::createConsole(InspectedContext* inspectedContex v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local console = v8::Object::New(isolate); + bool success = console->SetPrototype(context, v8::Object::New(isolate)).FromMaybe(false); + DCHECK(success); createBoundFunctionProperty(context, console, "debug", V8Console::debugCallback); createBoundFunctionProperty(context, console, "error", V8Console::errorCallback); @@ -686,9 +686,6 @@ v8::Local V8Console::createConsole(InspectedContext* inspectedContex createBoundFunctionProperty(context, console, "timeEnd", V8Console::timeEndCallback); createBoundFunctionProperty(context, console, "timeStamp", V8Console::timeStampCallback); - bool success = console->SetPrototype(context, v8::Object::New(isolate)).FromMaybe(false); - DCHECK(success); - if (hasMemoryAttribute) console->SetAccessorProperty(toV8StringInternalized(isolate, "memory"), V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, V8Console::memoryGetterCallback, console, 0).ToLocalChecked(), V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, V8Console::memorySetterCallback, v8::Local(), 0).ToLocalChecked(), static_cast(v8::None), v8::DEFAULT); @@ -709,6 +706,8 @@ v8::Local V8Console::createCommandLineAPI(InspectedContext* inspecte v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); v8::Local commandLineAPI = v8::Object::New(isolate); + bool success = commandLineAPI->SetPrototype(context, v8::Null(isolate)).FromMaybe(false); + DCHECK(success); createBoundFunctionProperty(context, commandLineAPI, "dir", V8Console::dirCallback, "function dir(value) { [Command Line API] }"); createBoundFunctionProperty(context, commandLineAPI, "dirxml", V8Console::dirxmlCallback, "function dirxml(value) { [Command Line API] }"); @@ -829,4 +828,4 @@ V8Console::CommandLineAPIScope::~CommandLineAPIScope() } } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.h index b539f4c0ad03ed..757a5e43789ff2 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Console.h @@ -5,13 +5,15 @@ #ifndef V8Console_h #define V8Console_h -#include "platform/inspector_protocol/Allocator.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class InspectedContext; +namespace protocol = blink::protocol; + // Console API // https://console.spec.whatwg.org/#console-interface class V8Console { @@ -84,6 +86,6 @@ class V8Console { static void inspectedObject4(const v8::FunctionCallbackInfo& info) { inspectedObject(info, 4); } }; -} // namespace blink +} // namespace v8_inspector #endif // V8Console_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.cpp index 0292dbb4ca6ba6..820b254c939983 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.cpp @@ -9,7 +9,7 @@ #include "platform/v8_inspector/V8InspectorSessionImpl.h" #include "platform/v8_inspector/V8StackTraceImpl.h" -namespace blink { +namespace v8_inspector { namespace ConsoleAgentState { static const char consoleEnabled[] = "consoleEnabled"; @@ -85,4 +85,4 @@ void V8ConsoleAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP m_frontend.flush(); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.h index bc897ac352e289..0381394ff3f776 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleAgentImpl.h @@ -5,15 +5,16 @@ #ifndef V8ConsoleAgentImpl_h #define V8ConsoleAgentImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Console.h" -namespace blink { +namespace v8_inspector { class V8ConsoleMessage; class V8InspectorSessionImpl; +namespace protocol = blink::protocol; + class V8ConsoleAgentImpl : public protocol::Console::Backend { PROTOCOL_DISALLOW_COPY(V8ConsoleAgentImpl); public: @@ -39,7 +40,7 @@ class V8ConsoleAgentImpl : public protocol::Console::Backend { bool m_enabled; }; -} // namespace blink +} // namespace v8_inspector #endif // !defined(V8ConsoleAgentImpl_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.cpp index 84bcc3d6e54df6..160ec7417df6b9 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.cpp @@ -13,7 +13,7 @@ #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { namespace { @@ -84,7 +84,7 @@ class V8ValueStringBuilder { if (value->IsSymbolObject()) return append(v8::Local::Cast(value)->ValueOf()); if (value->IsNumberObject()) { - m_builder.appendNumber(v8::Local::Cast(value)->ValueOf()); + m_builder.append(String16::fromDoublePrecision6(v8::Local::Cast(value)->ValueOf())); return true; } if (value->IsBooleanObject()) { @@ -203,10 +203,19 @@ void V8ConsoleMessage::setLocation(const String16& url, unsigned lineNumber, uns void V8ConsoleMessage::reportToFrontend(protocol::Console::Frontend* frontend) const { DCHECK(m_origin == V8MessageOrigin::kConsole); + String16 level = protocol::Console::ConsoleMessage::LevelEnum::Log; + if (m_type == ConsoleAPIType::kDebug || m_type == ConsoleAPIType::kCount || m_type == ConsoleAPIType::kTimeEnd) + level = protocol::Console::ConsoleMessage::LevelEnum::Debug; + else if (m_type == ConsoleAPIType::kError || m_type == ConsoleAPIType::kAssert) + level = protocol::Console::ConsoleMessage::LevelEnum::Error; + else if (m_type == ConsoleAPIType::kWarning) + level = protocol::Console::ConsoleMessage::LevelEnum::Warning; + else if (m_type == ConsoleAPIType::kInfo) + level = protocol::Console::ConsoleMessage::LevelEnum::Info; std::unique_ptr result = protocol::Console::ConsoleMessage::create() .setSource(protocol::Console::ConsoleMessage::SourceEnum::ConsoleApi) - .setLevel(protocol::Console::ConsoleMessage::LevelEnum::Log) + .setLevel(level) .setText(m_message) .build(); result->setLine(static_cast(m_lineNumber)); @@ -253,22 +262,23 @@ void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V { if (m_origin == V8MessageOrigin::kException) { std::unique_ptr exception = wrapException(session, generatePreview); - // TODO(dgozman): unify with InjectedScript::createExceptionDetails. - std::unique_ptr details = protocol::Runtime::ExceptionDetails::create() + std::unique_ptr exceptionDetails = protocol::Runtime::ExceptionDetails::create() + .setExceptionId(m_exceptionId) .setText(exception ? m_message : m_detailedMessage) .setLineNumber(m_lineNumber ? m_lineNumber - 1 : 0) .setColumnNumber(m_columnNumber ? m_columnNumber - 1 : 0) - .setScriptId(m_scriptId ? String16::fromInteger(m_scriptId) : String16()) .build(); + if (m_scriptId) + exceptionDetails->setScriptId(String16::fromInteger(m_scriptId)); if (!m_url.isEmpty()) - details->setUrl(m_url); + exceptionDetails->setUrl(m_url); if (m_stackTrace) - details->setStackTrace(m_stackTrace->buildInspectorObjectImpl()); - + exceptionDetails->setStackTrace(m_stackTrace->buildInspectorObjectImpl()); + if (m_contextId) + exceptionDetails->setExecutionContextId(m_contextId); if (exception) - frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(details), std::move(exception), m_contextId); - else - frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(details)); + exceptionDetails->setException(std::move(exception)); + frontend->exceptionThrown(m_timestamp, std::move(exceptionDetails)); return; } if (m_origin == V8MessageOrigin::kRevokedException) { @@ -430,4 +440,4 @@ void V8ConsoleMessageStorage::contextDestroyed(int contextId) m_messages[i]->contextDestroyed(contextId); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.h index 9c26f5d9e8f3ea..941b61609a1401 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ConsoleMessage.h @@ -5,20 +5,21 @@ #ifndef V8ConsoleMessage_h #define V8ConsoleMessage_h -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Console.h" #include "platform/v8_inspector/protocol/Runtime.h" #include #include -namespace blink { +namespace v8_inspector { class InspectedContext; class V8InspectorImpl; class V8InspectorSessionImpl; class V8StackTraceImpl; +namespace protocol = blink::protocol; + enum class V8MessageOrigin { kConsole, kException, kRevokedException }; enum class ConsoleAPIType { kLog, kDebug, kInfo, kError, kWarning, kDir, kDirXML, kTable, kTrace, kStartGroup, kStartGroupCollapsed, kEndGroup, kClear, kAssert, kTimeEnd, kCount }; @@ -103,6 +104,6 @@ class V8ConsoleMessageStorage { std::deque> m_messages; }; -} // namespace blink +} // namespace v8_inspector #endif // V8ConsoleMessage_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.cpp index a7ebd019f94903..65fa210a14eccf 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.cpp @@ -12,9 +12,10 @@ #include "platform/v8_inspector/V8InternalValueType.h" #include "platform/v8_inspector/V8StackTraceImpl.h" #include "platform/v8_inspector/V8StringUtil.h" +#include "platform/v8_inspector/V8ValueCopier.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { namespace { const char stepIntoV8MethodName[] = "stepIntoStatement"; @@ -28,7 +29,7 @@ inline v8::Local v8Boolean(bool value, v8::Isolate* isolate) return value ? v8::True(isolate) : v8::False(isolate); } -} +} // namespace static bool inLiveEditScope = false; @@ -95,12 +96,12 @@ int V8Debugger::contextId(v8::Local context) if (dataString.isEmpty()) return 0; size_t commaPos = dataString.find(","); - if (commaPos == kNotFound) + if (commaPos == String16::kNotFound) return 0; size_t commaPos2 = dataString.find(",", commaPos + 1); - if (commaPos2 == kNotFound) + if (commaPos2 == String16::kNotFound) return 0; - return dataString.substring(commaPos + 1, commaPos2 - commaPos - 1).toInt(); + return dataString.substring(commaPos + 1, commaPos2 - commaPos - 1).toInteger(); } // static @@ -113,9 +114,9 @@ int V8Debugger::getGroupId(v8::Local context) if (dataString.isEmpty()) return 0; size_t commaPos = dataString.find(","); - if (commaPos == kNotFound) + if (commaPos == String16::kNotFound) return 0; - return dataString.substring(0, commaPos).toInt(); + return dataString.substring(0, commaPos).toInteger(); } void V8Debugger::getCompiledScripts(int contextGroupId, std::vector>& result) @@ -138,7 +139,7 @@ void V8Debugger::getCompiledScripts(int contextGroupId, std::vectorSet(toV8StringInternalized(m_isolate, "sourceID"), toV8String(m_isolate, sourceID)); info->Set(toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(m_isolate, scriptBreakpoint.lineNumber)); info->Set(toV8StringInternalized(m_isolate, "columnNumber"), v8::Integer::New(m_isolate, scriptBreakpoint.columnNumber)); - info->Set(toV8StringInternalized(m_isolate, "interstatementLocation"), v8Boolean(interstatementLocation, m_isolate)); info->Set(toV8StringInternalized(m_isolate, "condition"), toV8String(m_isolate, scriptBreakpoint.condition)); v8::Local setBreakpointFunction = v8::Local::Cast(m_debuggerScript.Get(m_isolate)->Get(toV8StringInternalized(m_isolate, "setBreakpoint"))); @@ -303,7 +303,7 @@ void V8Debugger::clearStepping() callDebuggerMethod("clearStepping", 0, argv); } -bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local newSource, bool preview, ErrorString* error, Maybe* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe* stackChanged) +bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local newSource, bool dryRun, ErrorString* error, Maybe* exceptionDetails, JavaScriptCallFrames* newCallFrames, Maybe* stackChanged) { class EnableLiveEditScope { public: @@ -328,7 +328,7 @@ bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local if (!isPaused()) contextScope = wrapUnique(new v8::Context::Scope(debuggerContext())); - v8::Local argv[] = { toV8String(m_isolate, sourceID), newSource, v8Boolean(preview, m_isolate) }; + v8::Local argv[] = { toV8String(m_isolate, sourceID), newSource, v8Boolean(dryRun, m_isolate) }; v8::Local v8result; { @@ -354,7 +354,7 @@ bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local { *stackChanged = resultTuple->Get(1)->BooleanValue(); // Call stack may have changed after if the edited function was on the stack. - if (!preview && isPaused()) { + if (!dryRun && isPaused()) { JavaScriptCallFrames frames = currentCallFrames(); newCallFrames->swap(frames); } @@ -364,8 +364,8 @@ bool V8Debugger::setScriptSource(const String16& sourceID, v8::Local case 1: { *exceptionDetails = protocol::Runtime::ExceptionDetails::create() + .setExceptionId(m_inspector->nextExceptionId()) .setText(toProtocolStringWithTypeCheck(resultTuple->Get(2))) - .setScriptId(String16("0")) .setLineNumber(resultTuple->Get(3)->ToInteger(m_isolate)->Value() - 1) .setColumnNumber(resultTuple->Get(4)->ToInteger(m_isolate)->Value() - 1).build(); return false; @@ -509,6 +509,8 @@ void V8Debugger::handleV8DebugEvent(const v8::Debug::EventDetails& eventDetails) v8::Context::Scope contextScope(debuggerContext()); v8::Local argv[] = { eventDetails.GetEventData() }; v8::Local value = callDebuggerMethod("getAfterCompileScript", 1, argv).ToLocalChecked(); + if (value->IsNull()) + return; DCHECK(value->IsObject()); v8::Local scriptObject = v8::Local::Cast(value); agent->didParseSource(wrapUnique(new V8DebuggerScript(m_isolate, scriptObject, inLiveEditScope)), event == v8::AfterCompile); @@ -580,7 +582,7 @@ v8::Local V8Debugger::debuggerContext() const return m_debuggerContext.Get(m_isolate); } -v8::MaybeLocal V8Debugger::functionScopes(v8::Local function) +v8::MaybeLocal V8Debugger::functionScopes(v8::Local context, v8::Local function) { if (!enabled()) { NOTREACHED(); @@ -588,17 +590,16 @@ v8::MaybeLocal V8Debugger::functionScopes(v8::Local fun } v8::Local argv[] = { function }; v8::Local scopesValue; - if (!callDebuggerMethod("getFunctionScopes", 1, argv).ToLocal(&scopesValue) || !scopesValue->IsArray()) + if (!callDebuggerMethod("getFunctionScopes", 1, argv).ToLocal(&scopesValue)) return v8::MaybeLocal(); - v8::Local scopes = scopesValue.As(); - v8::Local context = m_debuggerContext.Get(m_isolate); - if (!markAsInternal(context, scopes, V8InternalValueType::kScopeList)) + v8::Local copied; + if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, scopesValue).ToLocal(&copied) || !copied->IsArray()) return v8::MaybeLocal(); - if (!markArrayEntriesAsInternal(context, scopes, V8InternalValueType::kScope)) + if (!markAsInternal(context, v8::Local::Cast(copied), V8InternalValueType::kScopeList)) return v8::MaybeLocal(); - if (!scopes->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) - return v8::Undefined(m_isolate); - return scopes; + if (!markArrayEntriesAsInternal(context, v8::Local::Cast(copied), V8InternalValueType::kScope)) + return v8::MaybeLocal(); + return copied; } v8::MaybeLocal V8Debugger::internalProperties(v8::Local context, v8::Local value) @@ -628,7 +629,7 @@ v8::MaybeLocal V8Debugger::internalProperties(v8::Local } } if (value->IsGeneratorObject()) { - v8::Local location = generatorObjectLocation(v8::Local::Cast(value)); + v8::Local location = generatorObjectLocation(context, v8::Local::Cast(value)); if (location->IsObject()) { properties->Set(properties->Length(), toV8StringInternalized(m_isolate, "[[GeneratorLocation]]")); properties->Set(properties->Length(), location); @@ -638,7 +639,7 @@ v8::MaybeLocal V8Debugger::internalProperties(v8::Local v8::Local function = value.As(); v8::Local boundFunction = function->GetBoundFunction(); v8::Local scopes; - if (boundFunction->IsUndefined() && functionScopes(function).ToLocal(&scopes)) { + if (boundFunction->IsUndefined() && functionScopes(context, function).ToLocal(&scopes)) { properties->Set(properties->Length(), toV8StringInternalized(m_isolate, "[[Scopes]]")); properties->Set(properties->Length(), scopes); } @@ -654,17 +655,15 @@ v8::Local V8Debugger::collectionEntries(v8::Local contex } v8::Local argv[] = { object }; v8::Local entriesValue = callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); - if (!entriesValue->IsArray()) + v8::Local copied; + if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, entriesValue).ToLocal(&copied) || !copied->IsArray()) return v8::Undefined(m_isolate); - v8::Local entries = entriesValue.As(); - if (!markArrayEntriesAsInternal(context, entries, V8InternalValueType::kEntry)) + if (!markArrayEntriesAsInternal(context, v8::Local::Cast(copied), V8InternalValueType::kEntry)) return v8::Undefined(m_isolate); - if (!entries->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) - return v8::Undefined(m_isolate); - return entries; + return copied; } -v8::Local V8Debugger::generatorObjectLocation(v8::Local object) +v8::Local V8Debugger::generatorObjectLocation(v8::Local context, v8::Local object) { if (!enabled()) { NOTREACHED(); @@ -672,12 +671,12 @@ v8::Local V8Debugger::generatorObjectLocation(v8::Local o } v8::Local argv[] = { object }; v8::Local location = callDebuggerMethod("getGeneratorObjectLocation", 1, argv).ToLocalChecked(); - if (!location->IsObject()) + v8::Local copied; + if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, location).ToLocal(&copied) || !copied->IsObject()) return v8::Null(m_isolate); - v8::Local context = m_debuggerContext.Get(m_isolate); - if (!markAsInternal(context, v8::Local::Cast(location), V8InternalValueType::kLocation)) + if (!markAsInternal(context, v8::Local::Cast(copied), V8InternalValueType::kLocation)) return v8::Null(m_isolate); - return location; + return copied; } v8::Local V8Debugger::functionLocation(v8::Local context, v8::Local function) @@ -690,6 +689,8 @@ v8::Local V8Debugger::functionLocation(v8::Local context if (lineNumber == v8::Function::kLineOffsetNotFound || columnNumber == v8::Function::kLineOffsetNotFound) return v8::Null(m_isolate); v8::Local location = v8::Object::New(m_isolate); + if (!location->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) + return v8::Null(m_isolate); if (!location->Set(context, toV8StringInternalized(m_isolate, "scriptId"), toV8String(m_isolate, String16::fromInteger(scriptId))).FromMaybe(false)) return v8::Null(m_isolate); if (!location->Set(context, toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(m_isolate, lineNumber)).FromMaybe(false)) @@ -835,4 +836,4 @@ std::unique_ptr V8Debugger::captureStackTrace(bool fullStack) return V8StackTraceImpl::capture(this, contextGroupId, stackSize); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.h index 3ec68a8708bee4..02e762eb01c420 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Debugger.h @@ -5,9 +5,7 @@ #ifndef V8Debugger_h #define V8Debugger_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/Maybe.h" -#include "platform/inspector_protocol/Platform.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/JavaScriptCallFrame.h" #include "platform/v8_inspector/V8DebuggerScript.h" #include "platform/v8_inspector/protocol/Runtime.h" @@ -17,13 +15,15 @@ #include #include -namespace blink { +namespace v8_inspector { struct ScriptBreakpoint; class V8DebuggerAgentImpl; class V8InspectorImpl; class V8StackTraceImpl; +namespace protocol = blink::protocol; + class V8Debugger { PROTOCOL_DISALLOW_COPY(V8Debugger); public: @@ -36,7 +36,7 @@ class V8Debugger { bool enabled() const; - String16 setBreakpoint(const String16& sourceID, const ScriptBreakpoint&, int* actualLineNumber, int* actualColumnNumber, bool interstatementLocation); + String16 setBreakpoint(const String16& sourceID, const ScriptBreakpoint&, int* actualLineNumber, int* actualColumnNumber); void removeBreakpoint(const String16& breakpointId); void setBreakpointsActivated(bool); bool breakpointsActivated() const { return m_breakpointsActivated; } @@ -57,7 +57,7 @@ class V8Debugger { void stepOutOfFunction(); void clearStepping(); - bool setScriptSource(const String16& sourceID, v8::Local newSource, bool preview, ErrorString*, protocol::Maybe*, JavaScriptCallFrames* newCallFrames, protocol::Maybe* stackChanged); + bool setScriptSource(const String16& sourceID, v8::Local newSource, bool dryRun, ErrorString*, protocol::Maybe*, JavaScriptCallFrames* newCallFrames, protocol::Maybe* stackChanged); JavaScriptCallFrames currentCallFrames(int limit = 0); // Each script inherits debug data from v8::Context where it has been compiled. @@ -76,7 +76,6 @@ class V8Debugger { std::unique_ptr createStackTrace(v8::Local); std::unique_ptr captureStackTrace(bool fullStack); - v8::MaybeLocal functionScopes(v8::Local); v8::MaybeLocal internalProperties(v8::Local, v8::Local); void asyncTaskScheduled(const String16& taskName, void* task, bool recurring); @@ -102,8 +101,9 @@ class V8Debugger { void handleV8AsyncTaskEvent(v8::Local, v8::Local executionState, v8::Local eventData); v8::Local collectionEntries(v8::Local, v8::Local); - v8::Local generatorObjectLocation(v8::Local); + v8::Local generatorObjectLocation(v8::Local, v8::Local); v8::Local functionLocation(v8::Local, v8::Local); + v8::MaybeLocal functionScopes(v8::Local, v8::Local); v8::Isolate* m_isolate; V8InspectorImpl* m_inspector; @@ -126,6 +126,6 @@ class V8Debugger { protocol::HashMap m_maxAsyncCallStackDepthMap; }; -} // namespace blink +} // namespace v8_inspector #endif // V8Debugger_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.cpp index 584c0164e0339a..0afbd02bd569cf 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.cpp @@ -4,9 +4,6 @@ #include "platform/v8_inspector/V8DebuggerAgentImpl.h" -#include "platform/inspector_protocol/Parser.h" -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/InjectedScript.h" #include "platform/v8_inspector/InspectedContext.h" #include "platform/v8_inspector/JavaScriptCallFrame.h" @@ -33,7 +30,7 @@ using blink::protocol::Runtime::ScriptId; using blink::protocol::Runtime::StackTrace; using blink::protocol::Runtime::RemoteObject; -namespace blink { +namespace v8_inspector { namespace DebuggerAgentState { static const char javaScriptBreakpoints[] = "javaScriptBreakopints"; @@ -235,9 +232,9 @@ void V8DebuggerAgentImpl::setBreakpointsActive(ErrorString* errorString, bool ac m_debugger->setBreakpointsActivated(active); } -void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skipped) +void V8DebuggerAgentImpl::setSkipAllPauses(ErrorString*, bool skip) { - m_skipAllPauses = skipped; + m_skipAllPauses = skip; m_state->setBoolean(DebuggerAgentState::skipAllPauses, m_skipAllPauses); } @@ -376,9 +373,7 @@ void V8DebuggerAgentImpl::removeBreakpoint(const String16& breakpointId) m_breakpointIdToDebuggerBreakpointIds.erase(breakpointId); } -void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString, - std::unique_ptr location, - const protocol::Maybe& interstateLocationOpt) +void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString, std::unique_ptr location) { if (!checkEnabled(errorString)) return; @@ -395,22 +390,10 @@ void V8DebuggerAgentImpl::continueToLocation(ErrorString* errorString, return; ScriptBreakpoint breakpoint(lineNumber, columnNumber, ""); - m_continueToLocationBreakpointId = m_debugger->setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber, interstateLocationOpt.fromMaybe(false)); + m_continueToLocationBreakpointId = m_debugger->setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber); resume(errorString); } -void V8DebuggerAgentImpl::getBacktrace(ErrorString* errorString, std::unique_ptr>* callFrames, Maybe* asyncStackTrace) -{ - if (!assertPaused(errorString)) - return; - JavaScriptCallFrames frames = m_debugger->currentCallFrames(); - m_pausedCallFrames.swap(frames); - *callFrames = currentCallFrames(errorString); - if (!*callFrames) - return; - *asyncStackTrace = currentAsyncStackTrace(); -} - bool V8DebuggerAgentImpl::isCurrentCallStackEmptyOrBlackboxed() { DCHECK(enabled()); @@ -502,7 +485,7 @@ std::unique_ptr V8DebuggerAgentImpl::resolveBreakp int actualLineNumber; int actualColumnNumber; - String16 debuggerBreakpointId = m_debugger->setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber, false); + String16 debuggerBreakpointId = m_debugger->setBreakpoint(scriptId, breakpoint, &actualLineNumber, &actualColumnNumber); if (debuggerBreakpointId.isEmpty()) return nullptr; @@ -534,7 +517,7 @@ void V8DebuggerAgentImpl::searchInContent(ErrorString* error, const String16& sc void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString, const String16& scriptId, const String16& newContent, - const Maybe& preview, + const Maybe& dryRun, Maybe>* newCallFrames, Maybe* stackChanged, Maybe* asyncStackTrace, @@ -545,7 +528,7 @@ void V8DebuggerAgentImpl::setScriptSource(ErrorString* errorString, v8::HandleScope handles(m_isolate); v8::Local newSource = toV8String(m_isolate, newContent); - if (!m_debugger->setScriptSource(scriptId, newSource, preview.fromMaybe(false), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged)) + if (!m_debugger->setScriptSource(scriptId, newSource, dryRun.fromMaybe(false), errorString, optOutCompileError, &m_pausedCallFrames, stackChanged)) return; ScriptsMap::iterator it = m_scripts.find(scriptId); @@ -728,11 +711,10 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString, const String16& expression, const Maybe& objectGroup, const Maybe& includeCommandLineAPI, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& returnByValue, const Maybe& generatePreview, std::unique_ptr* result, - Maybe* wasThrown, Maybe* exceptionDetails) { if (!assertPaused(errorString)) @@ -747,7 +729,7 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString, if (includeCommandLineAPI.fromMaybe(false) && !scope.installCommandLineAPI()) return; - if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) + if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); v8::MaybeLocal maybeResultValue = m_pausedCallFrames[scope.frameOrdinal()]->evaluate(toV8String(m_isolate, expression)); @@ -762,7 +744,6 @@ void V8DebuggerAgentImpl::evaluateOnCallFrame(ErrorString* errorString, returnByValue.fromMaybe(false), generatePreview.fromMaybe(false), result, - wasThrown, exceptionDetails); } @@ -996,38 +977,27 @@ void V8DebuggerAgentImpl::didParseSource(std::unique_ptr scrip { v8::HandleScope handles(m_isolate); String16 scriptSource = toProtocolString(script->source(m_isolate)); - bool isDeprecatedSourceURL = false; if (!success) - script->setSourceURL(findSourceURL(scriptSource, false, &isDeprecatedSourceURL)); - else if (script->hasSourceURL()) - findSourceURL(scriptSource, false, &isDeprecatedSourceURL); - - bool isDeprecatedSourceMappingURL = false; + script->setSourceURL(findSourceURL(scriptSource, false)); if (!success) - script->setSourceMappingURL(findSourceMapURL(scriptSource, false, &isDeprecatedSourceMappingURL)); - else if (!script->sourceMappingURL().isEmpty()) - findSourceMapURL(scriptSource, false, &isDeprecatedSourceMappingURL); + script->setSourceMappingURL(findSourceMapURL(scriptSource, false)); std::unique_ptr executionContextAuxData; if (!script->executionContextAuxData().isEmpty()) executionContextAuxData = protocol::DictionaryValue::cast(parseJSON(script->executionContextAuxData())); - bool isInternalScript = script->isInternalScript(); bool isLiveEdit = script->isLiveEdit(); bool hasSourceURL = script->hasSourceURL(); String16 scriptId = script->scriptId(); String16 scriptURL = script->sourceURL(); - bool deprecatedCommentWasUsed = isDeprecatedSourceURL || isDeprecatedSourceMappingURL; const Maybe& sourceMapURLParam = script->sourceMappingURL(); const Maybe& executionContextAuxDataParam(std::move(executionContextAuxData)); - const bool* isInternalScriptParam = isInternalScript ? &isInternalScript : nullptr; const bool* isLiveEditParam = isLiveEdit ? &isLiveEdit : nullptr; const bool* hasSourceURLParam = hasSourceURL ? &hasSourceURL : nullptr; - const bool* deprecatedCommentWasUsedParam = deprecatedCommentWasUsed ? &deprecatedCommentWasUsed : nullptr; if (success) - m_frontend.scriptParsed(scriptId, scriptURL, script->startLine(), script->startColumn(), script->endLine(), script->endColumn(), script->executionContextId(), script->hash(), executionContextAuxDataParam, isInternalScriptParam, isLiveEditParam, sourceMapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); + m_frontend.scriptParsed(scriptId, scriptURL, script->startLine(), script->startColumn(), script->endLine(), script->endColumn(), script->executionContextId(), script->hash(), executionContextAuxDataParam, isLiveEditParam, sourceMapURLParam, hasSourceURLParam); else - m_frontend.scriptFailedToParse(scriptId, scriptURL, script->startLine(), script->startColumn(), script->endLine(), script->endColumn(), script->executionContextId(), script->hash(), executionContextAuxDataParam, isInternalScriptParam, sourceMapURLParam, hasSourceURLParam, deprecatedCommentWasUsedParam); + m_frontend.scriptFailedToParse(scriptId, scriptURL, script->startLine(), script->startColumn(), script->endLine(), script->endColumn(), script->executionContextId(), script->hash(), executionContextAuxDataParam, sourceMapURLParam, hasSourceURLParam); m_scripts[scriptId] = std::move(script); @@ -1062,13 +1032,6 @@ V8DebuggerAgentImpl::SkipPauseRequest V8DebuggerAgentImpl::didPause(v8::LocalcurrentCallFrames(1); JavaScriptCallFrame* topCallFrame = !callFrames.empty() ? callFrames.begin()->get() : nullptr; - // Skip pause in internal scripts (e.g. InjectedScriptSource.js). - if (topCallFrame) { - ScriptsMap::iterator it = m_scripts.find(String16::fromInteger(topCallFrame->sourceID())); - if (it != m_scripts.end() && it->second->isInternalScript()) - return RequestStepFrame; - } - V8DebuggerAgentImpl::SkipPauseRequest result; if (m_skipAllPauses) result = RequestContinue; @@ -1201,4 +1164,4 @@ void V8DebuggerAgentImpl::reset() m_breakpointIdToDebuggerBreakpointIds.clear(); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.h index e777f3b2cd8af4..04d1ad7c8927d0 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerAgentImpl.h @@ -5,14 +5,13 @@ #ifndef V8DebuggerAgentImpl_h #define V8DebuggerAgentImpl_h -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/JavaScriptCallFrame.h" #include "platform/v8_inspector/protocol/Debugger.h" #include -namespace blink { +namespace v8_inspector { struct ScriptBreakpoint; class JavaScriptCallFrame; @@ -24,11 +23,8 @@ class V8InspectorSessionImpl; class V8Regex; class V8StackTraceImpl; -namespace protocol { -class DictionaryValue; -} - -using protocol::Maybe; +namespace protocol = blink::protocol; +using blink::protocol::Maybe; class V8DebuggerAgentImpl : public protocol::Debugger::Backend { PROTOCOL_DISALLOW_COPY(V8DebuggerAgentImpl); @@ -55,7 +51,7 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend { void enable(ErrorString*) override; void disable(ErrorString*) override; void setBreakpointsActive(ErrorString*, bool active) override; - void setSkipAllPauses(ErrorString*, bool skipped) override; + void setSkipAllPauses(ErrorString*, bool skip) override; void setBreakpointByUrl(ErrorString*, int lineNumber, const Maybe& optionalURL, @@ -71,22 +67,17 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend { std::unique_ptr* actualLocation) override; void removeBreakpoint(ErrorString*, const String16& breakpointId) override; void continueToLocation(ErrorString*, - std::unique_ptr, - const Maybe& interstateLocationOpt) override; - void getBacktrace(ErrorString*, - std::unique_ptr>*, - Maybe*) override; + std::unique_ptr) override; void searchInContent(ErrorString*, const String16& scriptId, const String16& query, const Maybe& optionalCaseSensitive, const Maybe& optionalIsRegex, std::unique_ptr>*) override; - void canSetScriptSource(ErrorString*, bool* result) override { *result = true; } void setScriptSource(ErrorString*, const String16& inScriptId, const String16& inScriptSource, - const Maybe& inPreview, + const Maybe& dryRun, Maybe>* optOutCallFrames, Maybe* optOutStackChanged, Maybe* optOutAsyncStackTrace, @@ -107,11 +98,10 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend { const String16& expression, const Maybe& objectGroup, const Maybe& includeCommandLineAPI, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& returnByValue, const Maybe& generatePreview, std::unique_ptr* result, - Maybe* wasThrown, Maybe*) override; void setVariableValue(ErrorString*, int scopeNumber, @@ -217,7 +207,6 @@ class V8DebuggerAgentImpl : public protocol::Debugger::Backend { protocol::HashMap>> m_blackboxedPositions; }; -} // namespace blink - +} // namespace v8_inspector #endif // V8DebuggerAgentImpl_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.cpp index edb2fcdc7d333d..76e0c0066bfb89 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.cpp @@ -4,18 +4,17 @@ #include "platform/v8_inspector/V8DebuggerScript.h" -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/Platform.h" #include "platform/v8_inspector/V8StringUtil.h" -namespace blink { +namespace v8_inspector { -static const LChar hexDigits[17] = "0123456789ABCDEF"; +static const char hexDigits[17] = "0123456789ABCDEF"; static void appendUnsignedAsHex(unsigned number, String16Builder* destination) { for (size_t i = 0; i < 8; ++i) { - destination->append(hexDigits[number & 0xF]); + UChar c = hexDigits[number & 0xF]; + destination->append(c); number >>= 4; } } @@ -36,17 +35,18 @@ static String16 calculateHash(const String16& str) size_t current = 0; const uint32_t* data = nullptr; + size_t sizeInBytes = sizeof(UChar) * str.length(); data = reinterpret_cast(str.characters16()); - for (size_t i = 0; i < str.sizeInBytes() / 4; i += 4) { + for (size_t i = 0; i < sizeInBytes / 4; i += 4) { uint32_t v = data[i]; uint64_t xi = v * randomOdd[current] & 0x7FFFFFFF; hashes[current] = (hashes[current] + zi[current] * xi) % prime[current]; zi[current] = (zi[current] * random[current]) % prime[current]; current = current == hashesSize - 1 ? 0 : current + 1; } - if (str.sizeInBytes() % 4) { + if (sizeInBytes % 4) { uint32_t v = 0; - for (size_t i = str.sizeInBytes() - str.sizeInBytes() % 4; i < str.sizeInBytes(); ++i) { + for (size_t i = sizeInBytes - sizeInBytes % 4; i < sizeInBytes; ++i) { v <<= 8; v |= reinterpret_cast(data)[i]; } @@ -79,7 +79,6 @@ V8DebuggerScript::V8DebuggerScript(v8::Isolate* isolate, v8::Local o m_endLine = object->Get(toV8StringInternalized(isolate, "endLine"))->ToInteger(isolate)->Value(); m_endColumn = object->Get(toV8StringInternalized(isolate, "endColumn"))->ToInteger(isolate)->Value(); m_executionContextAuxData = toProtocolStringWithTypeCheck(object->Get(toV8StringInternalized(isolate, "executionContextAuxData"))); - m_isInternalScript = object->Get(toV8StringInternalized(isolate, "isInternalScript"))->ToBoolean(isolate)->Value(); m_executionContextId = object->Get(toV8StringInternalized(isolate, "executionContextId"))->ToInteger(isolate)->Value(); m_isLiveEdit = isLiveEdit; @@ -118,4 +117,4 @@ void V8DebuggerScript::setSource(v8::Isolate* isolate, v8::Local sou m_hash = calculateHash(toProtocolString(source)); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.h index d3e9d8d02d5faa..8af67ffa08db46 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8DebuggerScript.h @@ -30,11 +30,12 @@ #ifndef V8DebuggerScript_h #define V8DebuggerScript_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { + +namespace protocol = blink::protocol; class V8DebuggerScript { PROTOCOL_DISALLOW_COPY(V8DebuggerScript); @@ -55,7 +56,6 @@ class V8DebuggerScript { int endColumn() const { return m_endColumn; } int executionContextId() const { return m_executionContextId; } const String16& executionContextAuxData() const { return m_executionContextAuxData; } - bool isInternalScript() const { return m_isInternalScript; } bool isLiveEdit() const { return m_isLiveEdit; } void setSourceURL(const String16&); @@ -75,11 +75,10 @@ class V8DebuggerScript { int m_endColumn; int m_executionContextId; String16 m_executionContextAuxData; - bool m_isInternalScript; bool m_isLiveEdit; }; -} // namespace blink +} // namespace v8_inspector #endif // V8DebuggerScript_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.cpp index bed316ef35ddd5..2f3389c5365d78 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.cpp @@ -30,7 +30,6 @@ #include "platform/v8_inspector/V8FunctionCall.h" -#include "platform/inspector_protocol/Platform.h" #include "platform/v8_inspector/V8Compat.h" #include "platform/v8_inspector/V8Debugger.h" #include "platform/v8_inspector/V8InspectorImpl.h" @@ -39,7 +38,7 @@ #include -namespace blink { +namespace v8_inspector { V8FunctionCall::V8FunctionCall(V8InspectorImpl* inspector, v8::Local context, v8::Local value, const String16& name) : m_inspector(inspector) @@ -113,4 +112,4 @@ v8::Local V8FunctionCall::callWithoutExceptionHandling() return result; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.h index acb5b5c3417243..d853644888c5fc 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8FunctionCall.h @@ -31,14 +31,16 @@ #ifndef V8FunctionCall_h #define V8FunctionCall_h -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class V8InspectorImpl; +namespace protocol = blink::protocol; + class V8FunctionCall { public: V8FunctionCall(V8InspectorImpl*, v8::Local, v8::Local, const String16& name); @@ -59,6 +61,6 @@ class V8FunctionCall { v8::Local m_value; }; -} // namespace blink +} // namespace v8_inspector #endif // V8FunctionCall diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp index d256fe1cc29efa..fb2981fadb3308 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.cpp @@ -13,7 +13,7 @@ #include #include -namespace blink { +namespace v8_inspector { namespace { @@ -237,7 +237,7 @@ void V8HeapProfilerAgentImpl::takeHeapSnapshot(ErrorString* errorString, const p void V8HeapProfilerAgentImpl::getObjectByHeapObjectId(ErrorString* error, const String16& heapSnapshotObjectId, const protocol::Maybe& objectGroup, std::unique_ptr* result) { bool ok; - int id = heapSnapshotObjectId.toInt(&ok); + int id = heapSnapshotObjectId.toInteger(&ok); if (!ok) { *error = "Invalid heap snapshot object id"; return; @@ -263,7 +263,7 @@ void V8HeapProfilerAgentImpl::getObjectByHeapObjectId(ErrorString* error, const void V8HeapProfilerAgentImpl::addInspectedHeapObject(ErrorString* errorString, const String16& inspectedHeapObjectId) { bool ok; - int id = inspectedHeapObjectId.toInt(&ok); + int id = inspectedHeapObjectId.toInteger(&ok); if (!ok) { *errorString = "Invalid heap snapshot object id"; return; @@ -398,4 +398,4 @@ void V8HeapProfilerAgentImpl::stopSampling(ErrorString* errorString, std::unique #endif } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.h index bc201afab9a604..198772a4836a4c 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8HeapProfilerAgentImpl.h @@ -5,17 +5,17 @@ #ifndef V8HeapProfilerAgentImpl_h #define V8HeapProfilerAgentImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/HeapProfiler.h" #include -namespace blink { +namespace v8_inspector { class V8InspectorSessionImpl; -using protocol::Maybe; +namespace protocol = blink::protocol; +using blink::protocol::Maybe; class V8HeapProfilerAgentImpl : public protocol::HeapProfiler::Backend { PROTOCOL_DISALLOW_COPY(V8HeapProfilerAgentImpl); @@ -54,6 +54,6 @@ class V8HeapProfilerAgentImpl : public protocol::HeapProfiler::Backend { bool m_hasTimer; }; -} // namespace blink +} // namespace v8_inspector #endif // !defined(V8HeapProfilerAgentImpl_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.cpp index 6f9a2a05cecc8f..782e5bbab01473 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.cpp @@ -4,7 +4,6 @@ #include "platform/v8_inspector/V8InjectedScriptHost.h" -#include "platform/inspector_protocol/String16.h" #include "platform/v8_inspector/InjectedScriptNative.h" #include "platform/v8_inspector/V8Compat.h" #include "platform/v8_inspector/V8Debugger.h" @@ -13,7 +12,7 @@ #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { namespace { @@ -43,6 +42,8 @@ v8::Local V8InjectedScriptHost::create(v8::Local contex { v8::Isolate* isolate = inspector->isolate(); v8::Local injectedScriptHost = v8::Object::New(isolate); + bool success = injectedScriptHost->SetPrototype(context, v8::Null(isolate)).FromMaybe(false); + DCHECK(success); v8::Local debuggerExternal = v8::External::New(isolate, inspector); setFunctionProperty(context, injectedScriptHost, "internalConstructorName", V8InjectedScriptHost::internalConstructorNameCallback, debuggerExternal); setFunctionProperty(context, injectedScriptHost, "formatAccessorsAsProperties", V8InjectedScriptHost::formatAccessorsAsProperties, debuggerExternal); @@ -183,4 +184,4 @@ void V8InjectedScriptHost::proxyTargetValueCallback(const v8::FunctionCallbackIn info.GetReturnValue().Set(target); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.h index 496b5a77f801f0..3123319f6c56f0 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InjectedScriptHost.h @@ -5,12 +5,15 @@ #ifndef V8InjectedScriptHost_h #define V8InjectedScriptHost_h +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class V8InspectorImpl; +namespace protocol = blink::protocol; + // SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by the inspector, // a reference to the InjectedScriptHost may be leaked to the page being inspected. Thus, the // InjectedScriptHost must never implemment methods that have more power over the page than the @@ -31,6 +34,6 @@ class V8InjectedScriptHost { static void proxyTargetValueCallback(const v8::FunctionCallbackInfo&); }; -} // namespace blink +} // namespace v8_inspector #endif // V8InjectedScriptHost_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.cpp index caac2020602009..1a56906f782416 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.cpp @@ -43,7 +43,7 @@ #include "platform/v8_inspector/public/V8InspectorClient.h" #include -namespace blink { +namespace v8_inspector { std::unique_ptr V8Inspector::create(v8::Isolate* isolate, V8InspectorClient* client) { @@ -105,7 +105,7 @@ v8::MaybeLocal V8InspectorImpl::callFunction(v8::Local v8::MaybeLocal V8InspectorImpl::compileAndRunInternalScript(v8::Local context, v8::Local source) { - v8::Local script = compileScript(context, source, String(), true); + v8::Local script = compileScript(context, source, String16(), true); if (script.IsEmpty()) return v8::MaybeLocal(); v8::MicrotasksScope microtasksScope(m_isolate, v8::MicrotasksScope::kDoNotRunMicrotasks); @@ -271,7 +271,7 @@ unsigned V8InspectorImpl::exceptionThrown(v8::Local context, const if (!contextGroupId || m_muteExceptionsMap[contextGroupId]) return 0; std::unique_ptr stackTraceImpl = wrapUnique(static_cast(stackTrace.release())); - unsigned exceptionId = ++m_lastExceptionId; + unsigned exceptionId = nextExceptionId(); std::unique_ptr consoleMessage = V8ConsoleMessage::createForException(m_client->currentTimeMS(), detailedMessage, url, lineNumber, columnNumber, std::move(stackTraceImpl), scriptId, m_isolate, message, V8Debugger::contextId(context), exception, exceptionId); ensureConsoleMessageStorage(contextGroupId)->addMessage(std::move(consoleMessage)); return exceptionId; @@ -347,4 +347,4 @@ V8InspectorSessionImpl* V8InspectorImpl::sessionForContextGroup(int contextGroup return iter == m_sessions.end() ? nullptr : iter->second; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.h index e4dad93d9c6356..395c48ddd79d09 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorImpl.h @@ -31,16 +31,14 @@ #ifndef V8InspectorImpl_h #define V8InspectorImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/Collections.h" -#include "platform/inspector_protocol/Platform.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/public/V8Inspector.h" #include #include #include -namespace blink { +namespace v8_inspector { class InspectedContext; class V8ConsoleMessageStorage; @@ -50,6 +48,8 @@ class V8InspectorSessionImpl; class V8RuntimeAgentImpl; class V8StackTraceImpl; +namespace protocol = blink::protocol; + class V8InspectorImpl : public V8Inspector { PROTOCOL_DISALLOW_COPY(V8InspectorImpl); public: @@ -85,6 +85,7 @@ class V8InspectorImpl : public V8Inspector { void asyncTaskFinished(void* task) override; void allAsyncTasksCanceled() override; + unsigned nextExceptionId() { return ++m_lastExceptionId; } void enableStackCapturingIfNeeded(); void disableStackCapturingIfNeeded(); void muteExceptions(int contextGroupId); @@ -120,7 +121,7 @@ class V8InspectorImpl : public V8Inspector { ConsoleStorageMap m_consoleStorageMap; }; -} // namespace blink +} // namespace v8_inspector #endif // V8InspectorImpl_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.cpp index 814b7f91ea52c4..51b288de882d75 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.cpp @@ -4,7 +4,6 @@ #include "platform/v8_inspector/V8InspectorSessionImpl.h" -#include "platform/inspector_protocol/Parser.h" #include "platform/v8_inspector/InjectedScript.h" #include "platform/v8_inspector/InspectedContext.h" #include "platform/v8_inspector/RemoteObjectId.h" @@ -15,20 +14,22 @@ #include "platform/v8_inspector/V8InspectorImpl.h" #include "platform/v8_inspector/V8ProfilerAgentImpl.h" #include "platform/v8_inspector/V8RuntimeAgentImpl.h" +#include "platform/v8_inspector/V8SchemaAgentImpl.h" #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8ContextInfo.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { // static bool V8InspectorSession::canDispatchMethod(const String16& method) { - return method.startWith(protocol::Runtime::Metainfo::commandPrefix) - || method.startWith(protocol::Debugger::Metainfo::commandPrefix) - || method.startWith(protocol::Profiler::Metainfo::commandPrefix) - || method.startWith(protocol::HeapProfiler::Metainfo::commandPrefix) - || method.startWith(protocol::Console::Metainfo::commandPrefix); + return method.startsWith(protocol::Runtime::Metainfo::commandPrefix) + || method.startsWith(protocol::Debugger::Metainfo::commandPrefix) + || method.startsWith(protocol::Profiler::Metainfo::commandPrefix) + || method.startsWith(protocol::HeapProfiler::Metainfo::commandPrefix) + || method.startsWith(protocol::Console::Metainfo::commandPrefix) + || method.startsWith(protocol::Schema::Metainfo::commandPrefix); } std::unique_ptr V8InspectorSessionImpl::create(V8InspectorImpl* inspector, int contextGroupId, protocol::FrontendChannel* channel, const String16* state) @@ -47,6 +48,7 @@ V8InspectorSessionImpl::V8InspectorSessionImpl(V8InspectorImpl* inspector, int c , m_heapProfilerAgent(nullptr) , m_profilerAgent(nullptr) , m_consoleAgent(nullptr) + , m_schemaAgent(nullptr) { if (savedState) { std::unique_ptr state = protocol::parseJSON(*savedState); @@ -73,6 +75,9 @@ V8InspectorSessionImpl::V8InspectorSessionImpl(V8InspectorImpl* inspector, int c m_consoleAgent = wrapUnique(new V8ConsoleAgentImpl(this, channel, agentState(protocol::Console::Metainfo::domainName))); protocol::Console::Dispatcher::wire(&m_dispatcher, m_consoleAgent.get()); + m_schemaAgent = wrapUnique(new V8SchemaAgentImpl(this, channel, agentState(protocol::Schema::Metainfo::domainName))); + protocol::Schema::Dispatcher::wire(&m_dispatcher, m_schemaAgent.get()); + if (savedState) { m_runtimeAgent->restore(); m_debuggerAgent->restore(); @@ -263,6 +268,26 @@ String16 V8InspectorSessionImpl::stateJSON() return m_state->toJSONString(); } +std::unique_ptr> V8InspectorSessionImpl::supportedDomains() +{ + std::vector> domains = supportedDomainsImpl(); + std::unique_ptr> result = protocol::Array::create(); + for (size_t i = 0; i < domains.size(); ++i) + result->addItem(std::move(domains[i])); + return result; +} + +std::vector> V8InspectorSessionImpl::supportedDomainsImpl() +{ + std::vector> result; + result.push_back(protocol::Schema::Domain::create().setName(protocol::Runtime::Metainfo::domainName).setVersion(protocol::Runtime::Metainfo::version).build()); + result.push_back(protocol::Schema::Domain::create().setName(protocol::Debugger::Metainfo::domainName).setVersion(protocol::Debugger::Metainfo::version).build()); + result.push_back(protocol::Schema::Domain::create().setName(protocol::Profiler::Metainfo::domainName).setVersion(protocol::Profiler::Metainfo::version).build()); + result.push_back(protocol::Schema::Domain::create().setName(protocol::HeapProfiler::Metainfo::domainName).setVersion(protocol::HeapProfiler::Metainfo::version).build()); + result.push_back(protocol::Schema::Domain::create().setName(protocol::Schema::Metainfo::domainName).setVersion(protocol::Schema::Metainfo::version).build()); + return result; +} + void V8InspectorSessionImpl::addInspectedObject(std::unique_ptr inspectable) { m_inspectedObjects.insert(m_inspectedObjects.begin(), std::move(inspectable)); @@ -319,4 +344,4 @@ std::unique_ptr> V8Inspect return result; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.h index d5ee2ef75f8019..18164b7daf0215 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InspectorSessionImpl.h @@ -5,18 +5,16 @@ #ifndef V8InspectorSessionImpl_h #define V8InspectorSessionImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/DispatcherBase.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Runtime.h" +#include "platform/v8_inspector/protocol/Schema.h" #include "platform/v8_inspector/public/V8InspectorSession.h" #include #include -namespace blink { +namespace v8_inspector { class InjectedScript; class RemoteObjectIdBase; @@ -26,6 +24,9 @@ class V8InspectorImpl; class V8HeapProfilerAgentImpl; class V8ProfilerAgentImpl; class V8RuntimeAgentImpl; +class V8SchemaAgentImpl; + +namespace protocol = blink::protocol; class V8InspectorSessionImpl : public V8InspectorSession { PROTOCOL_DISALLOW_COPY(V8InspectorSessionImpl); @@ -36,6 +37,7 @@ class V8InspectorSessionImpl : public V8InspectorSession { V8InspectorImpl* inspector() const { return m_inspector; } V8ConsoleAgentImpl* consoleAgent() { return m_consoleAgent.get(); } V8DebuggerAgentImpl* debuggerAgent() { return m_debuggerAgent.get(); } + V8SchemaAgentImpl* schemaAgent() { return m_schemaAgent.get(); } V8ProfilerAgentImpl* profilerAgent() { return m_profilerAgent.get(); } V8RuntimeAgentImpl* runtimeAgent() { return m_runtimeAgent.get(); } int contextGroupId() const { return m_contextGroupId; } @@ -48,10 +50,12 @@ class V8InspectorSessionImpl : public V8InspectorSession { void setCustomObjectFormatterEnabled(bool); std::unique_ptr wrapObject(v8::Local, v8::Local, const String16& groupName, bool generatePreview); std::unique_ptr wrapTable(v8::Local, v8::Local table, v8::Local columns); + std::vector> supportedDomainsImpl(); // V8InspectorSession implementation. void dispatchProtocolMessage(const String16& message) override; String16 stateJSON() override; + std::unique_ptr> supportedDomains() override; void addInspectedObject(std::unique_ptr) override; void schedulePauseOnNextStatement(const String16& breakReason, const String16& breakDetails) override; void cancelPauseOnNextStatement() override; @@ -83,9 +87,10 @@ class V8InspectorSessionImpl : public V8InspectorSession { std::unique_ptr m_heapProfilerAgent; std::unique_ptr m_profilerAgent; std::unique_ptr m_consoleAgent; + std::unique_ptr m_schemaAgent; std::vector> m_inspectedObjects; }; -} // namespace blink +} // namespace v8_inspector #endif diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.cpp index 52e7677fd709e2..652de5982abb7e 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.cpp @@ -4,10 +4,9 @@ #include "platform/v8_inspector/V8InternalValueType.h" -#include "platform/inspector_protocol/Platform.h" #include "platform/v8_inspector/V8StringUtil.h" -namespace blink { +namespace v8_inspector { namespace { @@ -69,4 +68,4 @@ v8::Local v8InternalValueTypeFrom(v8::Local context, v8: return subtypeValue; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.h index 4bb71720f055c4..8655fea51d2100 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8InternalValueType.h @@ -5,9 +5,10 @@ #ifndef V8InternalValueType_h #define V8InternalValueType_h +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { enum class V8InternalValueType { kEntry, kLocation, kScope, kScopeList }; @@ -16,6 +17,6 @@ bool markArrayEntriesAsInternal(v8::Local, v8::Local, V8 v8::Local v8InternalValueTypeFrom(v8::Local, v8::Local); -} // namespace blink +} // namespace v8_inspector #endif // V8InternalValueType_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.cpp index 57712a9c107439..3385c7ed07b408 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.cpp @@ -16,7 +16,7 @@ #define ENSURE_V8_VERSION(major, minor) \ (V8_MAJOR_VERSION * 1000 + V8_MINOR_VERSION >= (major) * 1000 + (minor)) -namespace blink { +namespace v8_inspector { namespace ProfilerAgentState { static const char samplingInterval[] = "samplingInterval"; @@ -28,11 +28,10 @@ namespace { std::unique_ptr> buildInspectorObjectForPositionTicks(const v8::CpuProfileNode* node) { - std::unique_ptr> array = protocol::Array::create(); unsigned lineCount = node->GetHitLineCount(); if (!lineCount) - return array; - + return nullptr; + auto array = protocol::Array::create(); std::vector entries(lineCount); if (node->GetLineTicks(&entries[0], lineCount)) { for (unsigned i = 0; i < lineCount; i++) { @@ -42,73 +41,91 @@ std::unique_ptr> buildInsp array->addItem(std::move(line)); } } - return array; } std::unique_ptr buildInspectorObjectFor(v8::Isolate* isolate, const v8::CpuProfileNode* node) { v8::HandleScope handleScope(isolate); - - std::unique_ptr> children = protocol::Array::create(); - const int childrenCount = node->GetChildrenCount(); - for (int i = 0; i < childrenCount; i++) { - const v8::CpuProfileNode* child = node->GetChild(i); - children->addItem(buildInspectorObjectFor(isolate, child)); - } - - std::unique_ptr> positionTicks = buildInspectorObjectForPositionTicks(node); - - std::unique_ptr callFrame = protocol::Runtime::CallFrame::create() + auto callFrame = protocol::Runtime::CallFrame::create() .setFunctionName(toProtocolString(node->GetFunctionName())) .setScriptId(String16::fromInteger(node->GetScriptId())) .setUrl(toProtocolString(node->GetScriptResourceName())) .setLineNumber(node->GetLineNumber() - 1) .setColumnNumber(node->GetColumnNumber() - 1) .build(); - std::unique_ptr result = protocol::Profiler::CPUProfileNode::create() + auto result = protocol::Profiler::CPUProfileNode::create() .setCallFrame(std::move(callFrame)) .setHitCount(node->GetHitCount()) - .setChildren(std::move(children)) - .setPositionTicks(std::move(positionTicks)) - .setDeoptReason(node->GetBailoutReason()) .setId(node->GetNodeId()).build(); + + const int childrenCount = node->GetChildrenCount(); + if (childrenCount) { + auto children = protocol::Array::create(); + for (int i = 0; i < childrenCount; i++) + children->addItem(node->GetChild(i)->GetNodeId()); + result->setChildren(std::move(children)); + } + + const char* deoptReason = node->GetBailoutReason(); + if (deoptReason && deoptReason[0] && strcmp(deoptReason, "no reason")) + result->setDeoptReason(deoptReason); + + auto positionTicks = buildInspectorObjectForPositionTicks(node); + if (positionTicks) + result->setPositionTicks(std::move(positionTicks)); + return result; } std::unique_ptr> buildInspectorObjectForSamples(v8::CpuProfile* v8profile) { - std::unique_ptr> array = protocol::Array::create(); + auto array = protocol::Array::create(); int count = v8profile->GetSamplesCount(); for (int i = 0; i < count; i++) array->addItem(v8profile->GetSample(i)->GetNodeId()); return array; } -std::unique_ptr> buildInspectorObjectForTimestamps(v8::CpuProfile* v8profile) +std::unique_ptr> buildInspectorObjectForTimestamps(v8::CpuProfile* v8profile) { - std::unique_ptr> array = protocol::Array::create(); + auto array = protocol::Array::create(); int count = v8profile->GetSamplesCount(); - for (int i = 0; i < count; i++) - array->addItem(v8profile->GetSampleTimestamp(i)); + uint64_t lastTime = v8profile->GetStartTime(); + for (int i = 0; i < count; i++) { + uint64_t ts = v8profile->GetSampleTimestamp(i); + array->addItem(static_cast(ts - lastTime)); + lastTime = ts; + } return array; } +void flattenNodesTree(v8::Isolate* isolate, const v8::CpuProfileNode* node, protocol::Array* list) +{ + list->addItem(buildInspectorObjectFor(isolate, node)); + const int childrenCount = node->GetChildrenCount(); + for (int i = 0; i < childrenCount; i++) + flattenNodesTree(isolate, node->GetChild(i), list); +} + std::unique_ptr createCPUProfile(v8::Isolate* isolate, v8::CpuProfile* v8profile) { - std::unique_ptr profile = protocol::Profiler::CPUProfile::create() - .setHead(buildInspectorObjectFor(isolate, v8profile->GetTopDownRoot())) - .setStartTime(static_cast(v8profile->GetStartTime()) / 1000000) - .setEndTime(static_cast(v8profile->GetEndTime()) / 1000000).build(); + auto nodes = protocol::Array::create(); + flattenNodesTree(isolate, v8profile->GetTopDownRoot(), nodes.get()); + + auto profile = protocol::Profiler::CPUProfile::create() + .setNodes(std::move(nodes)) + .setStartTime(static_cast(v8profile->GetStartTime())) + .setEndTime(static_cast(v8profile->GetEndTime())).build(); profile->setSamples(buildInspectorObjectForSamples(v8profile)); - profile->setTimestamps(buildInspectorObjectForTimestamps(v8profile)); + profile->setTimestampDeltas(buildInspectorObjectForTimestamps(v8profile)); return profile; } std::unique_ptr currentDebugLocation(V8InspectorImpl* inspector) { std::unique_ptr callStack = inspector->captureStackTrace(1); - std::unique_ptr location = protocol::Debugger::Location::create() + auto location = protocol::Debugger::Location::create() .setScriptId(callStack->topScriptId()) .setLineNumber(callStack->topLineNumber()).build(); location->setColumnNumber(callStack->topColumnNumber()); @@ -317,4 +334,4 @@ v8::CpuProfiler* V8ProfilerAgentImpl::profiler() #endif } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.h index 4bbe00be679f9e..b6513fde058194 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ProfilerAgentImpl.h @@ -5,8 +5,7 @@ #ifndef V8ProfilerAgentImpl_h #define V8ProfilerAgentImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Profiler.h" #include @@ -16,10 +15,12 @@ class CpuProfiler; class Isolate; } -namespace blink { +namespace v8_inspector { class V8InspectorSessionImpl; +namespace protocol = blink::protocol; + class V8ProfilerAgentImpl : public protocol::Profiler::Backend { PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); public: @@ -59,6 +60,6 @@ class V8ProfilerAgentImpl : public protocol::Profiler::Backend { String16 m_frontendInitiatedProfileId; }; -} // namespace blink +} // namespace v8_inspector #endif // !defined(V8ProfilerAgentImpl_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.cpp index 96cd350d814317..e8c8db2e4ddee4 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.cpp @@ -11,7 +11,7 @@ #include -namespace blink { +namespace v8_inspector { V8Regex::V8Regex(V8InspectorImpl* inspector, const String16& pattern, bool caseSensitive, bool multiline) : m_inspector(inspector) @@ -89,4 +89,4 @@ int V8Regex::match(const String16& string, int startFrom, int* matchLength) cons return matchOffset.As()->Value() + startFrom; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.h index e4900e2d5407be..b1b09c7e55ab60 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8Regex.h @@ -5,11 +5,10 @@ #ifndef V8Regex_h #define V8Regex_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class V8InspectorImpl; @@ -32,6 +31,6 @@ class V8Regex { String16 m_errorMessage; }; -} // namespace blink +} // namespace v8_inspector #endif // V8Regex_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.cpp index 79d8cc9ce001ab..c5a0449c1497d2 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.cpp @@ -30,8 +30,6 @@ #include "platform/v8_inspector/V8RuntimeAgentImpl.h" -#include "platform/inspector_protocol/Parser.h" -#include "platform/inspector_protocol/Values.h" #include "platform/v8_inspector/InjectedScript.h" #include "platform/v8_inspector/InspectedContext.h" #include "platform/v8_inspector/RemoteObjectId.h" @@ -45,14 +43,13 @@ #include "platform/v8_inspector/V8StringUtil.h" #include "platform/v8_inspector/public/V8InspectorClient.h" -namespace blink { +namespace v8_inspector { namespace V8RuntimeAgentImplState { static const char customObjectFormatterEnabled[] = "customObjectFormatterEnabled"; static const char runtimeEnabled[] = "runtimeEnabled"; }; -using protocol::Runtime::ExceptionDetails; using protocol::Runtime::RemoteObject; static bool hasInternalError(ErrorString* errorString, bool hasError) @@ -99,7 +96,7 @@ class ProtocolPromiseHandler { ProtocolPromiseHandler* handler = static_cast*>(info.Data().As()->Value()); DCHECK(handler); v8::Local value = info.Length() > 0 ? info[0] : v8::Local::Cast(v8::Undefined(info.GetIsolate())); - handler->m_callback->sendSuccess(handler->wrapObject(value), Maybe(), Maybe()); + handler->m_callback->sendSuccess(handler->wrapObject(value), Maybe()); } static void catchCallback(const v8::FunctionCallbackInfo& info) @@ -108,18 +105,19 @@ class ProtocolPromiseHandler { DCHECK(handler); v8::Local value = info.Length() > 0 ? info[0] : v8::Local::Cast(v8::Undefined(info.GetIsolate())); - std::unique_ptr exceptionDetails; std::unique_ptr stack = handler->m_inspector->debugger()->captureStackTrace(true); - if (stack) { - exceptionDetails = protocol::Runtime::ExceptionDetails::create() - .setText("Promise was rejected") - .setLineNumber(!stack->isEmpty() ? stack->topLineNumber() : 0) - .setColumnNumber(!stack->isEmpty() ? stack->topColumnNumber() : 0) - .setScriptId(!stack->isEmpty() ? stack->topScriptId() : String16()) - .setStackTrace(stack->buildInspectorObjectImpl()) - .build(); - } - handler->m_callback->sendSuccess(handler->wrapObject(value), true, std::move(exceptionDetails)); + std::unique_ptr exceptionDetails = protocol::Runtime::ExceptionDetails::create() + .setExceptionId(handler->m_inspector->nextExceptionId()) + .setText("Uncaught (in promise)") + .setLineNumber(stack && !stack->isEmpty() ? stack->topLineNumber() : 0) + .setColumnNumber(stack && !stack->isEmpty() ? stack->topColumnNumber() : 0) + .setException(handler->wrapObject(value)) + .build(); + if (stack) + exceptionDetails->setStackTrace(stack->buildInspectorObjectImpl()); + if (stack && !stack->isEmpty()) + exceptionDetails->setScriptId(stack->topScriptId()); + handler->m_callback->sendSuccess(handler->wrapObject(value), std::move(exceptionDetails)); } ProtocolPromiseHandler(V8InspectorImpl* inspector, int contextGroupId, int executionContextId, const String16& objectGroup, bool returnByValue, bool generatePreview, std::unique_ptr callback) @@ -176,7 +174,6 @@ template bool wrapEvaluateResultAsync(InjectedScript* injectedScript, v8::MaybeLocal maybeResultValue, const v8::TryCatch& tryCatch, const String16& objectGroup, bool returnByValue, bool generatePreview, Callback* callback) { std::unique_ptr result; - Maybe wasThrown; Maybe exceptionDetails; ErrorString errorString; @@ -187,10 +184,9 @@ bool wrapEvaluateResultAsync(InjectedScript* injectedScript, v8::MaybeLocalsendSuccess(std::move(result), wasThrown, exceptionDetails); + callback->sendSuccess(std::move(result), exceptionDetails); return true; } callback->sendFailure(errorString); @@ -233,7 +229,7 @@ void V8RuntimeAgentImpl::evaluate( const String16& expression, const Maybe& objectGroup, const Maybe& includeCommandLineAPI, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& executionContextId, const Maybe& returnByValue, const Maybe& generatePreview, @@ -254,7 +250,7 @@ void V8RuntimeAgentImpl::evaluate( return; } - if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) + if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); if (userGesture.fromMaybe(false)) scope.pretendUserGesture(); @@ -329,7 +325,7 @@ void V8RuntimeAgentImpl::callFunctionOn( const String16& objectId, const String16& expression, const Maybe>& optionalArguments, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& returnByValue, const Maybe& generatePreview, const Maybe& userGesture, @@ -359,7 +355,7 @@ void V8RuntimeAgentImpl::callFunctionOn( } } - if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) + if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); if (userGesture.fromMaybe(false)) scope.pretendUserGesture(); @@ -415,7 +411,7 @@ void V8RuntimeAgentImpl::getProperties( const Maybe& generatePreview, std::unique_ptr>* result, Maybe>* internalProperties, - Maybe* exceptionDetails) + Maybe* exceptionDetails) { using protocol::Runtime::InternalPropertyDescriptor; @@ -469,9 +465,9 @@ void V8RuntimeAgentImpl::releaseObjectGroup(ErrorString*, const String16& object m_session->releaseObjectGroup(objectGroup); } -void V8RuntimeAgentImpl::run(ErrorString* errorString) +void V8RuntimeAgentImpl::runIfWaitingForDebugger(ErrorString* errorString) { - m_inspector->client()->resumeStartup(m_session->contextGroupId()); + m_inspector->client()->runIfWaitingForDebugger(m_session->contextGroupId()); } void V8RuntimeAgentImpl::setCustomObjectFormatterEnabled(ErrorString*, bool enabled) @@ -492,7 +488,7 @@ void V8RuntimeAgentImpl::compileScript(ErrorString* errorString, bool persistScript, const Maybe& executionContextId, Maybe* scriptId, - Maybe* exceptionDetails) + Maybe* exceptionDetails) { if (!m_enabled) { *errorString = "Runtime agent is not enabled"; @@ -511,9 +507,8 @@ void V8RuntimeAgentImpl::compileScript(ErrorString* errorString, if (!persistScript) m_inspector->debugger()->unmuteScriptParsedEvents(); if (script.IsEmpty()) { - v8::Local message = scope.tryCatch().Message(); - if (!message.IsEmpty()) - *exceptionDetails = scope.injectedScript()->createExceptionDetails(message); + if (scope.tryCatch().HasCaught()) + *exceptionDetails = scope.injectedScript()->createExceptionDetails(errorString, scope.tryCatch(), String16(), false); else *errorString = "Script compilation failed"; return; @@ -532,7 +527,7 @@ void V8RuntimeAgentImpl::runScript( const String16& scriptId, const Maybe& executionContextId, const Maybe& objectGroup, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& includeCommandLineAPI, const Maybe& returnByValue, const Maybe& generatePreview, @@ -563,7 +558,7 @@ void V8RuntimeAgentImpl::runScript( return; } - if (doNotPauseOnExceptionsAndMuteConsole.fromMaybe(false)) + if (silent.fromMaybe(false)) scope.ignoreExceptionsAndMuteConsole(); std::unique_ptr> scriptWrapper = std::move(it->second); @@ -689,4 +684,4 @@ void V8RuntimeAgentImpl::reportMessage(V8ConsoleMessage* message, bool generateP m_frontend.flush(); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.h index 8594ce8e2d52af..d08a0b63311a83 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8RuntimeAgentImpl.h @@ -31,13 +31,12 @@ #ifndef V8RuntimeAgentImpl_h #define V8RuntimeAgentImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Runtime.h" #include -namespace blink { +namespace v8_inspector { class InjectedScript; class InspectedContext; @@ -46,11 +45,8 @@ class V8ConsoleMessage; class V8InspectorImpl; class V8InspectorSessionImpl; -namespace protocol { -class DictionaryValue; -} - -using protocol::Maybe; +namespace protocol = blink::protocol; +using blink::protocol::Maybe; class V8RuntimeAgentImpl : public protocol::Runtime::Backend { PROTOCOL_DISALLOW_COPY(V8RuntimeAgentImpl); @@ -66,7 +62,7 @@ class V8RuntimeAgentImpl : public protocol::Runtime::Backend { const String16& expression, const Maybe& objectGroup, const Maybe& includeCommandLineAPI, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& executionContextId, const Maybe& returnByValue, const Maybe& generatePreview, @@ -82,7 +78,7 @@ class V8RuntimeAgentImpl : public protocol::Runtime::Backend { const String16& objectId, const String16& expression, const Maybe>& optionalArguments, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& returnByValue, const Maybe& generatePreview, const Maybe& userGesture, @@ -98,7 +94,7 @@ class V8RuntimeAgentImpl : public protocol::Runtime::Backend { Maybe>* internalProperties, Maybe*) override; void releaseObjectGroup(ErrorString*, const String16& objectGroup) override; - void run(ErrorString*) override; + void runIfWaitingForDebugger(ErrorString*) override; void setCustomObjectFormatterEnabled(ErrorString*, bool) override; void discardConsoleEntries(ErrorString*) override; void compileScript(ErrorString*, @@ -112,7 +108,7 @@ class V8RuntimeAgentImpl : public protocol::Runtime::Backend { const String16&, const Maybe& executionContextId, const Maybe& objectGroup, - const Maybe& doNotPauseOnExceptionsAndMuteConsole, + const Maybe& silent, const Maybe& includeCommandLineAPI, const Maybe& returnByValue, const Maybe& generatePreview, @@ -137,6 +133,6 @@ class V8RuntimeAgentImpl : public protocol::Runtime::Backend { protocol::HashMap>> m_compiledScripts; }; -} // namespace blink +} // namespace v8_inspector #endif // V8RuntimeAgentImpl_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.cpp new file mode 100644 index 00000000000000..c43120f66c1f34 --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.cpp @@ -0,0 +1,29 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "platform/v8_inspector/V8SchemaAgentImpl.h" + +#include "platform/v8_inspector/V8InspectorSessionImpl.h" + +namespace v8_inspector { + +V8SchemaAgentImpl::V8SchemaAgentImpl(V8InspectorSessionImpl* session, protocol::FrontendChannel* frontendChannel, protocol::DictionaryValue* state) + : m_session(session) + , m_frontend(frontendChannel) +{ +} + +V8SchemaAgentImpl::~V8SchemaAgentImpl() +{ +} + +void V8SchemaAgentImpl::getDomains(ErrorString*, std::unique_ptr>* result) +{ + std::vector> domains = m_session->supportedDomainsImpl(); + *result = protocol::Array::create(); + for (size_t i = 0; i < domains.size(); ++i) + (*result)->addItem(std::move(domains[i])); +} + +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.h new file mode 100644 index 00000000000000..9838af6ce910fa --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8SchemaAgentImpl.h @@ -0,0 +1,33 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8SchemaAgentImpl_h +#define V8SchemaAgentImpl_h + +#include "platform/inspector_protocol/InspectorProtocol.h" +#include "platform/v8_inspector/protocol/Schema.h" + +namespace v8_inspector { + +class V8InspectorSessionImpl; + +namespace protocol = blink::protocol; + +class V8SchemaAgentImpl : public protocol::Schema::Backend { + PROTOCOL_DISALLOW_COPY(V8SchemaAgentImpl); +public: + V8SchemaAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, protocol::DictionaryValue* state); + ~V8SchemaAgentImpl() override; + + void getDomains(ErrorString*, std::unique_ptr>*) override; + +private: + V8InspectorSessionImpl* m_session; + protocol::Schema::Frontend m_frontend; +}; + +} // namespace v8_inspector + + +#endif // !defined(V8SchemaAgentImpl_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.cpp index 0a8e6e1e489336..e0bab17d89084f 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.cpp @@ -4,8 +4,6 @@ #include "platform/v8_inspector/V8StackTraceImpl.h" -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" #include "platform/v8_inspector/V8Debugger.h" #include "platform/v8_inspector/V8StringUtil.h" @@ -13,7 +11,7 @@ #include #include -namespace blink { +namespace v8_inspector { namespace { @@ -256,12 +254,12 @@ String16 V8StackTraceImpl::toString() const stackTrace.append(" ("); stackTrace.append(frame.sourceURL()); stackTrace.append(':'); - stackTrace.appendNumber(frame.lineNumber()); + stackTrace.append(String16::fromInteger(frame.lineNumber())); stackTrace.append(':'); - stackTrace.appendNumber(frame.columnNumber()); + stackTrace.append(String16::fromInteger(frame.columnNumber())); stackTrace.append(')'); } return stackTrace.toString(); } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.h index 9d9a4892f1d2a7..25ad3ab09d6120 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StackTraceImpl.h @@ -5,18 +5,19 @@ #ifndef V8StackTraceImpl_h #define V8StackTraceImpl_h -#include "platform/inspector_protocol/Allocator.h" -#include "platform/inspector_protocol/Platform.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Runtime.h" #include "platform/v8_inspector/public/V8StackTrace.h" #include -namespace blink { +namespace v8_inspector { class TracedValue; class V8Debugger; +namespace protocol = blink::protocol; + // Note: async stack trace may have empty top stack with non-empty tail to indicate // that current native-only state had some async story. // On the other hand, any non-top async stack is guaranteed to be non-empty. @@ -80,6 +81,6 @@ class V8StackTraceImpl final : public V8StackTrace { std::unique_ptr m_parent; }; -} // namespace blink +} // namespace v8_inspector #endif // V8StackTraceImpl_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.cpp index 037d91036cfde8..d078da6a0e3b75 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.cpp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.cpp @@ -4,21 +4,17 @@ #include "platform/v8_inspector/V8StringUtil.h" -#include "platform/inspector_protocol/String16.h" #include "platform/v8_inspector/V8InspectorImpl.h" #include "platform/v8_inspector/V8InspectorSessionImpl.h" #include "platform/v8_inspector/V8Regex.h" -namespace blink { +namespace v8_inspector { namespace { -String16 findMagicComment(const String16& content, const String16& name, bool multiline, bool* deprecated) +String16 findMagicComment(const String16& content, const String16& name, bool multiline) { - DCHECK(name.find("=") == kNotFound); - if (deprecated) - *deprecated = false; - + DCHECK(name.find("=") == String16::kNotFound); unsigned length = content.length(); unsigned nameLength = name.length(); @@ -27,7 +23,7 @@ String16 findMagicComment(const String16& content, const String16& name, bool mu size_t closingCommentPos = 0; while (true) { pos = content.reverseFind(name, pos); - if (pos == kNotFound) + if (pos == String16::kNotFound) return String16(); // Check for a /\/[\/*][@#][ \t]/ regexp (length of 4) before found name. @@ -48,16 +44,13 @@ String16 findMagicComment(const String16& content, const String16& name, bool mu continue; if (multiline) { closingCommentPos = content.find("*/", equalSignPos + 1); - if (closingCommentPos == kNotFound) + if (closingCommentPos == String16::kNotFound) return String16(); } break; } - if (deprecated && content[pos + 2] == '@') - *deprecated = true; - DCHECK(equalSignPos); DCHECK(!multiline || closingCommentPos); size_t urlPos = equalSignPos + 1; @@ -66,13 +59,13 @@ String16 findMagicComment(const String16& content, const String16& name, bool mu : content.substring(urlPos); size_t newLine = match.find("\n"); - if (newLine != kNotFound) + if (newLine != String16::kNotFound) match = match.substring(0, newLine); match = match.stripWhiteSpace(); - String16 disallowedChars("\"' \t"); for (unsigned i = 0; i < match.length(); ++i) { - if (disallowedChars.find(match[i]) != kNotFound) + UChar c = match[i]; + if (c == '"' || c == '\'' || c == ' ' || c == '\t') return ""; } @@ -82,11 +75,14 @@ String16 findMagicComment(const String16& content, const String16& name, bool mu String16 createSearchRegexSource(const String16& text) { String16Builder result; - String16 specials("[](){}+-*.,?\\^$|"); for (unsigned i = 0; i < text.length(); i++) { - if (specials.find(text[i]) != kNotFound) + UChar c = text[i]; + if (c == '[' || c == ']' || c == '(' || c == ')' || c == '{' || c == '}' + || c == '+' || c == '-' || c == '*' || c == '.' || c == ',' || c == '?' + || c == '\\' || c == '^' || c == '$' || c == '|') { result.append('\\'); + } result.append(text[i]); } @@ -97,10 +93,11 @@ std::unique_ptr> lineEndings(const String16& text) { std::unique_ptr> result(new std::vector()); + const String16 lineEndString = "\n"; unsigned start = 0; while (start < text.length()) { - size_t lineEnd = text.find('\n', start); - if (lineEnd == kNotFound) + size_t lineEnd = text.find(lineEndString, start); + if (lineEnd == String16::kNotFound) break; result->push_back(static_cast(lineEnd)); @@ -123,7 +120,7 @@ std::vector> scriptRegexpMatchesByLines(const V8Regex& for (unsigned lineNumber = 0; lineNumber < size; ++lineNumber) { unsigned lineEnd = endings->at(lineNumber); String16 line = text.substring(start, lineEnd - start); - if (line.endsWith('\r')) + if (line.length() && line[line.length() - 1] == '\r') line = line.substring(0, line.length() - 1); int matchLength; @@ -197,14 +194,14 @@ std::vector> searchInTextByLine return result; } -String16 findSourceURL(const String16& content, bool multiline, bool* deprecated) +String16 findSourceURL(const String16& content, bool multiline) { - return findMagicComment(content, "sourceURL", multiline, deprecated); + return findMagicComment(content, "sourceURL", multiline); } -String16 findSourceMapURL(const String16& content, bool multiline, bool* deprecated) +String16 findSourceMapURL(const String16& content, bool multiline) { - return findMagicComment(content, "sourceMappingURL", multiline, deprecated); + return findMagicComment(content, "sourceMappingURL", multiline); } std::unique_ptr toProtocolValue(v8::Local context, v8::Local value, int maxDepth) @@ -280,4 +277,4 @@ std::unique_ptr toProtocolValue(v8::Local context, return nullptr; } -} // namespace blink +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.h index 029ed5661a9e29..2245c8fed6a941 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8StringUtil.h @@ -5,15 +5,16 @@ #ifndef V8StringUtil_h #define V8StringUtil_h -#include "platform/inspector_protocol/String16.h" -#include "platform/inspector_protocol/Values.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/protocol/Debugger.h" #include -namespace blink { +namespace v8_inspector { class V8InspectorSession; +namespace protocol = blink::protocol; + std::unique_ptr toProtocolValue(v8::Local, v8::Local, int maxDepth = protocol::Value::maxDepth); v8::Local toV8String(v8::Isolate*, const String16&); @@ -23,11 +24,11 @@ v8::Local toV8StringInternalized(v8::Isolate*, const char*); String16 toProtocolString(v8::Local); String16 toProtocolStringWithTypeCheck(v8::Local); -String16 findSourceURL(const String16& content, bool multiline, bool* deprecated = nullptr); -String16 findSourceMapURL(const String16& content, bool multiline, bool* deprecated = nullptr); +String16 findSourceURL(const String16& content, bool multiline); +String16 findSourceMapURL(const String16& content, bool multiline); std::vector> searchInTextByLinesImpl(V8InspectorSession*, const String16& text, const String16& query, bool caseSensitive, bool isRegex); -} // namespace blink +} // namespace v8_inspector #endif // !defined(V8StringUtil_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.cpp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.cpp new file mode 100644 index 00000000000000..3347abeba5929a --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.cpp @@ -0,0 +1,90 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "platform/v8_inspector/V8ValueCopier.h" + +namespace v8_inspector { + +namespace { + +static int kMaxDepth = 20; +static int kMaxCalls = 1000; + +class V8ValueCopier { +public: + v8::MaybeLocal copy(v8::Local value, int depth) + { + if (++m_calls > kMaxCalls || depth > kMaxDepth) + return v8::MaybeLocal(); + + if (value.IsEmpty()) + return v8::MaybeLocal(); + if (value->IsNull() || value->IsUndefined() || value->IsBoolean() || value->IsString() || value->IsNumber()) + return value; + if (!value->IsObject()) + return v8::MaybeLocal(); + v8::Local object = value.As(); + if (object->CreationContext() != m_from) + return value; + + if (object->IsArray()) { + v8::Local array = object.As(); + v8::Local result = v8::Array::New(m_isolate, array->Length()); + if (!result->SetPrototype(m_to, v8::Null(m_isolate)).FromMaybe(false)) + return v8::MaybeLocal(); + for (size_t i = 0; i < array->Length(); ++i) { + v8::Local item; + if (!array->Get(m_from, i).ToLocal(&item)) + return v8::MaybeLocal(); + v8::Local copied; + if (!copy(item, depth + 1).ToLocal(&copied)) + return v8::MaybeLocal(); + if (!result->Set(m_to, i, copied).FromMaybe(false)) + return v8::MaybeLocal(); + } + return result; + } + + + v8::Local result = v8::Object::New(m_isolate); + if (!result->SetPrototype(m_to, v8::Null(m_isolate)).FromMaybe(false)) + return v8::MaybeLocal(); + v8::Local properties; + if (!object->GetOwnPropertyNames(m_from).ToLocal(&properties)) + return v8::MaybeLocal(); + for (size_t i = 0; i < properties->Length(); ++i) { + v8::Local name; + if (!properties->Get(m_from, i).ToLocal(&name) || !name->IsString()) + return v8::MaybeLocal(); + v8::Local property; + if (!object->Get(m_from, name).ToLocal(&property)) + return v8::MaybeLocal(); + v8::Local copied; + if (!copy(property, depth + 1).ToLocal(&copied)) + return v8::MaybeLocal(); + if (!result->Set(m_to, name, copied).FromMaybe(false)) + return v8::MaybeLocal(); + } + return result; + } + + v8::Isolate* m_isolate; + v8::Local m_from; + v8::Local m_to; + int m_calls; +}; + +} // namespace + +v8::MaybeLocal copyValueFromDebuggerContext(v8::Isolate* isolate, v8::Local debuggerContext, v8::Local toContext, v8::Local value) +{ + V8ValueCopier copier; + copier.m_isolate = isolate; + copier.m_from = debuggerContext; + copier.m_to = toContext; + copier.m_calls = 0; + return copier.copy(value, 0); +} + +} // namespace v8_inspector diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.h new file mode 100644 index 00000000000000..9cd650cc80168b --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/V8ValueCopier.h @@ -0,0 +1,16 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8ValueCopier_h +#define V8ValueCopier_h + +#include + +namespace v8_inspector { + +v8::MaybeLocal copyValueFromDebuggerContext(v8::Isolate*, v8::Local debuggerContext, v8::Local toContext, v8::Local); + +} // namespace v8_inspector + +#endif // !defined(V8ValueCopier_h) diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/debugger_script_externs.js b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/debugger_script_externs.js index dddc709a57a471..7e80895ed587d0 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/debugger_script_externs.js +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/debugger_script_externs.js @@ -29,8 +29,7 @@ var RawLocation; startColumn: number, endColumn: number, executionContextId: number, - executionContextAuxData: string, - isInternalScript: boolean + executionContextAuxData: string }} */ var FormattedScript; diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config.json b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config.json new file mode 100644 index 00000000000000..512a1db7ef8d2c --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config.json @@ -0,0 +1,29 @@ +{ + "protocol": { + "path": "js_protocol.json", + "package": "platform/v8_inspector/protocol", + "output": "v8_inspector/protocol" + }, + + "exported": { + "package": "platform/v8_inspector/public/protocol", + "output": "v8_inspector/public/protocol" + }, + + "string": { + "class_name": "String16" + }, + + "lib": { + "output": "inspector_protocol", + "string16_header": "platform/v8_inspector/String16WTF.h", + "platform_header": "platform/v8_inspector/PlatformWTF.h" + }, + + "lib_package": "platform/inspector_protocol", + + "class_export": { + "macro": "PLATFORM_EXPORT", + "header": "platform/PlatformExport.h" + } +} diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config_stl.json b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config_stl.json new file mode 100644 index 00000000000000..1c5ee878cc2bdf --- /dev/null +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/inspector_protocol_config_stl.json @@ -0,0 +1,29 @@ +{ + "protocol": { + "path": "js_protocol.json", + "package": "platform/v8_inspector/protocol", + "output": "v8_inspector/protocol" + }, + + "exported": { + "package": "platform/v8_inspector/public/protocol", + "output": "v8_inspector/public/protocol" + }, + + "string": { + "class_name": "String16" + }, + + "lib": { + "output": "inspector_protocol", + "string16_header": "platform/v8_inspector/String16STL.h", + "platform_header": "platform/v8_inspector/PlatformSTL.h" + }, + + "lib_package": "platform/inspector_protocol", + + "class_export": { + "macro": "PLATFORM_EXPORT", + "header": "platform/PlatformExport.h" + } +} diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/js_protocol.json b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/js_protocol.json index 161cdb89e17f8c..43b788d5b16ee8 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/js_protocol.json +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/js_protocol.json @@ -1,6 +1,34 @@ { "version": { "major": "1", "minor": "1" }, - "domains": [{ + "domains": [ + { + "domain": "Schema", + "description": "Provides information about the protocol schema.", + "experimental": true, + "types": [ + { + "id": "Domain", + "type": "object", + "description": "Description of the protocol domain.", + "exported": true, + "properties": [ + { "name": "name", "type": "string", "description": "Domain name." }, + { "name": "version", "type": "string", "description": "Domain version." } + ] + } + ], + "commands": [ + { + "name": "getDomains", + "description": "Returns supported domains.", + "handlers": ["browser", "renderer"], + "returns": [ + { "name": "domains", "type": "array", "items": { "$ref": "Domain" }, "description": "List of supported domains." } + ] + } + ] + }, + { "domain": "Runtime", "description": "Runtime domain exposes JavaScript runtime by means of remote evaluation and mirror objects. Evaluation results are returned as mirror object that expose object type, string representation and unique identifier that can be used for further object reference. Original objects are maintained in memory unless they are either explicitly released or are released along with the other objects in their object group.", "types": [ @@ -143,12 +171,15 @@ "experimental": true, "description": "Detailed information about exception (or error) that was thrown during script compilation or execution.", "properties": [ - { "name": "text", "type": "string", "description": "Exception text." }, - { "name": "scriptId", "$ref": "ScriptId", "description": "Script ID of the exception location." }, + { "name": "exceptionId", "type": "integer", "description": "Exception id." }, + { "name": "text", "type": "string", "description": "Exception text, which should be used together with exception object when available." }, { "name": "lineNumber", "type": "integer", "description": "Line number of the exception location (0-based)." }, { "name": "columnNumber", "type": "integer", "description": "Column number of the exception location (0-based)." }, + { "name": "scriptId", "$ref": "ScriptId", "optional": true, "description": "Script ID of the exception location." }, { "name": "url", "type": "string", "optional": true, "description": "URL of the exception location, to be used when the script was not reported." }, - { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace if available." } + { "name": "stackTrace", "$ref": "StackTrace", "optional": true, "description": "JavaScript stack trace if available." }, + { "name": "exception", "$ref": "RemoteObject", "optional": true, "description": "Exception object if available." }, + { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Identifier of the context where exception happened." } ] }, { @@ -189,7 +220,7 @@ { "name": "expression", "type": "string", "description": "Expression to evaluate." }, { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation.", "experimental": true }, - { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.", "experimental": true }, + { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.", "experimental": true }, { "name": "contextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page." }, { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, @@ -198,7 +229,6 @@ ], "returns": [ { "name": "result", "$ref": "RemoteObject", "description": "Evaluation result." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "experimental": true, "description": "Exception details."} ], "description": "Evaluates expression on global object." @@ -214,7 +244,6 @@ ], "returns": [ { "name": "result", "$ref": "RemoteObject", "description": "Promise result. Will contain rejected value if promise was rejected." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the promise was rejected." }, { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details if stack strace is available."} ], "description": "Add handler to promise with given promise object id." @@ -226,7 +255,7 @@ { "name": "objectId", "$ref": "RemoteObjectId", "description": "Identifier of the object to call function on." }, { "name": "functionDeclaration", "type": "string", "description": "Declaration of the function to call." }, { "name": "arguments", "type": "array", "items": { "$ref": "CallArgument", "description": "Call argument." }, "optional": true, "description": "Call arguments. All call arguments must belong to the same JavaScript world as the target object." }, - { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether function call should stop on exceptions and mute console. Overrides setPauseOnException state.", "experimental": true }, + { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.", "experimental": true }, { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." }, { "name": "userGesture", "type": "boolean", "optional": true, "experimental": true, "description": "Whether execution should be treated as initiated by user in the UI." }, @@ -234,7 +263,6 @@ ], "returns": [ { "name": "result", "$ref": "RemoteObject", "description": "Call result." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "experimental": true, "description": "Exception details."} ], "description": "Calls function with given declaration on the given object. Object group of the result is inherited from the target object." @@ -269,9 +297,9 @@ "description": "Releases all remote objects that belong to a given group." }, { - "name": "run", + "name": "runIfWaitingForDebugger", "experimental": true, - "description": "Tells inspected instance(worker or page) that it can run in case it was started paused." + "description": "Tells inspected instance to run if it was waiting for debugger to attach." }, { "name": "enable", @@ -320,7 +348,7 @@ { "name": "scriptId", "$ref": "ScriptId", "description": "Id of the script to run." }, { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page." }, { "name": "objectGroup", "type": "string", "optional": true, "description": "Symbolic group name that can be used to release multiple objects." }, - { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether script run should stop on exceptions and mute console. Overrides setPauseOnException state." }, + { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.", "experimental": true }, { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Determines whether Command Line API should be available during the evaluation." }, { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object which should be sent by value." }, { "name": "generatePreview", "type": "boolean", "optional": true, "description": "Whether preview should be generated for the result." }, @@ -328,7 +356,6 @@ ], "returns": [ { "name": "result", "$ref": "RemoteObject", "description": "Run result." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the execution." }, { "name": "exceptionDetails", "$ref": "ExceptionDetails", "optional": true, "description": "Exception details."} ], "description": "Runs script with given id in a given context." @@ -357,11 +384,8 @@ "name": "exceptionThrown", "description": "Issued when exception was thrown and unhandled.", "parameters": [ - { "name": "exceptionId", "type": "integer", "description": "Exception id." }, { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp of the exception." }, - { "name": "details", "$ref": "ExceptionDetails" }, - { "name": "exception", "$ref": "RemoteObject", "optional": true, "description": "Exception object." }, - { "name": "executionContextId", "$ref": "ExecutionContextId", "optional": true, "description": "Identifier of the context where exception happened." } + { "name": "exceptionDetails", "$ref": "ExceptionDetails" } ], "experimental": true }, @@ -369,7 +393,7 @@ "name": "exceptionRevoked", "description": "Issued when unhandled exception was revoked.", "parameters": [ - { "name": "message", "type": "string", "description": "Message describing why exception was revoked." }, + { "name": "reason", "type": "string", "description": "Reason describing why exception was revoked." }, { "name": "exceptionId", "type": "integer", "description": "The id of revoked exception, as reported in exceptionUnhandled." } ], "experimental": true @@ -388,6 +412,7 @@ }, { "name": "inspectRequested", + "description": "Issued when object should be inspected (for example, as a result of inspect() command line API call).", "parameters": [ { "name": "object", "$ref": "RemoteObject" }, { "name": "hints", "type": "object" } @@ -489,7 +514,7 @@ "name": "setSkipAllPauses", "experimental": true, "parameters": [ - { "name": "skipped", "type": "boolean", "description": "New value for skip pauses state." } + { "name": "skip", "type": "boolean", "description": "New value for skip pauses state." } ], "description": "Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc)." }, @@ -530,8 +555,7 @@ { "name": "continueToLocation", "parameters": [ - { "name": "location", "$ref": "Location", "description": "Location to continue to." }, - { "name": "interstatementLocation", "type": "boolean", "optional": true, "experimental": true, "description": "Allows breakpoints at the intemediate positions inside statements." } + { "name": "location", "$ref": "Location", "description": "Location to continue to." } ], "description": "Continues execution until specific location is reached." }, @@ -568,25 +592,18 @@ ], "description": "Searches for given string in script content." }, - { - "name": "canSetScriptSource", - "returns": [ - { "name": "result", "type": "boolean", "description": "True if setScriptSource is supported." } - ], - "description": "Always returns true." - }, { "name": "setScriptSource", "parameters": [ { "name": "scriptId", "$ref": "Runtime.ScriptId", "description": "Id of the script to edit." }, { "name": "scriptSource", "type": "string", "description": "New content of the script." }, - { "name": "preview", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Preview mode may be used to get result description without actually modifying the code.", "experimental": true } + { "name": "dryRun", "type": "boolean", "optional": true, "description": " If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code.", "experimental": true } ], "returns": [ { "name": "callFrames", "type": "array", "optional": true, "items": { "$ref": "CallFrame" }, "description": "New stack trace in case editing has happened while VM was stopped." }, { "name": "stackChanged", "type": "boolean", "optional": true, "description": "Whether current call stack was modified after applying the changes.", "experimental": true }, { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any.", "experimental": true }, - { "name": "compileError", "optional": true, "$ref": "Runtime.ExceptionDetails", "description": "Error data if any." } + { "name": "exceptionDetails", "optional": true, "$ref": "Runtime.ExceptionDetails", "description": "Exception details if any." } ], "description": "Edits JavaScript source live." }, @@ -626,13 +643,12 @@ { "name": "expression", "type": "string", "description": "Expression to evaluate." }, { "name": "objectGroup", "type": "string", "optional": true, "description": "String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup)." }, { "name": "includeCommandLineAPI", "type": "boolean", "optional": true, "description": "Specifies whether command line API should be available to the evaluated expression, defaults to false.", "experimental": true }, - { "name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true, "description": "Specifies whether evaluation should stop on exceptions and mute console. Overrides setPauseOnException state.", "experimental": true }, + { "name": "silent", "type": "boolean", "optional": true, "description": "In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state.", "experimental": true }, { "name": "returnByValue", "type": "boolean", "optional": true, "description": "Whether the result is expected to be a JSON object that should be sent by value." }, { "name": "generatePreview", "type": "boolean", "optional": true, "experimental": true, "description": "Whether preview should be generated for the result." } ], "returns": [ { "name": "result", "$ref": "Runtime.RemoteObject", "description": "Object wrapper for the evaluation result." }, - { "name": "wasThrown", "type": "boolean", "optional": true, "description": "True if the result was thrown during the evaluation." }, { "name": "exceptionDetails", "$ref": "Runtime.ExceptionDetails", "optional": true, "experimental": true, "description": "Exception details."} ], "description": "Evaluates expression on a given call frame." @@ -648,15 +664,6 @@ "experimental": true, "description": "Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually." }, - { - "name": "getBacktrace", - "returns": [ - { "name": "callFrames", "type": "array", "items": { "$ref": "CallFrame" }, "description": "Call stack the virtual machine stopped on." }, - { "name": "asyncStackTrace", "$ref": "Runtime.StackTrace", "optional": true, "description": "Async stack trace, if any." } - ], - "experimental": true, - "description": "Returns call stack including variables changed since VM was paused. VM must be paused." - }, { "name": "setAsyncCallStackDepth", "parameters": [ @@ -696,11 +703,9 @@ { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context.", "experimental": true }, { "name": "hash", "type": "string", "experimental": true, "description": "Content hash of the script."}, { "name": "executionContextAuxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data.", "experimental": true }, - { "name": "isInternalScript", "type": "boolean", "optional": true, "description": "Determines whether this script is an internal script.", "experimental": true }, { "name": "isLiveEdit", "type": "boolean", "optional": true, "description": "True, if this script is generated as a result of the live edit operation.", "experimental": true }, { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "experimental": true }, - { "name": "deprecatedCommentWasUsed", "type": "boolean", "optional": true, "experimental": true, "description": "True, if '//@ sourceURL' or '//@ sourceMappingURL' was used."} + { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "experimental": true } ], "description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger." }, @@ -716,10 +721,8 @@ { "name": "executionContextId", "$ref": "Runtime.ExecutionContextId", "description": "Specifies script creation context.", "experimental": true }, { "name": "hash", "type": "string", "experimental": true, "description": "Content hash of the script."}, { "name": "executionContextAuxData", "type": "object", "optional": true, "description": "Embedder-specific auxiliary data.", "experimental": true }, - { "name": "isInternalScript", "type": "boolean", "optional": true, "description": "Determines whether this script is an internal script.", "experimental": true }, { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }, - { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "experimental": true }, - { "name": "deprecatedCommentWasUsed", "type": "boolean", "optional": true, "experimental": true, "description": "True, if '//@ sourceURL' or '//@ sourceMappingURL' was used."} + { "name": "hasSourceURL", "type": "boolean", "optional": true, "description": "True, if this script has sourceURL.", "experimental": true } ], "description": "Fired when virtual machine fails to parse the script." }, @@ -789,20 +792,6 @@ { "name": "message", "$ref": "ConsoleMessage", "description": "Console message that has been added." } ], "description": "Issued when new console message is added." - }, - { - "name": "messageRepeatCountUpdated", - "parameters": [ - { "name": "count", "type": "integer", "description": "New repeat count value." }, - { "name": "timestamp", "$ref": "Runtime.Timestamp", "description": "Timestamp of most recent message in batch.", "experimental": true } - ], - "description": "Not issued.", - "deprecated": true - }, - { - "name": "messagesCleared", - "description": "Not issued.", - "deprecated": true } ] }, @@ -816,12 +805,12 @@ "type": "object", "description": "CPU Profile node. Holds callsite information, execution statistics and child nodes.", "properties": [ + { "name": "id", "type": "integer", "description": "Unique id of the node." }, { "name": "callFrame", "$ref": "Runtime.CallFrame", "description": "Function location." }, { "name": "hitCount", "type": "integer", "description": "Number of samples where this node was on top of the call stack." }, - { "name": "children", "type": "array", "items": { "$ref": "CPUProfileNode" }, "description": "Child nodes." }, - { "name": "deoptReason", "type": "string", "description": "The reason of being not optimized. The function may be deoptimized or marked as don't optimize."}, - { "name": "id", "type": "integer", "description": "Unique id of the node." }, - { "name": "positionTicks", "type": "array", "items": { "$ref": "PositionTickInfo" }, "description": "An array of source position ticks." } + { "name": "children", "type": "array", "items": { "type": "integer" }, "optional": true, "description": "Child node ids." }, + { "name": "deoptReason", "type": "string", "optional": true, "description": "The reason of being not optimized. The function may be deoptimized or marked as don't optimize."}, + { "name": "positionTicks", "type": "array", "items": { "$ref": "PositionTickInfo" }, "optional": true, "experimental": true, "description": "An array of source position ticks." } ] }, { @@ -829,16 +818,17 @@ "type": "object", "description": "Profile.", "properties": [ - { "name": "head", "$ref": "CPUProfileNode" }, - { "name": "startTime", "type": "number", "description": "Profiling start time in seconds." }, - { "name": "endTime", "type": "number", "description": "Profiling end time in seconds." }, + { "name": "nodes", "type": "array", "items": { "$ref": "CPUProfileNode" }, "description": "The list of profile nodes. First item is the root node." }, + { "name": "startTime", "type": "number", "description": "Profiling start timestamp in microseconds." }, + { "name": "endTime", "type": "number", "description": "Profiling end timestamp in microseconds." }, { "name": "samples", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Ids of samples top nodes." }, - { "name": "timestamps", "optional": true, "type": "array", "items": { "type": "number" }, "description": "Timestamps of the samples in microseconds." } + { "name": "timestampDeltas", "optional": true, "type": "array", "items": { "type": "integer" }, "description": "Deltas between adjacent sample timestamps in microseconds. The first delta is relative to the profile startTime." } ] }, { "id": "PositionTickInfo", "type": "object", + "experimental": true, "description": "Specifies a number of samples attributed to a certain source position.", "properties": [ { "name": "line", "type": "integer", "description": "Source line number (1-based)." }, @@ -876,7 +866,7 @@ "parameters": [ { "name": "id", "type": "string" }, { "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profile()." }, - { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as argument to console.profile()." } + { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as an argument to console.profile()." } ], "description": "Sent when new profile recodring is started using console.profile() call." }, @@ -886,7 +876,7 @@ { "name": "id", "type": "string" }, { "name": "location", "$ref": "Debugger.Location", "description": "Location of console.profileEnd()." }, { "name": "profile", "$ref": "CPUProfile" }, - { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as argunet to console.profile()." } + { "name": "title", "type": "string", "optional": true, "description": "Profile title passed as an argument to console.profile()." } ] } ] diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/InspectorVersion.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/InspectorVersion.h index aff7b1519fb8e7..1cdee42a6e02dc 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/InspectorVersion.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/InspectorVersion.h @@ -3,4 +3,4 @@ // found in the LICENSE file. // This file is automatically generated. Do not modify. -#define V8_INSPECTOR_REVISION "62cd277117e6f8ec53e31b1be58290a6f7ab42ef" +#define V8_INSPECTOR_REVISION "60cd6e859b9f557d2312f5bf532f6aec5f284980" diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8ContextInfo.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8ContextInfo.h index 81a98e6c520198..24570a4751a93b 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8ContextInfo.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8ContextInfo.h @@ -5,11 +5,11 @@ #ifndef V8ContextInfo_h #define V8ContextInfo_h -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class V8ContextInfo { public: @@ -32,6 +32,6 @@ class V8ContextInfo { bool hasMemoryOnConsole; }; -} // namespace blink +} // namespace v8_inspector #endif // V8ContextInfo_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8Inspector.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8Inspector.h index a62f0c8b3a078d..bb078474f9bd92 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8Inspector.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8Inspector.h @@ -5,22 +5,17 @@ #ifndef V8Inspector_h #define V8Inspector_h -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/public/V8ContextInfo.h" #include -namespace blink { +namespace v8_inspector { class V8InspectorClient; class V8InspectorSession; class V8StackTrace; -namespace protocol { -class FrontendChannel; -} - class PLATFORM_EXPORT V8Inspector { public: static std::unique_ptr create(v8::Isolate*, V8InspectorClient*); @@ -49,12 +44,12 @@ class PLATFORM_EXPORT V8Inspector { virtual void exceptionRevoked(v8::Local, unsigned exceptionId, const String16& message) = 0; // API methods. - virtual std::unique_ptr connect(int contextGroupId, protocol::FrontendChannel*, const String16* state) = 0; + virtual std::unique_ptr connect(int contextGroupId, blink::protocol::FrontendChannel*, const String16* state) = 0; virtual std::unique_ptr createStackTrace(v8::Local) = 0; virtual std::unique_ptr captureStackTrace(bool fullStack) = 0; }; -} // namespace blink +} // namespace v8_inspector #endif // V8Inspector_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorClient.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorClient.h index 27495ae9884b0b..eb3e2ae7a22609 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorClient.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorClient.h @@ -5,12 +5,11 @@ #ifndef V8InspectorClient_h #define V8InspectorClient_h -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include -namespace blink { +namespace v8_inspector { class V8StackTrace; @@ -22,7 +21,7 @@ class PLATFORM_EXPORT V8InspectorClient { virtual void runMessageLoopOnPause(int contextGroupId) { } virtual void quitMessageLoopOnPause() { } - virtual void resumeStartup(int contextGroupId) { } + virtual void runIfWaitingForDebugger(int contextGroupId) { } virtual void muteMetrics(int contextGroupId) { } virtual void unmuteMetrics(int contextGroupId) { } @@ -54,7 +53,7 @@ class PLATFORM_EXPORT V8InspectorClient { virtual bool canExecuteScripts(int contextGroupId) { return true; } }; -} // namespace blink +} // namespace v8_inspector #endif // V8InspectorClient_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorSession.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorSession.h index 365ab86432ba1f..2954ae353b0a4f 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorSession.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8InspectorSession.h @@ -5,14 +5,14 @@ #ifndef V8InspectorSession_h #define V8InspectorSession_h -#include "platform/inspector_protocol/Array.h" -#include "platform/inspector_protocol/Platform.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/public/protocol/Debugger.h" #include "platform/v8_inspector/public/protocol/Runtime.h" +#include "platform/v8_inspector/public/protocol/Schema.h" #include -namespace blink { +namespace v8_inspector { class PLATFORM_EXPORT V8InspectorSession { public: @@ -30,6 +30,7 @@ class PLATFORM_EXPORT V8InspectorSession { static bool canDispatchMethod(const String16& method); virtual void dispatchProtocolMessage(const String16& message) = 0; virtual String16 stateJSON() = 0; + virtual std::unique_ptr> supportedDomains() = 0; // Debugger actions. virtual void schedulePauseOnNextStatement(const String16& breakReason, const String16& breakDetails) = 0; @@ -38,14 +39,14 @@ class PLATFORM_EXPORT V8InspectorSession { virtual void setSkipAllPauses(bool) = 0; virtual void resume() = 0; virtual void stepOver() = 0; - virtual std::unique_ptr> searchInTextByLines(const String16& text, const String16& query, bool caseSensitive, bool isRegex) = 0; + virtual std::unique_ptr> searchInTextByLines(const String16& text, const String16& query, bool caseSensitive, bool isRegex) = 0; // Remote objects. - virtual std::unique_ptr wrapObject(v8::Local, v8::Local, const String16& groupName) = 0; + virtual std::unique_ptr wrapObject(v8::Local, v8::Local, const String16& groupName) = 0; virtual bool unwrapObject(ErrorString*, const String16& objectId, v8::Local*, v8::Local*, String16* objectGroup) = 0; virtual void releaseObjectGroup(const String16&) = 0; }; -} // namespace blink +} // namespace v8_inspector #endif // V8InspectorSession_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8StackTrace.h b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8StackTrace.h index 1913554a20e141..ac68c1b0e9ea0a 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8StackTrace.h +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/public/V8StackTrace.h @@ -5,13 +5,12 @@ #ifndef V8StackTrace_h #define V8StackTrace_h -#include "platform/inspector_protocol/Platform.h" -#include "platform/inspector_protocol/String16.h" +#include "platform/inspector_protocol/InspectorProtocol.h" #include "platform/v8_inspector/public/protocol/Runtime.h" #include -namespace blink { +namespace v8_inspector { class V8StackTrace { public: @@ -23,13 +22,13 @@ class V8StackTrace { virtual String16 topFunctionName() const = 0; virtual ~V8StackTrace() { } - virtual std::unique_ptr buildInspectorObject() const = 0; + virtual std::unique_ptr buildInspectorObject() const = 0; virtual String16 toString() const = 0; // Safe to pass between threads, drops async chain. virtual std::unique_ptr clone() = 0; }; -} // namespace blink +} // namespace v8_inspector #endif // V8StackTrace_h diff --git a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/v8_inspector.gyp b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/v8_inspector.gyp index ebfc91a66d4b19..dead4f127f49a0 100644 --- a/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/v8_inspector.gyp +++ b/deps/v8_inspector/third_party/v8_inspector/platform/v8_inspector/v8_inspector.gyp @@ -6,6 +6,85 @@ 'variables': { 'blink_platform_output_dir': '<(SHARED_INTERMEDIATE_DIR)/blink/platform', }, + 'conditions': [ + ['v8_inspector!="true"', + { + 'targets': [ + { + # GN version: //third_party/WebKit/Source/platform:inspector_protocol_sources + 'target_name': 'protocol_sources', + 'type': 'none', + 'dependencies': ['protocol_version'], + 'actions': [ + { + 'action_name': 'generateV8InspectorProtocolBackendSources', + 'inputs': [ + # Source code templates. + '../inspector_protocol/Allocator_h.template', + '../inspector_protocol/Array_h.template', + '../inspector_protocol/BackendCallback_h.template', + '../inspector_protocol/CodeGenerator.py', + '../inspector_protocol/Collections_h.template', + '../inspector_protocol/DispatcherBase_cpp.template', + '../inspector_protocol/DispatcherBase_h.template', + '../inspector_protocol/ErrorSupport_cpp.template', + '../inspector_protocol/ErrorSupport_h.template', + '../inspector_protocol/Exported_h.template', + '../inspector_protocol/FrontendChannel_h.template', + '../inspector_protocol/Imported_h.template', + '../inspector_protocol/InspectorProtocol_cpp.template', + '../inspector_protocol/Maybe_h.template', + '../inspector_protocol/Object_cpp.template', + '../inspector_protocol/Object_h.template', + '../inspector_protocol/Parser_cpp.template', + '../inspector_protocol/Parser_h.template', + '../inspector_protocol/Platform_h.template', + '../inspector_protocol/String16_cpp.template', + '../inspector_protocol/String16_h.template', + '../inspector_protocol/TypeBuilder_cpp.template', + '../inspector_protocol/TypeBuilder_h.template', + '../inspector_protocol/ValueConversions_h.template', + '../inspector_protocol/Values_cpp.template', + '../inspector_protocol/Values_h.template', + # Protocol definitions + 'js_protocol.json', + # Config + 'inspector_protocol_config.json', + ], + 'outputs': [ + '<(blink_platform_output_dir)/inspector_protocol/InspectorProtocol.cpp', + '<(blink_platform_output_dir)/inspector_protocol/InspectorProtocol.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Console.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Console.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Debugger.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Debugger.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/HeapProfiler.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/HeapProfiler.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Profiler.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Profiler.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Schema.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Schema.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Debugger.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Runtime.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Schema.h', + ], + 'action': [ + 'python', + '../inspector_protocol/CodeGenerator.py', + '--output_base', '<(blink_platform_output_dir)', + '--config', 'inspector_protocol_config.json', + ], + 'message': 'Generating protocol backend sources from json definitions.', + }, + ] + }, + ], + }, + ], + ], + 'targets': [ { # GN version: //third_party/WebKit/Source/platform:inspector_injected_script @@ -48,43 +127,73 @@ 'hard_dependency': 1, }, { - # GN version: //third_party/WebKit/Source/platform:inspector_protocol_sources - 'target_name': 'protocol_sources', + # GN version: //third_party/WebKit/Source/core/inspector:protocol_version + 'target_name': 'protocol_version', 'type': 'none', - 'dependencies': ['protocol_version'], - 'variables': { - 'conditions': [ - ['debug_devtools=="node"', { - # Node build - 'jinja_module_files': [ - '../../../jinja2/jinja2/__init__.py', - '../../../markupsafe/markupsafe/__init__.py', # jinja2 dep - ], - }, { - 'jinja_module_files': [ - '<(DEPTH)/third_party/jinja2/__init__.py', - '<(DEPTH)/third_party/markupsafe/__init__.py', # jinja2 dep - ], - } + 'actions': [ + { + 'action_name': 'generateV8InspectorProtocolVersion', + 'inputs': [ + '../inspector_protocol/generate-inspector-protocol-version', + 'js_protocol.json', ], - ], - }, + 'outputs': [ + '<(blink_platform_output_dir)/v8_inspector/protocol.json', + ], + 'action': [ + 'python', + '../inspector_protocol/generate-inspector-protocol-version', + '--o', + '<@(_outputs)', + 'js_protocol.json', + ], + 'message': 'Validate v8_inspector protocol for backwards compatibility and generate version file', + }, + ] + }, + { + 'target_name': 'protocol_sources_stl', + 'type': 'none', + 'dependencies': ['protocol_version'], 'actions': [ { - 'action_name': 'generateV8InspectorProtocolBackendSources', + 'action_name': 'generateV8InspectorProtocolBackendSourcesSTL', 'inputs': [ - '<@(jinja_module_files)', - # The python script in action below. - '../inspector_protocol/CodeGenerator.py', # Source code templates. - '../inspector_protocol/TypeBuilder_h.template', - '../inspector_protocol/TypeBuilder_cpp.template', + '../inspector_protocol/Allocator_h.template', + '../inspector_protocol/Array_h.template', + '../inspector_protocol/BackendCallback_h.template', + '../inspector_protocol/CodeGenerator.py', + '../inspector_protocol/Collections_h.template', + '../inspector_protocol/DispatcherBase_cpp.template', + '../inspector_protocol/DispatcherBase_h.template', + '../inspector_protocol/ErrorSupport_cpp.template', + '../inspector_protocol/ErrorSupport_h.template', '../inspector_protocol/Exported_h.template', + '../inspector_protocol/FrontendChannel_h.template', '../inspector_protocol/Imported_h.template', + '../inspector_protocol/InspectorProtocol_cpp.template', + '../inspector_protocol/Maybe_h.template', + '../inspector_protocol/Object_cpp.template', + '../inspector_protocol/Object_h.template', + '../inspector_protocol/Parser_cpp.template', + '../inspector_protocol/Parser_h.template', + '../inspector_protocol/Platform_h.template', + '../inspector_protocol/String16_cpp.template', + '../inspector_protocol/String16_h.template', + '../inspector_protocol/TypeBuilder_cpp.template', + '../inspector_protocol/TypeBuilder_h.template', + '../inspector_protocol/ValueConversions_h.template', + '../inspector_protocol/Values_cpp.template', + '../inspector_protocol/Values_h.template', # Protocol definitions 'js_protocol.json', + # Config + 'inspector_protocol_config_stl.json', ], 'outputs': [ + '<(blink_platform_output_dir)/inspector_protocol/InspectorProtocol.cpp', + '<(blink_platform_output_dir)/inspector_protocol/InspectorProtocol.h', '<(blink_platform_output_dir)/v8_inspector/protocol/Console.cpp', '<(blink_platform_output_dir)/v8_inspector/protocol/Console.h', '<(blink_platform_output_dir)/v8_inspector/protocol/Debugger.cpp', @@ -95,59 +204,29 @@ '<(blink_platform_output_dir)/v8_inspector/protocol/Profiler.h', '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.cpp', '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.h', - '<(blink_platform_output_dir)/v8_inspector/public/protocol/Runtime.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Schema.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Schema.h', '<(blink_platform_output_dir)/v8_inspector/public/protocol/Debugger.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Runtime.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Schema.h', ], 'action': [ 'python', '../inspector_protocol/CodeGenerator.py', - '--protocol', 'js_protocol.json', - '--string_type', 'String16', - '--export_macro', 'PLATFORM_EXPORT', - '--output_dir', '<(blink_platform_output_dir)/v8_inspector/protocol', - '--output_package', 'platform/v8_inspector/protocol', - '--exported_dir', '<(blink_platform_output_dir)/v8_inspector/public/protocol', - '--exported_package', 'platform/v8_inspector/public/protocol', + '--output_base', '<(blink_platform_output_dir)', + '--config', 'inspector_protocol_config_stl.json', ], 'message': 'Generating protocol backend sources from json definitions.', }, ] }, - { - # GN version: //third_party/WebKit/Source/core/inspector:protocol_version - 'target_name': 'protocol_version', - 'type': 'none', - 'actions': [ - { - 'action_name': 'generateV8InspectorProtocolVersion', - 'inputs': [ - '../inspector_protocol/generate-inspector-protocol-version', - 'js_protocol.json', - ], - 'outputs': [ - '<(blink_platform_output_dir)/v8_inspector/protocol.json', - ], - 'action': [ - 'python', - '../inspector_protocol/generate-inspector-protocol-version', - '--o', - '<@(_outputs)', - 'js_protocol.json', - ], - 'message': 'Validate v8_inspector protocol for backwards compatibility and generate version file', - }, - ] - }, { 'target_name': 'v8_inspector_stl', 'type': '<(component)', 'dependencies': [ ':inspector_injected_script', ':inspector_debugger_script', - ':protocol_sources', - ], - 'defines': [ - 'V8_INSPECTOR_USE_STL=1' + ':protocol_sources_stl', ], 'include_dirs': [ '../..', @@ -156,6 +235,8 @@ '<(SHARED_INTERMEDIATE_DIR)/blink', ], 'sources': [ + '<(blink_platform_output_dir)/inspector_protocol/InspectorProtocol.cpp', + '<(blink_platform_output_dir)/inspector_protocol/InspectorProtocol.h', '<(blink_platform_output_dir)/v8_inspector/protocol/Console.cpp', '<(blink_platform_output_dir)/v8_inspector/protocol/Console.h', '<(blink_platform_output_dir)/v8_inspector/protocol/Debugger.cpp', @@ -166,24 +247,11 @@ '<(blink_platform_output_dir)/v8_inspector/protocol/Profiler.h', '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.cpp', '<(blink_platform_output_dir)/v8_inspector/protocol/Runtime.h', - - '../inspector_protocol/Allocator.h', - '../inspector_protocol/Array.h', - '../inspector_protocol/Collections.h', - '../inspector_protocol/DispatcherBase.cpp', - '../inspector_protocol/DispatcherBase.h', - '../inspector_protocol/ErrorSupport.cpp', - '../inspector_protocol/ErrorSupport.h', - '../inspector_protocol/Maybe.h', - '../inspector_protocol/Parser.cpp', - '../inspector_protocol/Parser.h', - '../inspector_protocol/FrontendChannel.h', - '../inspector_protocol/String16.h', - '../inspector_protocol/String16STL.cpp', - '../inspector_protocol/String16STL.h', - '../inspector_protocol/Values.cpp', - '../inspector_protocol/Values.h', - '../inspector_protocol/ValueConversions.h', + '<(blink_platform_output_dir)/v8_inspector/protocol/Schema.cpp', + '<(blink_platform_output_dir)/v8_inspector/protocol/Schema.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Debugger.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Runtime.h', + '<(blink_platform_output_dir)/v8_inspector/public/protocol/Schema.h', 'Atomics.h', 'InjectedScript.cpp', @@ -195,9 +263,12 @@ 'JavaScriptCallFrame.cpp', 'JavaScriptCallFrame.h', 'MuteConsoleScope.h', - 'ScriptBreakpoint.h', + 'PlatformSTL.h', 'RemoteObjectId.cpp', 'RemoteObjectId.h', + 'ScriptBreakpoint.h', + 'String16STL.cpp', + 'String16STL.h', 'V8Console.cpp', 'V8Console.h', 'V8ConsoleAgentImpl.cpp', @@ -228,10 +299,14 @@ 'V8Regex.h', 'V8RuntimeAgentImpl.cpp', 'V8RuntimeAgentImpl.h', + 'V8SchemaAgentImpl.cpp', + 'V8SchemaAgentImpl.h', 'V8StackTraceImpl.cpp', 'V8StackTraceImpl.h', 'V8StringUtil.cpp', 'V8StringUtil.h', + 'V8ValueCopier.cpp', + 'V8ValueCopier.h', 'public/V8EventListenerInfo.h', 'public/V8ContextInfo.h', 'public/V8Inspector.h',