Changeset 228546 in webkit


Ignore:
Timestamp:
Feb 15, 2018 6:14:29 PM (6 years ago)
Author:
Darin Adler
Message:

Web Inspector: get rid of remaining uses of OptOutput<T>
https://bugs.webkit.org/show_bug.cgi?id=180607

Reviewed by Brian Burg.

Source/JavaScriptCore:

  • inspector/AsyncStackTrace.cpp: Removed explicit Inspector prefix from code that

is inside the Inspector namespace already. Also use auto a bit.

  • inspector/AsyncStackTrace.h: Ditto.
  • inspector/ConsoleMessage.cpp: Ditto.
  • inspector/ContentSearchUtilities.cpp: More Inspector namespace removal and ...

(Inspector::ContentSearchUtilities::getRegularExpressionMatchesByLines): Use a
Vector instead of a unique_ptr<Vector>.
(Inspector::ContentSearchUtilities::lineEndings): Ditto.
(Inspector::ContentSearchUtilities::stylesheetCommentPattern): Deleted.
(Inspector::ContentSearchUtilities::findMagicComment): Use std::array instead of
a Vector for a fixed size array; also got rid of reinterpret_cast.
(Inspector::ContentSearchUtilities::findStylesheetSourceMapURL): Moved the regular
expression here since it's the only place it was used.

  • inspector/ContentSearchUtilities.h: Cut down on unneeded includes.
  • inspector/InjectedScript.cpp: Removed explicit Inspector prefix from code that

is inside the Inspector namespace already. Also use auto a bit.

  • inspector/InspectorProtocolTypes.h: Removed OptOutput. Simplified assertions.

Removed base template for BindingTraits; we only need the specializations.

  • inspector/ScriptCallFrame.cpp: Removed explicit Inspector prefix from code that

is inside the Inspector namespace already. Also use auto a bit.

  • inspector/ScriptCallFrame.h: Ditto.
  • inspector/ScriptCallStack.cpp: Ditto.
  • inspector/ScriptCallStack.h: Ditto.
  • inspector/agents/InspectorConsoleAgent.cpp: Ditto.
  • inspector/agents/InspectorConsoleAgent.h: Ditto.
  • inspector/agents/InspectorDebuggerAgent.cpp: More Inspector namespace removal and ...

(Inspector::InspectorDebuggerAgent::evaluateOnCallFrame): Use std::optional& intead of
OptOutput* for out arguments.

  • inspector/agents/InspectorDebuggerAgent.h: Ditto.
  • inspector/agents/InspectorHeapAgent.cpp: More Inspector namespace removal and ...

(Inspector::InspectorHeapAgent::getPreview): Use std::optional& intead of OptOutput*
for out arguments.

  • inspector/agents/InspectorHeapAgent.h: Ditto.
  • inspector/agents/InspectorRuntimeAgent.cpp: More Inspector namespace removal and ...

(Inspector::InspectorRuntimeAgent::parse): Use std::optional& intead of OptOutput*
for out arguments.
(Inspector::InspectorRuntimeAgent::evaluate): Ditto.
(Inspector::InspectorRuntimeAgent::callFunctionOn): Ditto.
(Inspector::InspectorRuntimeAgent::saveResult): Ditto.

  • inspector/agents/InspectorRuntimeAgent.h: Ditto.
  • inspector/agents/InspectorScriptProfilerAgent.cpp: More Inspector namespace removal

and removed some bogus const.

  • inspector/agents/InspectorScriptProfilerAgent.h: Ditto.
  • inspector/scripts/codegen/cpp_generator.py:

(CppGenerator.cpp_type_for_unchecked_formal_in_parameter): Removed some bogus const.
(CppGenerator.cpp_type_for_type_with_name): Ditto.
(CppGenerator.cpp_type_for_formal_out_parameter): Use std::optional& instead of
Inspector::Protocol::OptOutput*.
(CppGenerator.cpp_type_for_formal_async_parameter): Ditto.
(CppGenerator.cpp_type_for_stack_in_parameter): Ditto.
(CppGenerator.cpp_type_for_stack_out_parameter): Ditto.

  • inspector/scripts/codegen/cpp_generator_templates.py: Removed ASSERT_DISABLED

conditional around assertion code which will now compile to nothing if ASSERT is disabled.
Build strings more simply in a few cases.

  • inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:

(CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain):
Use has_value instead of isAssigned and * operator instead of getValue() since std::optional
replace OptOutput here.
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
Pass by reference instead of pointer now.

  • inspector/scripts/codegen/generate_cpp_protocol_types_header.py:

Removed ASSERT_DISABLED conditional around assertion code which will now compile to nothing
if ASSERT is disabled.

  • inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:

(CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): Generate
the assertion function unconditionally, but leave out the assertions if ASSERT_DISABLED is true.
(CppProtocolTypesImplementationGenerator): Use auto instead of writing out JSON::Object::iterator.

  • inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:

(ObjCBackendDispatcherImplementationGenerator._generate_conversions_for_command): Build strings
more simply.

  • inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
  • inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
  • inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
  • inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:

Rebaselined.

Source/WebCore:

  • inspector/InspectorStyleSheet.cpp:

(WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
(WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
of lineEndings().get().
(WebCore::InspectorStyle::styleWithProperties const): Ditto.
(WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
(WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
a std::unique_ptr<Vector>.
(WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.

  • inspector/InspectorStyleSheet.h: Updated for the above.
  • inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
  • inspector/agents/InspectorCanvasAgent.cpp: Ditto.
  • inspector/agents/InspectorCanvasAgent.h: Ditto.
  • inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings

so we don't waste space with a pointer to the string.
(WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
explicit creation of String, which was wasteful and unnecessary.
(WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
(WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
(WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
(WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.

  • inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use

final instead of override.

  • inspector/agents/InspectorPageAgent.cpp: Ditto.
  • inspector/agents/InspectorPageAgent.h: Ditto.
Location:
trunk/Source
Files:
53 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r228538 r228546  
     12018-02-15  Darin Adler  <darin@apple.com>
     2
     3        Web Inspector: get rid of remaining uses of OptOutput<T>
     4        https://bugs.webkit.org/show_bug.cgi?id=180607
     5
     6        Reviewed by Brian Burg.
     7
     8        * inspector/AsyncStackTrace.cpp: Removed explicit Inspector prefix from code that
     9        is inside the Inspector namespace already. Also use auto a bit.
     10        * inspector/AsyncStackTrace.h: Ditto.
     11        * inspector/ConsoleMessage.cpp: Ditto.
     12
     13        * inspector/ContentSearchUtilities.cpp: More Inspector namespace removal and ...
     14        (Inspector::ContentSearchUtilities::getRegularExpressionMatchesByLines): Use a
     15        Vector instead of a unique_ptr<Vector>.
     16        (Inspector::ContentSearchUtilities::lineEndings): Ditto.
     17        (Inspector::ContentSearchUtilities::stylesheetCommentPattern): Deleted.
     18        (Inspector::ContentSearchUtilities::findMagicComment): Use std::array instead of
     19        a Vector for a fixed size array; also got rid of reinterpret_cast.
     20        (Inspector::ContentSearchUtilities::findStylesheetSourceMapURL): Moved the regular
     21        expression here since it's the only place it was used.
     22
     23        * inspector/ContentSearchUtilities.h: Cut down on unneeded includes.
     24
     25        * inspector/InjectedScript.cpp: Removed explicit Inspector prefix from code that
     26        is inside the Inspector namespace already. Also use auto a bit.
     27
     28        * inspector/InspectorProtocolTypes.h: Removed OptOutput. Simplified assertions.
     29        Removed base template for BindingTraits; we only need the specializations.
     30
     31        * inspector/ScriptCallFrame.cpp: Removed explicit Inspector prefix from code that
     32        is inside the Inspector namespace already. Also use auto a bit.
     33        * inspector/ScriptCallFrame.h: Ditto.
     34        * inspector/ScriptCallStack.cpp: Ditto.
     35        * inspector/ScriptCallStack.h: Ditto.
     36        * inspector/agents/InspectorConsoleAgent.cpp: Ditto.
     37        * inspector/agents/InspectorConsoleAgent.h: Ditto.
     38
     39        * inspector/agents/InspectorDebuggerAgent.cpp: More Inspector namespace removal and ...
     40        (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame): Use std::optional& intead of
     41        OptOutput* for out arguments.
     42        * inspector/agents/InspectorDebuggerAgent.h: Ditto.
     43
     44        * inspector/agents/InspectorHeapAgent.cpp: More Inspector namespace removal and ...
     45        (Inspector::InspectorHeapAgent::getPreview): Use std::optional& intead of OptOutput*
     46        for out arguments.
     47        * inspector/agents/InspectorHeapAgent.h: Ditto.
     48
     49        * inspector/agents/InspectorRuntimeAgent.cpp: More Inspector namespace removal and ...
     50        (Inspector::InspectorRuntimeAgent::parse): Use std::optional& intead of OptOutput*
     51        for out arguments.
     52        (Inspector::InspectorRuntimeAgent::evaluate): Ditto.
     53        (Inspector::InspectorRuntimeAgent::callFunctionOn): Ditto.
     54        (Inspector::InspectorRuntimeAgent::saveResult): Ditto.
     55        * inspector/agents/InspectorRuntimeAgent.h: Ditto.
     56
     57        * inspector/agents/InspectorScriptProfilerAgent.cpp: More Inspector namespace removal
     58        and removed some bogus const.
     59        * inspector/agents/InspectorScriptProfilerAgent.h: Ditto.
     60
     61        * inspector/scripts/codegen/cpp_generator.py:
     62        (CppGenerator.cpp_type_for_unchecked_formal_in_parameter): Removed some bogus const.
     63        (CppGenerator.cpp_type_for_type_with_name): Ditto.
     64        (CppGenerator.cpp_type_for_formal_out_parameter): Use std::optional& instead of
     65        Inspector::Protocol::OptOutput*.
     66        (CppGenerator.cpp_type_for_formal_async_parameter): Ditto.
     67        (CppGenerator.cpp_type_for_stack_in_parameter): Ditto.
     68        (CppGenerator.cpp_type_for_stack_out_parameter): Ditto.
     69
     70        * inspector/scripts/codegen/cpp_generator_templates.py: Removed ASSERT_DISABLED
     71        conditional around assertion code which will now compile to nothing if ASSERT is disabled.
     72        Build strings more simply in a few cases.
     73
     74        * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
     75        (CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain):
     76        Use has_value instead of isAssigned and * operator instead of getValue() since std::optional
     77        replace OptOutput here.
     78        (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command):
     79        Pass by reference instead of pointer now.
     80
     81        * inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
     82        Removed ASSERT_DISABLED conditional around assertion code which will now compile to nothing
     83        if ASSERT is disabled.
     84
     85        * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
     86        (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): Generate
     87        the assertion function unconditionally, but leave out the assertions if ASSERT_DISABLED is true.
     88        (CppProtocolTypesImplementationGenerator): Use auto instead of writing out JSON::Object::iterator.
     89
     90        * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py:
     91        (ObjCBackendDispatcherImplementationGenerator._generate_conversions_for_command): Build strings
     92        more simply.
     93
     94        * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
     95        * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
     96        * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
     97        * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:
     98        Rebaselined.
     99
    11002018-02-15  Filip Pizlo  <fpizlo@apple.com>
    2101
  • trunk/Source/JavaScriptCore/inspector/AsyncStackTrace.cpp

    r225231 r228546  
    2828
    2929#include "ScriptCallStack.h"
     30#include <wtf/Ref.h>
    3031
    3132namespace Inspector {
     
    9798}
    9899
    99 RefPtr<Inspector::Protocol::Console::StackTrace> AsyncStackTrace::buildInspectorObject() const
     100RefPtr<Protocol::Console::StackTrace> AsyncStackTrace::buildInspectorObject() const
    100101{
    101     RefPtr<Inspector::Protocol::Console::StackTrace> topStackTrace;
    102     RefPtr<Inspector::Protocol::Console::StackTrace> previousStackTrace;
     102    RefPtr<Protocol::Console::StackTrace> topStackTrace;
     103    RefPtr<Protocol::Console::StackTrace> previousStackTrace;
    103104
    104105    auto* stackTrace = this;
     
    107108        ASSERT(callStack->size());
    108109
    109         RefPtr<Inspector::Protocol::Console::StackTrace> protocolObject = Inspector::Protocol::Console::StackTrace::create()
     110        auto protocolObject = Protocol::Console::StackTrace::create()
    110111            .setCallFrames(callStack->buildInspectorArray())
    111112            .release();
     
    117118
    118119        if (!topStackTrace)
    119             topStackTrace = protocolObject;
     120            topStackTrace = protocolObject.ptr();
    120121
    121122        if (previousStackTrace)
    122             previousStackTrace->setParentStackTrace(protocolObject);
     123            previousStackTrace->setParentStackTrace(protocolObject.ptr());
    123124
    124         previousStackTrace = protocolObject;
     125        previousStackTrace = WTFMove(protocolObject);
    125126        stackTrace = stackTrace->m_parent.get();
    126127    }
  • trunk/Source/JavaScriptCore/inspector/AsyncStackTrace.h

    r212448 r228546  
    5252    void didCancelAsyncCall();
    5353
    54     RefPtr<Inspector::Protocol::Console::StackTrace> buildInspectorObject() const;
     54    RefPtr<Protocol::Console::StackTrace> buildInspectorObject() const;
    5555
    5656    ~AsyncStackTrace();
  • trunk/Source/JavaScriptCore/inspector/ConsoleMessage.cpp

    r228260 r228546  
    155155}
    156156
    157 static Inspector::Protocol::Console::ChannelSource messageSourceValue(MessageSource source)
     157static Protocol::Console::ChannelSource messageSourceValue(MessageSource source)
    158158{
    159159    switch (source) {
    160     case MessageSource::XML: return Inspector::Protocol::Console::ChannelSource::XML;
    161     case MessageSource::JS: return Inspector::Protocol::Console::ChannelSource::Javascript;
    162     case MessageSource::Network: return Inspector::Protocol::Console::ChannelSource::Network;
    163     case MessageSource::ConsoleAPI: return Inspector::Protocol::Console::ChannelSource::ConsoleAPI;
    164     case MessageSource::Storage: return Inspector::Protocol::Console::ChannelSource::Storage;
    165     case MessageSource::AppCache: return Inspector::Protocol::Console::ChannelSource::Appcache;
    166     case MessageSource::Rendering: return Inspector::Protocol::Console::ChannelSource::Rendering;
    167     case MessageSource::CSS: return Inspector::Protocol::Console::ChannelSource::CSS;
    168     case MessageSource::Security: return Inspector::Protocol::Console::ChannelSource::Security;
    169     case MessageSource::ContentBlocker: return Inspector::Protocol::Console::ChannelSource::ContentBlocker;
    170     case MessageSource::Other: return Inspector::Protocol::Console::ChannelSource::Other;
    171     case MessageSource::Media: return Inspector::Protocol::Console::ChannelSource::Media;
    172     case MessageSource::WebRTC: return Inspector::Protocol::Console::ChannelSource::WebRTC;
    173     }
    174     return Inspector::Protocol::Console::ChannelSource::Other;
    175 }
    176 
    177 static Inspector::Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type)
     160    case MessageSource::XML: return Protocol::Console::ChannelSource::XML;
     161    case MessageSource::JS: return Protocol::Console::ChannelSource::Javascript;
     162    case MessageSource::Network: return Protocol::Console::ChannelSource::Network;
     163    case MessageSource::ConsoleAPI: return Protocol::Console::ChannelSource::ConsoleAPI;
     164    case MessageSource::Storage: return Protocol::Console::ChannelSource::Storage;
     165    case MessageSource::AppCache: return Protocol::Console::ChannelSource::Appcache;
     166    case MessageSource::Rendering: return Protocol::Console::ChannelSource::Rendering;
     167    case MessageSource::CSS: return Protocol::Console::ChannelSource::CSS;
     168    case MessageSource::Security: return Protocol::Console::ChannelSource::Security;
     169    case MessageSource::ContentBlocker: return Protocol::Console::ChannelSource::ContentBlocker;
     170    case MessageSource::Other: return Protocol::Console::ChannelSource::Other;
     171    case MessageSource::Media: return Protocol::Console::ChannelSource::Media;
     172    case MessageSource::WebRTC: return Protocol::Console::ChannelSource::WebRTC;
     173    }
     174    return Protocol::Console::ChannelSource::Other;
     175}
     176
     177static Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type)
    178178{
    179179    switch (type) {
    180     case MessageType::Log: return Inspector::Protocol::Console::ConsoleMessage::Type::Log;
    181     case MessageType::Clear: return Inspector::Protocol::Console::ConsoleMessage::Type::Clear;
    182     case MessageType::Dir: return Inspector::Protocol::Console::ConsoleMessage::Type::Dir;
    183     case MessageType::DirXML: return Inspector::Protocol::Console::ConsoleMessage::Type::DirXML;
    184     case MessageType::Table: return Inspector::Protocol::Console::ConsoleMessage::Type::Table;
    185     case MessageType::Trace: return Inspector::Protocol::Console::ConsoleMessage::Type::Trace;
    186     case MessageType::StartGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroup;
    187     case MessageType::StartGroupCollapsed: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed;
    188     case MessageType::EndGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::EndGroup;
    189     case MessageType::Assert: return Inspector::Protocol::Console::ConsoleMessage::Type::Assert;
    190     case MessageType::Timing: return Inspector::Protocol::Console::ConsoleMessage::Type::Timing;
    191     case MessageType::Profile: return Inspector::Protocol::Console::ConsoleMessage::Type::Profile;
    192     case MessageType::ProfileEnd: return Inspector::Protocol::Console::ConsoleMessage::Type::ProfileEnd;
    193     }
    194     return Inspector::Protocol::Console::ConsoleMessage::Type::Log;
    195 }
    196 
    197 static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level)
     180    case MessageType::Log: return Protocol::Console::ConsoleMessage::Type::Log;
     181    case MessageType::Clear: return Protocol::Console::ConsoleMessage::Type::Clear;
     182    case MessageType::Dir: return Protocol::Console::ConsoleMessage::Type::Dir;
     183    case MessageType::DirXML: return Protocol::Console::ConsoleMessage::Type::DirXML;
     184    case MessageType::Table: return Protocol::Console::ConsoleMessage::Type::Table;
     185    case MessageType::Trace: return Protocol::Console::ConsoleMessage::Type::Trace;
     186    case MessageType::StartGroup: return Protocol::Console::ConsoleMessage::Type::StartGroup;
     187    case MessageType::StartGroupCollapsed: return Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed;
     188    case MessageType::EndGroup: return Protocol::Console::ConsoleMessage::Type::EndGroup;
     189    case MessageType::Assert: return Protocol::Console::ConsoleMessage::Type::Assert;
     190    case MessageType::Timing: return Protocol::Console::ConsoleMessage::Type::Timing;
     191    case MessageType::Profile: return Protocol::Console::ConsoleMessage::Type::Profile;
     192    case MessageType::ProfileEnd: return Protocol::Console::ConsoleMessage::Type::ProfileEnd;
     193    }
     194    return Protocol::Console::ConsoleMessage::Type::Log;
     195}
     196
     197static Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level)
    198198{
    199199    switch (level) {
    200     case MessageLevel::Log: return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
    201     case MessageLevel::Info: return Inspector::Protocol::Console::ConsoleMessage::Level::Info;
    202     case MessageLevel::Warning: return Inspector::Protocol::Console::ConsoleMessage::Level::Warning;
    203     case MessageLevel::Error: return Inspector::Protocol::Console::ConsoleMessage::Level::Error;
    204     case MessageLevel::Debug: return Inspector::Protocol::Console::ConsoleMessage::Level::Debug;
    205     }
    206     return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
     200    case MessageLevel::Log: return Protocol::Console::ConsoleMessage::Level::Log;
     201    case MessageLevel::Info: return Protocol::Console::ConsoleMessage::Level::Info;
     202    case MessageLevel::Warning: return Protocol::Console::ConsoleMessage::Level::Warning;
     203    case MessageLevel::Error: return Protocol::Console::ConsoleMessage::Level::Error;
     204    case MessageLevel::Debug: return Protocol::Console::ConsoleMessage::Level::Debug;
     205    }
     206    return Protocol::Console::ConsoleMessage::Level::Log;
    207207}
    208208
    209209void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher& consoleFrontendDispatcher, InjectedScriptManager& injectedScriptManager, bool generatePreview)
    210210{
    211     auto messageObject = Inspector::Protocol::Console::ConsoleMessage::create()
     211    auto messageObject = Protocol::Console::ConsoleMessage::create()
    212212        .setSource(messageSourceValue(m_source))
    213213        .setLevel(messageLevelValue(m_level))
     
    228228        InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(scriptState());
    229229        if (!injectedScript.hasNoValue()) {
    230             auto argumentsObject = JSON::ArrayOf<Inspector::Protocol::Runtime::RemoteObject>::create();
     230            auto argumentsObject = JSON::ArrayOf<Protocol::Runtime::RemoteObject>::create();
    231231            if (m_arguments && m_arguments->argumentCount()) {
    232232                if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) {
  • trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp

    r226128 r228546  
    3636#include <wtf/StdLibExtras.h>
    3737#include <wtf/text/StringBuilder.h>
     38#include <wtf/text/TextPosition.h>
    3839
    3940using namespace JSC::Yarr;
     
    8081        return result;
    8182
    82     std::unique_ptr<Vector<size_t>> endings(lineEndings(text));
    83     size_t size = endings->size();
     83    auto endings = lineEndings(text);
     84    size_t size = endings.size();
    8485    size_t start = 0;
    8586
    8687    for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) {
    87         size_t nextStart = endings->at(lineNumber);
     88        size_t nextStart = endings[lineNumber];
    8889        String line = text.substring(start, nextStart - start);
    8990
     
    9899}
    99100
    100 std::unique_ptr<Vector<size_t>> lineEndings(const String& text)
     101Vector<size_t> lineEndings(const String& text)
    101102{
    102     auto result = std::make_unique<Vector<size_t>>();
     103    Vector<size_t> result;
    103104
    104105    size_t start = 0;
     
    106107        size_t nextStart = text.find('\n', start);
    107108        if (nextStart == notFound || nextStart == (text.length() - 1)) {
    108             result->append(text.length());
     109            result.append(text.length());
    109110            break;
    110111        }
    111112
    112113        nextStart += 1;
    113         result->append(nextStart);
     114        result.append(nextStart);
    114115        start = nextStart;
    115116    }
    116117
    117     result->append(text.length());
     118    result.append(text.length());
    118119
    119120    return result;
    120121}
    121122
    122 static Ref<Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
     123static Ref<Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
    123124{
    124     return Inspector::Protocol::GenericTypes::SearchMatch::create()
     125    return Protocol::GenericTypes::SearchMatch::create()
    125126        .setLineNumber(lineNumber)
    126127        .setLineContent(lineContent)
     
    152153}
    153154
    154 Ref<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
     155Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
    155156{
    156     auto result = JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>::create();
    157 
    158     RegularExpression regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex);
    159     Vector<std::pair<size_t, String>> matches = getRegularExpressionMatchesByLines(regex, text);
    160 
    161     for (const auto& match : matches) {
    162         Ref<Inspector::Protocol::GenericTypes::SearchMatch> matchObject = buildObjectForSearchMatch(match.first, match.second);
    163         result->addItem(WTFMove(matchObject));
    164     }
    165 
     157    auto result = JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>::create();
     158    auto regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex);
     159    for (const auto& match : getRegularExpressionMatchesByLines(regex, text))
     160        result->addItem(buildObjectForSearchMatch(match.first, match.second));
    166161    return result;
    167 }
    168 
    169 static String stylesheetCommentPattern(const String& name)
    170 {
    171     // "/*# <name>=<value> */" and deprecated "/*@"
    172     return "/\\*[#@][\040\t]" + name + "=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/";
    173162}
    174163
     
    186175
    187176    ASSERT(pattern.m_numSubpatterns == 1);
    188     Vector<int, 4> matches;
    189     matches.grow(4);
    190     unsigned result = interpret(bytecodePattern.get(), content, 0, reinterpret_cast<unsigned*>(matches.data()));
     177    std::array<unsigned, 4> matches;
     178    unsigned result = interpret(bytecodePattern.get(), content, 0, matches.data());
    191179    if (result == offsetNoMatch)
    192180        return String();
     
    198186String findStylesheetSourceMapURL(const String& content)
    199187{
    200     return findMagicComment(content, stylesheetCommentPattern(ASCIILiteral("sourceMappingURL")));
     188    // "/*# <name>=<value> */" and deprecated "/*@"
     189    return findMagicComment(content, ASCIILiteral { "/\\*[#@][\040\t]sourceMappingURL=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/" });
    201190}
    202191
  • trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.h

    r225425 r228546  
    3030
    3131#include "InspectorProtocolObjects.h"
    32 #include <wtf/Vector.h>
    33 #include <wtf/text/TextPosition.h>
    34 #include <wtf/text/WTFString.h>
     32#include <wtf/Forward.h>
    3533
    3634namespace JSC { namespace Yarr {
     
    4442JS_EXPORT_PRIVATE JSC::Yarr::RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex);
    4543JS_EXPORT_PRIVATE int countRegularExpressionMatches(const JSC::Yarr::RegularExpression&, const String&);
    46 JS_EXPORT_PRIVATE Ref<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
     44JS_EXPORT_PRIVATE Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
    4745JS_EXPORT_PRIVATE TextPosition textPositionFromOffset(size_t offset, const Vector<size_t>& lineEndings);
    48 JS_EXPORT_PRIVATE std::unique_ptr<Vector<size_t>> lineEndings(const String&);
     46JS_EXPORT_PRIVATE Vector<size_t> lineEndings(const String&);
    4947
    5048JS_EXPORT_PRIVATE String findStylesheetSourceMapURL(const String& content);
  • trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp

    r225804 r228546  
    5555}
    5656
    57 void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)
     57void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)
    5858{
    5959    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluate"), inspectorEnvironment()->functionCallHandler());
     
    6767}
    6868
    69 void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, bool& wasThrown)
     69void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, bool& wasThrown)
    7070{
    7171    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("callFunctionOn"), inspectorEnvironment()->functionCallHandler());
     
    8080}
    8181
    82 void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)
     82void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)
    8383{
    8484    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluateOnCallFrame"), inspectorEnvironment()->functionCallHandler());
     
    9494}
    9595
    96 void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& result)
     96void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& result)
    9797{
    9898    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getFunctionDetails"), inspectorEnvironment()->functionCallHandler());
     
    106106    }
    107107
    108     result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
     108    result = BindingTraits<Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
    109109}
    110110
     
    121121    }
    122122
    123     result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
     123    result = BindingTraits<Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
    124124}
    125125
     
    136136    }
    137137
    138     result = BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(WTFMove(resultValue));
    139 }
    140 
    141 void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& properties)
     138    result = BindingTraits<Protocol::Runtime::ObjectPreview>::runtimeCast(WTFMove(resultValue));
     139}
     140
     141void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& properties)
    142142{
    143143    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler());
     
    152152    }
    153153
    154     properties = BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
    155 }
    156 
    157 void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& properties)
     154    properties = BindingTraits<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
     155}
     156
     157void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& properties)
    158158{
    159159    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getDisplayableProperties"), inspectorEnvironment()->functionCallHandler());
     
    167167    }
    168168
    169     properties = BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
    170 }
    171 
    172 void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& properties)
     169    properties = BindingTraits<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
     170}
     171
     172void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& properties)
    173173{
    174174    Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getInternalProperties"), inspectorEnvironment()->functionCallHandler());
     
    182182    }
    183183
    184     auto array = BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result));
     184    auto array = BindingTraits<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result));
    185185    properties = array->length() > 0 ? array : nullptr;
    186186}
     
    219219}
    220220
    221 Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(JSC::JSValue callFrames) const
     221Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(JSC::JSValue callFrames) const
    222222{
    223223    ASSERT(!hasNoValue());
     
    228228    auto callFramesValue = callFunctionWithEvalEnabled(function, hadException);
    229229    if (!callFramesValue)
    230         return JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>::create();
     230        return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create();
    231231    ASSERT(!hadException);
    232232    RefPtr<JSON::Value> result = toInspectorValue(*scriptState(), callFramesValue);
    233233    if (result->type() == JSON::Value::Type::Array)
    234         return BindingTraits<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull();
    235 
    236     return JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>::create();
    237 }
    238 
    239 RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue value, const String& groupName, bool generatePreview) const
     234        return BindingTraits<JSON::ArrayOf<Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull();
     235
     236    return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create();
     237}
     238
     239RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue value, const String& groupName, bool generatePreview) const
    240240{
    241241    ASSERT(!hasNoValue());
     
    255255    ASSERT_UNUSED(castSucceeded, castSucceeded);
    256256
    257     return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
     257    return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
    258258}
    259259
     
    278278    ASSERT_UNUSED(castSucceeded, castSucceeded);
    279279
    280     return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
    281 }
    282 
    283 RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC::JSValue table, JSC::JSValue columns) const
     280    return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
     281}
     282
     283RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC::JSValue table, JSC::JSValue columns) const
    284284{
    285285    ASSERT(!hasNoValue());
     
    301301    ASSERT_UNUSED(castSucceeded, castSucceeded);
    302302
    303     return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
    304 }
    305 
    306 RefPtr<Inspector::Protocol::Runtime::ObjectPreview> InjectedScript::previewValue(JSC::JSValue value) const
     303    return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
     304}
     305
     306RefPtr<Protocol::Runtime::ObjectPreview> InjectedScript::previewValue(JSC::JSValue value) const
    307307{
    308308    ASSERT(!hasNoValue());
     
    319319    ASSERT_UNUSED(castSucceeded, castSucceeded);
    320320
    321     return BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(resultObject);
     321    return BindingTraits<Protocol::Runtime::ObjectPreview>::runtimeCast(resultObject);
    322322}
    323323
  • trunk/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h

    r225425 r228546  
    3434namespace Protocol {
    3535
    36 template<typename T> struct BindingTraits;
     36template<typename> struct BindingTraits;
    3737
    38 template<typename T>
    39 class OptOutput {
    40 public:
    41     OptOutput() : m_assigned(false) { }
    42 
    43     void operator=(T value)
     38template<JSON::Value::Type type> struct PrimitiveBindingTraits {
     39    static void assertValueHasExpectedType(JSON::Value* value)
    4440    {
    45         m_value = value;
    46         m_assigned = true;
     41        ASSERT_UNUSED(value, value);
     42        ASSERT_UNUSED(value, value->type() == type);
    4743    }
    48 
    49     bool isAssigned() const { return m_assigned; }
    50 
    51     T getValue()
    52     {
    53         ASSERT(isAssigned());
    54         return m_value;
    55     }
    56 
    57 private:
    58     T m_value;
    59     bool m_assigned;
    60 
    61     WTF_MAKE_NONCOPYABLE(OptOutput);
    6244};
    6345
    64 // Helper methods for Protocol and other JSON types are provided by
    65 // specializations of BindingTraits<T>. Some are generated for protocol types.
    66 
    67 template<typename T>
    68 struct BindingTraits {
    69     typedef T BindingType;
    70 
    71     static void push(JSON::Array&, BindingType&);
    72     static JSON::Value::Type typeTag();
    73     static RefPtr<T> runtimeCast(RefPtr<JSON::Object>&&);
    74 #if !ASSERT_DISABLED
    75     static void assertValueHasExpectedType(JSON::Value*);
    76 #endif // !ASSERT_DISABLED
    77 };
    78 
    79 template<JSON::Value::Type TYPE>
    80 struct PrimitiveBindingTraits {
    81 #if !ASSERT_DISABLED
    82     static void assertValueHasExpectedType(JSON::Value* value)
    83     {
    84         ASSERT_ARG(value, value && value->type() == TYPE);
    85     }
    86 #endif // !ASSERT_DISABLED
    87 };
    88 
    89 template<typename T>
    90 struct BindingTraits<JSON::ArrayOf<T>> {
     46template<typename T> struct BindingTraits<JSON::ArrayOf<T>> {
    9147    static RefPtr<JSON::ArrayOf<T>> runtimeCast(RefPtr<JSON::Value>&& value)
    9248    {
     
    9551        bool castSucceeded = value->asArray(array);
    9652        ASSERT_UNUSED(castSucceeded, castSucceeded);
    97 #if !ASSERT_DISABLED
    9853        assertValueHasExpectedType(array.get());
    99 #endif // !ASSERT_DISABLED
    10054        COMPILE_ASSERT(sizeof(JSON::ArrayOf<T>) == sizeof(JSON::Array), type_cast_problem);
    10155        return static_cast<JSON::ArrayOf<T>*>(static_cast<JSON::ArrayBase*>(array.get()));
    10256    }
    10357
    104 #if !ASSERT_DISABLED
    10558    static void assertValueHasExpectedType(JSON::Value* value)
    10659    {
     60#if ASSERT_DISABLED
     61        UNUSED_PARAM(value);
     62#else
    10763        ASSERT_ARG(value, value);
    10864        RefPtr<JSON::Array> array;
     
    11167        for (unsigned i = 0; i < array->length(); i++)
    11268            BindingTraits<T>::assertValueHasExpectedType(array->get(i).get());
     69#endif // !ASSERT_DISABLED
    11370    }
    114 #endif // !ASSERT_DISABLED
    11571};
    11672
    117 template<>
    118 struct BindingTraits<JSON::Value> {
    119 #if !ASSERT_DISABLED
     73template<> struct BindingTraits<JSON::Value> {
    12074    static void assertValueHasExpectedType(JSON::Value*)
    12175    {
    12276    }
    123 #endif // !ASSERT_DISABLED
    12477};
    12578
    126 template<> struct BindingTraits<JSON::Array> : public PrimitiveBindingTraits<JSON::Value::Type::Array> { };
    127 template<> struct BindingTraits<JSON::Object> : public PrimitiveBindingTraits<JSON::Value::Type::Object> { };
    128 template<> struct BindingTraits<String> : public PrimitiveBindingTraits<JSON::Value::Type::String> { };
    129 template<> struct BindingTraits<bool> : public PrimitiveBindingTraits<JSON::Value::Type::Boolean> { };
    130 template<> struct BindingTraits<double> : public PrimitiveBindingTraits<JSON::Value::Type::Double> { };
    131 template<> struct BindingTraits<int> : public PrimitiveBindingTraits<JSON::Value::Type::Integer> { };
     79template<> struct BindingTraits<JSON::Array> : PrimitiveBindingTraits<JSON::Value::Type::Array> { };
     80template<> struct BindingTraits<JSON::Object> : PrimitiveBindingTraits<JSON::Value::Type::Object> { };
     81template<> struct BindingTraits<String> : PrimitiveBindingTraits<JSON::Value::Type::String> { };
     82template<> struct BindingTraits<bool> : PrimitiveBindingTraits<JSON::Value::Type::Boolean> { };
     83template<> struct BindingTraits<double> : PrimitiveBindingTraits<JSON::Value::Type::Double> { };
     84template<> struct BindingTraits<int> : PrimitiveBindingTraits<JSON::Value::Type::Integer> { };
    13285
    133 } // namespace Protocol
     86}
    13487
    13588using Protocol::BindingTraits;
  • trunk/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp

    r225231 r228546  
    6363}
    6464
    65 Ref<Inspector::Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
     65Ref<Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
    6666{
    67     return Inspector::Protocol::Console::CallFrame::create()
     67    return Protocol::Console::CallFrame::create()
    6868        .setFunctionName(m_functionName)
    6969        .setUrl(m_scriptName)
  • trunk/Source/JavaScriptCore/inspector/ScriptCallFrame.h

    r220188 r228546  
    5555    bool operator==(const ScriptCallFrame& other) const { return isEqual(other); }
    5656
    57     Ref<Inspector::Protocol::Console::CallFrame> buildInspectorObject() const;
     57    Ref<Protocol::Console::CallFrame> buildInspectorObject() const;
    5858
    5959private:
  • trunk/Source/JavaScriptCore/inspector/ScriptCallStack.cpp

    r225425 r228546  
    106106}
    107107
    108 Ref<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const
     108Ref<JSON::ArrayOf<Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const
    109109{
    110     auto frames = JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>::create();
     110    auto frames = JSON::ArrayOf<Protocol::Console::CallFrame>::create();
    111111    for (size_t i = 0; i < m_frames.size(); i++)
    112112        frames->addItem(m_frames.at(i).buildInspectorObject());
  • trunk/Source/JavaScriptCore/inspector/ScriptCallStack.h

    r225425 r228546  
    5757    bool isEqual(ScriptCallStack*) const;
    5858
    59     Ref<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> buildInspectorArray() const;
     59    Ref<JSON::ArrayOf<Protocol::Console::CallFrame>> buildInspectorArray() const;
    6060
    6161private:
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp

    r228533 r228546  
    240240}
    241241
    242 void InspectorConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>& channels)
     242void InspectorConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>& channels)
    243243{
    244244    // Default implementation has no logging channels.
    245     channels = JSON::ArrayOf<Inspector::Protocol::Console::Channel>::create();
     245    channels = JSON::ArrayOf<Protocol::Console::Channel>::create();
    246246}
    247247
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h

    r228533 r228546  
    7474    void count(JSC::ExecState*, Ref<ScriptArguments>&&);
    7575
    76     void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>&) override;
     76    void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>&) override;
    7777    void setLoggingChannelLevel(ErrorString&, const String& channel, const String& level) override;
    7878
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp

    r228260 r228546  
    174174static RefPtr<JSON::Object> buildAssertPauseReason(const String& message)
    175175{
    176     auto reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release();
     176    auto reason = Protocol::Debugger::AssertPauseReason::create().release();
    177177    if (!message.isNull())
    178178        reason->setMessage(message);
     
    182182static RefPtr<JSON::Object> buildCSPViolationPauseReason(const String& directiveText)
    183183{
    184     auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create()
     184    auto reason = Protocol::Debugger::CSPViolationPauseReason::create()
    185185        .setDirective(directiveText)
    186186        .release();
     
    195195        return nullptr;
    196196
    197     auto reason = Inspector::Protocol::Debugger::BreakpointPauseReason::create()
     197    auto reason = Protocol::Debugger::BreakpointPauseReason::create()
    198198        .setBreakpointId(it->value)
    199199        .release();
     
    343343static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output)
    344344{
    345     if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
     345    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Log)) {
    346346        *output = ScriptBreakpointActionTypeLog;
    347347        return true;
    348348    }
    349     if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
     349    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
    350350        *output = ScriptBreakpointActionTypeEvaluate;
    351351        return true;
    352352    }
    353     if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
     353    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Sound)) {
    354354        *output = ScriptBreakpointActionTypeSound;
    355355        return true;
    356356    }
    357     if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
     357    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Probe)) {
    358358        *output = ScriptBreakpointActionTypeProbe;
    359359        return true;
     
    407407}
    408408
    409 static RefPtr<Inspector::Protocol::Debugger::Location> buildDebuggerLocation(const JSC::Breakpoint& breakpoint)
     409static RefPtr<Protocol::Debugger::Location> buildDebuggerLocation(const JSC::Breakpoint& breakpoint)
    410410{
    411411    ASSERT(breakpoint.resolved);
    412412
    413     auto location = Inspector::Protocol::Debugger::Location::create()
     413    auto location = Protocol::Debugger::Location::create()
    414414        .setScriptId(String::number(breakpoint.sourceID))
    415415        .setLineNumber(breakpoint.line)
     
    435435}
    436436
    437 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::Location>>& locations)
    438 {
    439     locations = JSON::ArrayOf<Inspector::Protocol::Debugger::Location>::create();
     437void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const JSON::Object* options, Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<JSON::ArrayOf<Protocol::Debugger::Location>>& locations)
     438{
     439    locations = JSON::ArrayOf<Protocol::Debugger::Location>::create();
    440440    if (!optionalURL == !optionalURLRegex) {
    441441        errorString = ASCIILiteral("Either url or urlRegex must be specified.");
     
    496496}
    497497
    498 void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const JSON::Object& location, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation)
     498void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const JSON::Object& location, const JSON::Object* options, Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Protocol::Debugger::Location>& actualLocation)
    499499{
    500500    JSC::SourceID sourceID;
     
    660660}
    661661
    662 void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
     662void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>>& results)
    663663{
    664664    JSC::SourceID sourceID = scriptIDStr.toIntPtr();
     
    684684}
    685685
    686 void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& details)
     686void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& details)
    687687{
    688688    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(functionId);
     
    827827}
    828828
    829 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* outWasThrown, Inspector::Protocol::OptOutput<int>* outSavedResultIndex)
     829void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& outWasThrown, std::optional<int>& savedResultIndex)
    830830{
    831831    if (!m_currentCallStack) {
     
    848848    }
    849849
    850     // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
    851850    bool wasThrown;
    852     std::optional<int> savedResultIndex;
    853851    injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack.get(), callFrameId, expression,
    854852        objectGroup ? *objectGroup : emptyString(), includeCommandLineAPI && *includeCommandLineAPI, returnByValue && *returnByValue, generatePreview && *generatePreview, saveResult && *saveResult,
    855853        result, wasThrown, savedResultIndex);
    856     *outWasThrown = wasThrown;
    857     if (savedResultIndex.has_value())
    858         *outSavedResultIndex = savedResultIndex.value();
     854    outWasThrown = wasThrown;
    859855
    860856    if (pauseAndMute) {
     
    874870}
    875871
    876 Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)
     872Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)
    877873{
    878874    ASSERT(!injectedScript.hasNoValue());
    879875    if (injectedScript.hasNoValue())
    880         return JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>::create();
     876        return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create();
    881877
    882878    return injectedScript.wrapCallFrames(m_currentCallStack.get());
     
    10101006    m_enablePauseWhenIdle = false;
    10111007
    1012     RefPtr<Inspector::Protocol::Console::StackTrace> asyncStackTrace;
     1008    RefPtr<Protocol::Console::StackTrace> asyncStackTrace;
    10131009    if (m_currentAsyncCallIdentifier) {
    10141010        auto it = m_pendingAsyncCalls.find(m_currentAsyncCallIdentifier.value());
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h

    r228260 r228546  
    6464    void setAsyncStackTraceDepth(ErrorString&, int depth) final;
    6565    void setBreakpointsActive(ErrorString&, bool active) final;
    66     void setBreakpointByUrl(ErrorString&, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::Location>>& locations) final;
    67     void setBreakpoint(ErrorString&, const JSON::Object& location, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation) final;
     66    void setBreakpointByUrl(ErrorString&, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const JSON::Object* options, Protocol::Debugger::BreakpointId*, RefPtr<JSON::ArrayOf<Protocol::Debugger::Location>>& locations) final;
     67    void setBreakpoint(ErrorString&, const JSON::Object& location, const JSON::Object* options, Protocol::Debugger::BreakpointId*, RefPtr<Protocol::Debugger::Location>& actualLocation) final;
    6868    void removeBreakpoint(ErrorString&, const String& breakpointIdentifier) final;
    6969    void continueUntilNextRunLoop(ErrorString&) final;
    7070    void continueToLocation(ErrorString&, const JSON::Object& location) final;
    71     void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&) final;
     71    void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>>&) final;
    7272    void getScriptSource(ErrorString&, const String& scriptID, String* scriptSource) final;
    73     void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>&) final;
     73    void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>&) final;
    7474    void pause(ErrorString&) final;
    7575    void resume(ErrorString&) final;
     
    7979    void setPauseOnExceptions(ErrorString&, const String& pauseState) final;
    8080    void setPauseOnAssertions(ErrorString&, bool enabled) final;
    81     void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* const generatePreview, const bool* const saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex) final;
    82     void setOverlayMessage(ErrorString&, const String* const) override;
     81    void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) final;
     82    void setOverlayMessage(ErrorString&, const String*) override;
    8383
    8484    bool isPaused() const;
     
    138138
    139139private:
    140     Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);
     140    Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);
    141141
    142142    void didParseSource(JSC::SourceID, const Script&) final;
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp

    r225804 r228546  
    167167}
    168168
    169 void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview)
     169void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Protocol::Runtime::ObjectPreview>& objectPreview)
    170170{
    171171    // Prevent the cell from getting collected as we look it up.
     
    216216}
    217217
    218 void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* const optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
     218void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result)
    219219{
    220220    // Prevent the cell from getting collected as we look it up.
     
    251251}
    252252
    253 static Inspector::Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(CollectionScope scope)
     253static Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(CollectionScope scope)
    254254{
    255255    switch (scope) {
    256256    case CollectionScope::Full:
    257         return Inspector::Protocol::Heap::GarbageCollection::Type::Full;
     257        return Protocol::Heap::GarbageCollection::Type::Full;
    258258    case CollectionScope::Eden:
    259         return Inspector::Protocol::Heap::GarbageCollection::Type::Partial;
     259        return Protocol::Heap::GarbageCollection::Type::Partial;
    260260    }
    261261    ASSERT_NOT_REACHED();
    262     return Inspector::Protocol::Heap::GarbageCollection::Type::Full;
     262    return Protocol::Heap::GarbageCollection::Type::Full;
    263263}
    264264
     
    302302}
    303303
    304 void InspectorHeapAgent::dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime)
    305 {
    306     auto protocolObject = Inspector::Protocol::Heap::GarbageCollection::create()
     304void InspectorHeapAgent::dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime)
     305{
     306    auto protocolObject = Protocol::Heap::GarbageCollection::create()
    307307        .setType(type)
    308308        .setStartTime(startTime)
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h

    r228105 r228546  
    5959    void startTracking(ErrorString&) final;
    6060    void stopTracking(ErrorString&) final;
    61     void getPreview(ErrorString&, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview) final;
    62     void getRemoteObject(ErrorString&, int heapObjectId, const String* const optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) final;
     61    void getPreview(ErrorString&, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>&, RefPtr<Protocol::Runtime::ObjectPreview>&) final;
     62    void getRemoteObject(ErrorString&, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result) final;
    6363
    6464    // HeapObserver
     
    6969    void clearHeapSnapshots();
    7070
    71     virtual void dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type, double startTime, double endTime);
     71    virtual void dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type, double startTime, double endTime);
    7272
    7373private:
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp

    r228533 r228546  
    4848#include <wtf/JSONValues.h>
    4949
     50namespace Inspector {
     51
    5052using namespace JSC;
    5153
    52 namespace Inspector {
    53 
    54 static bool asBool(const bool* const b)
    55 {
    56     return b ? *b : false;
     54static bool asBool(const bool* b)
     55{
     56    return b && *b;
    5757}
    5858
     
    7171static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer& scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState)
    7272{
    73     ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer.pauseOnExceptionsState();
     73    auto presentState = scriptDebugServer.pauseOnExceptionsState();
    7474    if (presentState != newState)
    7575        scriptDebugServer.setPauseOnExceptionsState(newState);
     
    7777}
    7878
    79 static Ref<Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
    80 {
    81     return Inspector::Protocol::Runtime::ErrorRange::create()
     79static Ref<Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
     80{
     81    return Protocol::Runtime::ErrorRange::create()
    8282        .setStartOffset(tokenLocation.startOffset)
    8383        .setEndOffset(tokenLocation.endOffset)
     
    8585}
    8686
    87 void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range)
     87void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>& range)
    8888{
    8989    JSLockHolder lock(m_vm);
     
    9494    switch (error.syntaxErrorType()) {
    9595    case ParserError::SyntaxErrorNone:
    96         *result = Inspector::Protocol::Runtime::SyntaxErrorType::None;
     96        *result = Protocol::Runtime::SyntaxErrorType::None;
    9797        break;
    9898    case ParserError::SyntaxErrorIrrecoverable:
    99         *result = Inspector::Protocol::Runtime::SyntaxErrorType::Irrecoverable;
     99        *result = Protocol::Runtime::SyntaxErrorType::Irrecoverable;
    100100        break;
    101101    case ParserError::SyntaxErrorUnterminatedLiteral:
    102         *result = Inspector::Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral;
     102        *result = Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral;
    103103        break;
    104104    case ParserError::SyntaxErrorRecoverable:
    105         *result = Inspector::Protocol::Runtime::SyntaxErrorType::Recoverable;
     105        *result = Protocol::Runtime::SyntaxErrorType::Recoverable;
    106106        break;
    107107    }
    108108
    109109    if (error.syntaxErrorType() != ParserError::SyntaxErrorNone) {
    110         *message = error.message();
     110        message = error.message();
    111111        range = buildErrorRangeObject(error.token().m_location);
    112112    }
    113113}
    114114
    115 void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* out_wasThrown, Inspector::Protocol::OptOutput<int>* out_savedResultIndex)
     115void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& outWasThrown, std::optional<int>& savedResultIndex)
    116116{
    117117    InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
     
    125125        muteConsole();
    126126
    127     // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
    128     // <https://www.webkit.org/b/180607>
    129127    bool wasThrown;
    130     std::optional<int> savedResultIndex;
    131128    injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), asBool(saveResult), result, wasThrown, savedResultIndex);
    132    
    133     *out_wasThrown = wasThrown;
    134     if (savedResultIndex.has_value())
    135         *out_savedResultIndex = savedResultIndex.value();
     129    outWasThrown = wasThrown;
    136130
    137131    if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
     
    141135}
    142136
    143 void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* out_wasThrown)
     137void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& outWasThrown)
    144138{
    145139    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     
    163157    injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), asBool(generatePreview), result, wasThrown);
    164158
    165     *out_wasThrown = wasThrown;
     159    outWasThrown = wasThrown;
    166160
    167161    if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
     
    171165}
    172166
    173 void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& objectId, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& preview)
     167void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>& preview)
    174168{
    175169    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     
    188182}
    189183
    190 void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
     184void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* ownProperties, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
    191185{
    192186    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     
    206200}
    207201
    208 void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
     202void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
    209203{
    210204    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     
    224218}
    225219
    226 void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::CollectionEntry>>& entries)
     220void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries)
    227221{
    228222    InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     
    238232}
    239233
    240 void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, Inspector::Protocol::OptOutput<int>* out_savedResultIndex)
     234void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex)
    241235{
    242236    InjectedScript injectedScript;
     
    255249    }
    256250   
    257     // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
    258     // <https://www.webkit.org/b/180607>
    259     std::optional<int> savedResultIndex;
    260 
    261251    injectedScript.saveResult(errorString, callArgument.toJSONString(), savedResultIndex);
    262 
    263     if (savedResultIndex.has_value())
    264         *out_savedResultIndex = savedResultIndex.value();
    265252}
    266253
     
    277264}
    278265
    279 void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)
     266void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>& typeDescriptions)
    280267{
    281268    static const bool verbose = false;
    282269
    283     typeDescriptions = JSON::ArrayOf<Inspector::Protocol::Runtime::TypeDescription>::create();
     270    typeDescriptions = JSON::ArrayOf<Protocol::Runtime::TypeDescription>::create();
    284271    if (!m_vm.typeProfiler()) {
    285272        errorString = ASCIILiteral("The VM does not currently have Type Information.");
     
    318305
    319306        bool isValid = typeLocation && typeSet && !typeSet->isEmpty();
    320         auto description = Inspector::Protocol::Runtime::TypeDescription::create()
     307        auto description = Protocol::Runtime::TypeDescription::create()
    321308            .setIsValid(isValid)
    322309            .release();
     
    392379}
    393380
    394 void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks)
     381void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& basicBlocks)
    395382{
    396383    if (!m_vm.controlFlowProfiler()) {
     
    403390    ASSERT(okay);
    404391    const Vector<BasicBlockRange>& basicBlockRanges = m_vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, m_vm);
    405     basicBlocks = JSON::ArrayOf<Inspector::Protocol::Runtime::BasicBlock>::create();
     392    basicBlocks = JSON::ArrayOf<Protocol::Runtime::BasicBlock>::create();
    406393    for (const BasicBlockRange& block : basicBlockRanges) {
    407         Ref<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()
     394        auto location = Protocol::Runtime::BasicBlock::create()
    408395            .setStartOffset(block.m_startOffset)
    409396            .setEndOffset(block.m_endOffset)
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h

    r228105 r228546  
    5858    void enable(ErrorString&) override { m_enabled = true; }
    5959    void disable(ErrorString&) override { m_enabled = false; }
    60     void parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>&) final;
    61     void evaluate(ErrorString&, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* const executionContextId, const bool* const returnByValue, const bool* const generatePreview, const bool* const saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>* savedResultIndex) final;
    62     void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* const generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown) final;
     60    void parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>&) final;
     61    void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) final;
     62    void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown) final;
    6363    void releaseObject(ErrorString&, const ErrorString& objectId) final;
    64     void getPreview(ErrorString&, const String& objectId, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>&) final;
    65     void getProperties(ErrorString&, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;
    66     void getDisplayableProperties(ErrorString&, const String& objectId, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;
    67     void getCollectionEntries(ErrorString&, const String& objectId, const String* const objectGroup, const int* const startIndex, const int* const numberToFetch, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::CollectionEntry>>& entries) final;
    68     void saveResult(ErrorString&, const JSON::Object& callArgument, const int* const executionContextId, Inspector::Protocol::OptOutput<int>* savedResultIndex) final;
     64    void getPreview(ErrorString&, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>&) final;
     65    void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;
     66    void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;
     67    void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries) final;
     68    void saveResult(ErrorString&, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex) final;
    6969    void releaseObjectGroup(ErrorString&, const String& objectGroup) final;
    70     void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::TypeDescription>>&) override;
     70    void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>&) override;
    7171    void enableTypeProfiler(ErrorString&) override;
    7272    void disableTypeProfiler(ErrorString&) override;
    7373    void enableControlFlowProfiler(ErrorString&) override;
    7474    void disableControlFlowProfiler(ErrorString&) override;
    75     void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
     75    void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
    7676
    7777    bool enabled() const { return m_enabled; }
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp

    r225425 r228546  
    6767}
    6868
    69 void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* const includeSamples)
     69void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* includeSamples)
    7070{
    7171    if (m_tracking)
     
    136136}
    137137
    138 static Inspector::Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)
     138static Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)
    139139{
    140140    switch (reason) {
    141141    case ProfilingReason::API:
    142         return Inspector::Protocol::ScriptProfiler::EventType::API;
     142        return Protocol::ScriptProfiler::EventType::API;
    143143    case ProfilingReason::Microtask:
    144         return Inspector::Protocol::ScriptProfiler::EventType::Microtask;
     144        return Protocol::ScriptProfiler::EventType::Microtask;
    145145    case ProfilingReason::Other:
    146         return Inspector::Protocol::ScriptProfiler::EventType::Other;
     146        return Protocol::ScriptProfiler::EventType::Other;
    147147    }
    148148
    149149    ASSERT_NOT_REACHED();
    150     return Inspector::Protocol::ScriptProfiler::EventType::Other;
     150    return Protocol::ScriptProfiler::EventType::Other;
    151151}
    152152
     
    155155    ASSERT(endTime >= startTime);
    156156
    157     auto event = Inspector::Protocol::ScriptProfiler::Event::create()
     157    auto event = Protocol::ScriptProfiler::Event::create()
    158158        .setStartTime(startTime)
    159159        .setEndTime(endTime)
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h

    r228105 r228546  
    5151
    5252    // ScriptProfilerBackendDispatcherHandler
    53     void startTracking(ErrorString&, const bool* const includeSamples) override;
     53    void startTracking(ErrorString&, const bool* includeSamples) override;
    5454    void stopTracking(ErrorString&) override;
    5555
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py

    r225425 r228546  
    11#!/usr/bin/env python
    22#
    3 # Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
     3# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
    44# Copyright (c) 2014 University of Washington. All rights reserved.
    55#
     
    143143            cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
    144144            if parameter.is_optional:
    145                 return 'const %s* const' % cpp_name
     145                return 'const %s*' % cpp_name
    146146            elif _type.raw_name() in ['string']:
    147147                return 'const %s&' % cpp_name
     
    166166            builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
    167167            if is_optional:
    168                 return 'const %s* const' % builder_type
     168                return 'const %s*' % builder_type
    169169            elif _type.aliased_type.qualified_name() in ['integer', 'number']:
    170170                return CppGenerator.cpp_name_for_primitive_type(_type.aliased_type)
     
    180180                return 'RefPtr<JSON::Value>'
    181181            elif is_optional:
    182                 return 'const %s* const' % cpp_name
     182                return 'const %s*' % cpp_name
    183183            elif _type.qualified_name() in ['string']:
    184184                return 'const %s&' % cpp_name
     
    208208            cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
    209209            if parameter.is_optional:
    210                 return "Inspector::Protocol::OptOutput<%s>*" % cpp_name
     210                return "std::optional<%s>&" % cpp_name
    211211            else:
    212212                return '%s*' % cpp_name
     
    234234            cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
    235235            if parameter.is_optional:
    236                 return "Inspector::Protocol::OptOutput<%s>*" % cpp_name
     236                return "std::optional<%s>&" % cpp_name
    237237            elif _type.qualified_name() in ['integer', 'number']:
    238238                return CppGenerator.cpp_name_for_primitive_type(_type)
     
    266266                return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type)
    267267            elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer']:
    268                 return "Inspector::Protocol::OptOutput<%s>" % cpp_name
     268                return "std::optional<%s>" % cpp_name
    269269            else:
    270270                return cpp_name
     
    278278            builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
    279279            if parameter.is_optional:
    280                 return "Inspector::Protocol::OptOutput<%s>" % builder_type
     280                return "std::optional<%s>" % builder_type
    281281            return '%s' % builder_type
    282282        if isinstance(_type, PrimitiveType):
    283283            cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
    284284            if parameter.is_optional:
    285                 return "Inspector::Protocol::OptOutput<%s>" % cpp_name
     285                return "std::optional<%s>" % cpp_name
    286286            else:
    287287                return cpp_name
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py

    r224576 r228546  
    11#!/usr/bin/env python
    22#
    3 # Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
     3# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
    44# Copyright (c) 2014 University of Washington. All rights reserved.
    55#
     
    129129${dispatchCases}
    130130    else
    131         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
     131        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found");
    132132}""")
    133133
     
    157157    auto findResult = dispatchMap.get().find(method);
    158158    if (findResult == dispatchMap.get().end()) {
    159         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
     159        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found");
    160160        return;
    161161    }
     
    180180"""${inParameterDeclarations}
    181181    if (m_backendDispatcher->hasProtocolErrors()) {
    182         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method \'%s\' can't be processed", "${domainName}.${commandName}"));
     182        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method \'${domainName}.${commandName}\' can't be processed" });
    183183        return;
    184184    }
     
    250250    bool castSucceeded = value->asObject(result);
    251251    ASSERT_UNUSED(castSucceeded, castSucceeded);
    252 #if !ASSERT_DISABLED
    253252    BindingTraits<${objectType}>::assertValueHasExpectedType(result.get());
    254 #endif  // !ASSERT_DISABLED
    255253    COMPILE_ASSERT(sizeof(${objectType}) == sizeof(JSON::ObjectBase), type_cast_problem);
    256254    return static_cast<${objectType}*>(static_cast<JSON::ObjectBase*>(result.get()));
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py

    r228196 r228546  
    11#!/usr/bin/env python
    22#
    3 # Copyright (c) 2014-2016 Apple Inc. All rights reserved.
     3# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
    44# Copyright (c) 2014 University of Washington. All rights reserved.
    55#
     
    164164            if parameter.is_optional:
    165165                if CppGenerator.should_use_wrapper_for_return_type(parameter.type):
    166                     out_parameter_assignments.append('    if (%(parameterName)s.isAssigned())' % param_args)
    167                     out_parameter_assignments.append('        jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s.getValue());' % param_args)
     166                    out_parameter_assignments.append('    if (%(parameterName)s.has_value())' % param_args)
     167                    out_parameter_assignments.append('        jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), *%(parameterName)s);' % param_args)
    168168                else:
    169169                    out_parameter_assignments.append('    if (%(parameterName)s)' % param_args)
     
    257257                if parameter.is_optional:
    258258                    if CppGenerator.should_use_wrapper_for_return_type(parameter.type):
    259                         out_parameter_assignments.append('        if (out_%(parameterName)s.isAssigned())' % param_args)
    260                         out_parameter_assignments.append('            result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s.getValue());' % param_args)
     259                        out_parameter_assignments.append('        if (out_%(parameterName)s.has_value())' % param_args)
     260                        out_parameter_assignments.append('            result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), *out_%(parameterName)s);' % param_args)
    261261                    else:
    262262                        out_parameter_assignments.append('        if (out_%(parameterName)s)' % param_args)
     
    267267                    out_parameter_assignments.append('        result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
    268268
    269                 if CppGenerator.should_pass_by_copy_for_return_type(parameter.type):
     269                if CppGenerator.should_pass_by_copy_for_return_type(parameter.type) or parameter.is_optional and CppGenerator.should_use_wrapper_for_return_type(parameter.type):
    270270                    method_parameters.append('out_' + parameter.parameter_name)
    271271                else:
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py

    r228196 r228546  
    11#!/usr/bin/env python
    22#
    3 # Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
     3# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
    44# Copyright (c) 2014 University of Washington. All rights reserved.
    55#
     
    366366            if argument[1]:
    367367                lines.append('static RefPtr<%s> runtimeCast(RefPtr<JSON::Value>&& value);' % argument[0])
    368             lines.append('#if !ASSERT_DISABLED')
    369368            lines.append('%s assertValueHasExpectedType(JSON::Value*);' % ' '.join(function_keywords))
    370             lines.append('#endif // !ASSERT_DISABLED')
    371369            lines.append('};')
    372370        return '\n'.join(lines)
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py

    r228196 r228546  
    11#!/usr/bin/env python
    22#
    3 # Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
     3# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
    44# Copyright (c) 2014 University of Washington. All rights reserved.
    55#
     
    206206        lines = []
    207207
    208         lines.append('#if !ASSERT_DISABLED')
    209208        lines.append('void BindingTraits<%s>::assertValueHasExpectedType(JSON::Value* value)' % (CppGenerator.cpp_protocol_type_for_type(object_declaration.type)))
    210209        lines.append("""{
     210#if ASSERT_DISABLED
     211    UNUSED_PARAM(value);
     212#else
    211213    ASSERT_ARG(value, value);
    212214    RefPtr<JSON::Object> object;
     
    220222
    221223            lines.append("""    {
    222         JSON::Object::iterator %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
     224        auto %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
    223225        ASSERT(%(memberName)sPos != object->end());
    224226        %(assertMethod)s(%(memberName)sPos->value.get());
     
    236238
    237239            lines.append("""    {
    238         JSON::Object::iterator %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
     240        auto %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
    239241        if (%(memberName)sPos != object->end()) {
    240242            %(assertMethod)s(%(memberName)sPos->value.get());""" % args)
     
    248250            lines.append('    if (foundPropertiesCount != object->size())')
    249251            lines.append('        FATAL("Unexpected properties in object: %s\\n", object->toJSONString().ascii().data());')
     252        lines.append('#endif // !ASSERT_DISABLED')
    250253        lines.append('}')
    251         lines.append('#endif // !ASSERT_DISABLED')
    252254        return '\n'.join(lines)
    253255
    254256    def _generate_assertion_for_enum(self, enum_member, object_declaration):
    255257        lines = []
    256         lines.append('#if !ASSERT_DISABLED')
    257258        lines.append('void %s(JSON::Value* value)' % CppGenerator.cpp_assertion_method_for_type_member(enum_member, object_declaration))
    258259        lines.append('{')
     260        lines.append('#if ASSERT_DISABLED')
     261        lines.append('    UNUSED_PARAM(value);')
     262        lines.append('#else')
    259263        lines.append('    ASSERT_ARG(value, value);')
    260264        lines.append('    String result;')
     
    264268        assert_condition = ' || '.join(['result == "%s"' % enum_value for enum_value in enum_member.type.enum_values()])
    265269        lines.append('    ASSERT(%s);' % assert_condition)
     270        lines.append('#endif // !ASSERT_DISABLED')
    266271        lines.append('}')
    267         lines.append('#endif // !ASSERT_DISABLED')
    268272
    269273        return '\n'.join(lines)
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py

    r225231 r228546  
    11#!/usr/bin/env python
    22#
    3 # Copyright (c) 2014-2016 Apple Inc. All rights reserved.
     3# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
    44# Copyright (c) 2014 University of Washington. All rights reserved.
    55#
     
    178178                if isinstance(parameter.type, EnumType):
    179179                    lines.append('    if (!%s) {' % objc_in_param_name)
    180                     lines.append('        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter \'%%s\' of method \'%%s\' cannot be processed", "%s", "%s.%s"));' % (parameter.parameter_name, domain.domain_name, command.command_name))
     180                    lines.append('        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter \'%s\' of method \'%s.%s\' cannot be processed" });' % (parameter.parameter_name, domain.domain_name, command.command_name))
    181181                    lines.append('        return;')
    182182                    lines.append('    }')
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result

    r228196 r228546  
    239239        loadResource(requestId, WTFMove(parameters));
    240240    else
    241         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network", '.', method, "' was not found"));
     241        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found");
    242242}
    243243
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result

    r228196 r228546  
    158158        Black = 6,
    159159    }; // enum class PrintColor
    160     virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<JSON::Object>* opt_out_values, Inspector::Protocol::OptOutput<JSON::Value>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
     160    virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, std::optional<String>& opt_out_notes, std::optional<double>& opt_out_timestamp, std::optional<JSON::Object>& opt_out_values, std::optional<JSON::Value>& opt_out_payload, std::optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
    161161    class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase {
    162162    public:
    163163        ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&&, int id);
    164         void sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<JSON::Object>* values, Inspector::Protocol::OptOutput<JSON::Value>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>* printColor);
     164        void sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, std::optional<String>& notes, std::optional<double>& timestamp, std::optional<JSON::Object>& values, std::optional<JSON::Value>& payload, std::optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, std::optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, std::optional<String>& printColor);
    165165    };
    166166    virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0;
     
    274274        executeSQLAsync(requestId, WTFMove(parameters));
    275275    else
    276         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
     276        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
    277277}
    278278
     
    282282    String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
    283283    if (m_backendDispatcher->hasProtocolErrors()) {
    284         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues"));
     284        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLSyncOptionalReturnValues' can't be processed" });
    285285        return;
    286286    }
     
    296296    Ref<JSON::Object> result = JSON::Object::create();
    297297    RefPtr<JSON::ArrayOf<String>> out_columnNames;
    298     Inspector::Protocol::OptOutput<String> out_notes;
    299     Inspector::Protocol::OptOutput<double> out_timestamp;
    300     Inspector::Protocol::OptOutput<JSON::Object> out_values;
    301     Inspector::Protocol::OptOutput<JSON::Value> out_payload;
    302     Inspector::Protocol::OptOutput<int> out_databaseId;
     298    std::optional<String> out_notes;
     299    std::optional<double> out_timestamp;
     300    std::optional<JSON::Object> out_values;
     301    std::optional<JSON::Value> out_payload;
     302    std::optional<int> out_databaseId;
    303303    RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
    304304    Inspector::Protocol::Database::PrimaryColors out_screenColor;
    305305    RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors;
    306306    DatabaseBackendDispatcherHandler::PrintColor out_printColor;
    307     m_agent->executeSQLSyncOptionalReturnValues(error, in_databaseId, in_query, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);
     307    m_agent->executeSQLSyncOptionalReturnValues(error, in_databaseId, in_query, out_columnNames, out_notes, out_timestamp, out_values, out_payload, out_databaseId, out_sqlError, out_screenColor, out_alternateColors, out_printColor);
    308308
    309309    if (!error.length()) {
    310310        if (out_columnNames)
    311311            result->setArray(ASCIILiteral("columnNames"), out_columnNames);
    312         if (out_notes.isAssigned())
    313             result->setString(ASCIILiteral("notes"), out_notes.getValue());
    314         if (out_timestamp.isAssigned())
    315             result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
    316         if (out_values.isAssigned())
    317             result->setObject(ASCIILiteral("values"), out_values.getValue());
    318         if (out_payload.isAssigned())
    319             result->setValue(ASCIILiteral("payload"), out_payload.getValue());
    320         if (out_databaseId.isAssigned())
    321             result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
     312        if (out_notes.has_value())
     313            result->setString(ASCIILiteral("notes"), *out_notes);
     314        if (out_timestamp.has_value())
     315            result->setDouble(ASCIILiteral("timestamp"), *out_timestamp);
     316        if (out_values.has_value())
     317            result->setObject(ASCIILiteral("values"), *out_values);
     318        if (out_payload.has_value())
     319            result->setValue(ASCIILiteral("payload"), *out_payload);
     320        if (out_databaseId.has_value())
     321            result->setInteger(ASCIILiteral("databaseId"), *out_databaseId);
    322322        if (out_sqlError)
    323323            result->setObject(ASCIILiteral("sqlError"), out_sqlError);
    324         if (out_screenColor.isAssigned())
    325             result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());
     324        if (out_screenColor.has_value())
     325            result->setString(ASCIILiteral("screenColor"), *out_screenColor);
    326326        if (out_alternateColors)
    327327            result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
    328         if (out_printColor.isAssigned())
    329             result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
     328        if (out_printColor.has_value())
     329            result->setString(ASCIILiteral("printColor"), *out_printColor);
    330330    }
    331331    if (!error.length())
     
    337337DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { }
    338338
    339 void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<JSON::Object>* values, Inspector::Protocol::OptOutput<JSON::Value>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>* printColor)
     339void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, std::optional<String>& notes, std::optional<double>& timestamp, std::optional<JSON::Object>& values, std::optional<JSON::Value>& payload, std::optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, std::optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, std::optional<String>& printColor)
    340340{
    341341    Ref<JSON::Object> jsonMessage = JSON::Object::create();
    342342    if (columnNames)
    343343        jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
    344     if (notes.isAssigned())
    345         jsonMessage->setString(ASCIILiteral("notes"), notes.getValue());
    346     if (timestamp.isAssigned())
    347         jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue());
    348     if (values.isAssigned())
    349         jsonMessage->setObject(ASCIILiteral("values"), values.getValue());
    350     if (payload.isAssigned())
    351         jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue());
    352     if (databaseId.isAssigned())
    353         jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue());
     344    if (notes.has_value())
     345        jsonMessage->setString(ASCIILiteral("notes"), *notes);
     346    if (timestamp.has_value())
     347        jsonMessage->setDouble(ASCIILiteral("timestamp"), *timestamp);
     348    if (values.has_value())
     349        jsonMessage->setObject(ASCIILiteral("values"), *values);
     350    if (payload.has_value())
     351        jsonMessage->setValue(ASCIILiteral("payload"), *payload);
     352    if (databaseId.has_value())
     353        jsonMessage->setInteger(ASCIILiteral("databaseId"), *databaseId);
    354354    if (sqlError)
    355355        jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
    356     if (screenColor.isAssigned())
    357         jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue());
     356    if (screenColor.has_value())
     357        jsonMessage->setString(ASCIILiteral("screenColor"), *screenColor);
    358358    if (alternateColors)
    359359        jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors);
    360     if (printColor.isAssigned())
    361         jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue());
     360    if (printColor.has_value())
     361        jsonMessage->setString(ASCIILiteral("printColor"), *printColor);
    362362    CallbackBase::sendSuccess(WTFMove(jsonMessage));
    363363}
     
    368368    String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
    369369    if (m_backendDispatcher->hasProtocolErrors()) {
    370         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues"));
     370        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLAsyncOptionalReturnValues' can't be processed" });
    371371        return;
    372372    }
     
    396396    String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
    397397    if (m_backendDispatcher->hasProtocolErrors()) {
    398         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync"));
     398        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLSync' can't be processed" });
    399399        return;
    400400    }
     
    462462    String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
    463463    if (m_backendDispatcher->hasProtocolErrors()) {
    464         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync"));
     464        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLAsync' can't be processed" });
    465465        return;
    466466    }
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result

    r228196 r228546  
    9090public:
    9191    virtual ~AlternateDatabaseBackendDispatcher() { }
    92     virtual void executeAllOptionalParameters(long callId, const JSON::Array* in_columnNames, const String* const in_notes, const double* const in_timestamp, const JSON::Object* in_values, const JSON::Value* const in_payload, const int* const in_databaseId, const JSON::Object* in_sqlError, const String* const in_screenColor, const JSON::Array* in_alternateColors, const String* const in_printColor) = 0;
     92    virtual void executeAllOptionalParameters(long callId, const JSON::Array* in_columnNames, const String* in_notes, const double* in_timestamp, const JSON::Object* in_values, const JSON::Value* in_payload, const int* in_databaseId, const JSON::Object* in_sqlError, const String* in_screenColor, const JSON::Array* in_alternateColors, const String* in_printColor) = 0;
    9393    virtual void executeNoOptionalParameters(long callId, const JSON::Array& in_columnNames, const String& in_notes, double in_timestamp, const JSON::Object& in_values, JSON::Value in_payload, int in_databaseId, const JSON::Object& in_sqlError, const String& in_screenColor, const JSON::Array& in_alternateColors, const String& in_printColor) = 0;
    9494};
     
    153153        Black = 6,
    154154    }; // enum class PrintColor
    155     virtual void executeAllOptionalParameters(ErrorString&, const JSON::Array* opt_in_columnNames, const String* const opt_in_notes, const double* const opt_in_timestamp, const JSON::Object* opt_in_values, const JSON::Value* const opt_in_payload, const int* const opt_in_databaseId, const JSON::Object* opt_in_sqlError, const String* const opt_in_screenColor, const JSON::Array* opt_in_alternateColors, const String* const opt_in_printColor, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<JSON::Object>* opt_out_values, Inspector::Protocol::OptOutput<JSON::Value>* opt_out_payload, Inspector::Protocol::OptOutput<int>* opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
     155    virtual void executeAllOptionalParameters(ErrorString&, const JSON::Array* opt_in_columnNames, const String* opt_in_notes, const double* opt_in_timestamp, const JSON::Object* opt_in_values, const JSON::Value* opt_in_payload, const int* opt_in_databaseId, const JSON::Object* opt_in_sqlError, const String* opt_in_screenColor, const JSON::Array* opt_in_alternateColors, const String* opt_in_printColor, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, std::optional<String>& opt_out_notes, std::optional<double>& opt_out_timestamp, std::optional<JSON::Object>& opt_out_values, std::optional<JSON::Value>& opt_out_payload, std::optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;
    156156    virtual void executeNoOptionalParameters(ErrorString&, const JSON::Array& in_columnNames, const String& in_notes, double in_timestamp, const JSON::Object& in_values, JSON::Value in_payload, int in_databaseId, const JSON::Object& in_sqlError, const String& in_screenColor, const JSON::Array& in_alternateColors, const String& in_printColor, RefPtr<JSON::ArrayOf<String>>& out_columnNames, String* out_notes, double* out_timestamp, JSON::Object* out_values, JSON::Value* out_payload, int* out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& out_sqlError, Inspector::Protocol::Database::PrimaryColors* out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
    157157protected:
     
    251251        executeNoOptionalParameters(requestId, WTFMove(parameters));
    252252    else
    253         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
     253        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
    254254}
    255255
     
    261261    String opt_in_notes = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("notes"), &opt_in_notes_valueFound);
    262262    bool opt_in_timestamp_valueFound = false;
    263     Inspector::Protocol::OptOutput<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound);
     263    std::optional<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound);
    264264    bool opt_in_values_valueFound = false;
    265265    RefPtr<JSON::Object> opt_in_values = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("values"), &opt_in_values_valueFound);
     
    277277    String opt_in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), &opt_in_printColor_valueFound);
    278278    if (m_backendDispatcher->hasProtocolErrors()) {
    279         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeAllOptionalParameters"));
     279        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeAllOptionalParameters' can't be processed" });
    280280        return;
    281281    }
     
    291291    Ref<JSON::Object> result = JSON::Object::create();
    292292    RefPtr<JSON::ArrayOf<String>> out_columnNames;
    293     Inspector::Protocol::OptOutput<String> out_notes;
    294     Inspector::Protocol::OptOutput<double> out_timestamp;
    295     Inspector::Protocol::OptOutput<JSON::Object> out_values;
    296     Inspector::Protocol::OptOutput<JSON::Value> out_payload;
    297     Inspector::Protocol::OptOutput<int> out_databaseId;
     293    std::optional<String> out_notes;
     294    std::optional<double> out_timestamp;
     295    std::optional<JSON::Object> out_values;
     296    std::optional<JSON::Value> out_payload;
     297    std::optional<int> out_databaseId;
    298298    RefPtr<Inspector::Protocol::Database::Error> out_sqlError;
    299299    Inspector::Protocol::Database::PrimaryColors out_screenColor;
    300300    RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors;
    301301    DatabaseBackendDispatcherHandler::PrintColor out_printColor;
    302     m_agent->executeAllOptionalParameters(error, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);
     302    m_agent->executeAllOptionalParameters(error, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr, out_columnNames, out_notes, out_timestamp, out_values, out_payload, out_databaseId, out_sqlError, out_screenColor, out_alternateColors, out_printColor);
    303303
    304304    if (!error.length()) {
    305305        if (out_columnNames)
    306306            result->setArray(ASCIILiteral("columnNames"), out_columnNames);
    307         if (out_notes.isAssigned())
    308             result->setString(ASCIILiteral("notes"), out_notes.getValue());
    309         if (out_timestamp.isAssigned())
    310             result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
    311         if (out_values.isAssigned())
    312             result->setObject(ASCIILiteral("values"), out_values.getValue());
    313         if (out_payload.isAssigned())
    314             result->setValue(ASCIILiteral("payload"), out_payload.getValue());
    315         if (out_databaseId.isAssigned())
    316             result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
     307        if (out_notes.has_value())
     308            result->setString(ASCIILiteral("notes"), *out_notes);
     309        if (out_timestamp.has_value())
     310            result->setDouble(ASCIILiteral("timestamp"), *out_timestamp);
     311        if (out_values.has_value())
     312            result->setObject(ASCIILiteral("values"), *out_values);
     313        if (out_payload.has_value())
     314            result->setValue(ASCIILiteral("payload"), *out_payload);
     315        if (out_databaseId.has_value())
     316            result->setInteger(ASCIILiteral("databaseId"), *out_databaseId);
    317317        if (out_sqlError)
    318318            result->setObject(ASCIILiteral("sqlError"), out_sqlError);
    319         if (out_screenColor.isAssigned())
    320             result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());
     319        if (out_screenColor.has_value())
     320            result->setString(ASCIILiteral("screenColor"), *out_screenColor);
    321321        if (out_alternateColors)
    322322            result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
    323         if (out_printColor.isAssigned())
    324             result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
     323        if (out_printColor.has_value())
     324            result->setString(ASCIILiteral("printColor"), *out_printColor);
    325325    }
    326326    if (!error.length())
     
    343343    String in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), nullptr);
    344344    if (m_backendDispatcher->hasProtocolErrors()) {
    345         m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeNoOptionalParameters"));
     345        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeNoOptionalParameters' can't be processed" });
    346346        return;
    347347    }
     
    764764public:
    765765    ObjCInspectorDatabaseBackendDispatcher(id<TestProtocolDatabaseDomainHandler> handler) { m_delegate = handler; }
    766     virtual void executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* const in_notes, const double* const in_timestamp, const JSON::Object* in_values, const JSON::Value* const in_payload, const int* const in_databaseId, const JSON::Object* in_sqlError, const String* const in_screenColor, const JSON::Array* in_alternateColors, const String* const in_printColor) override;
     766    virtual void executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* in_notes, const double* in_timestamp, const JSON::Object* in_values, const JSON::Value* in_payload, const int* in_databaseId, const JSON::Object* in_sqlError, const String* in_screenColor, const JSON::Array* in_alternateColors, const String* in_printColor) override;
    767767    virtual void executeNoOptionalParameters(long requestId, const JSON::Array& in_columnNames, const String& in_notes, double in_timestamp, const JSON::Object& in_values, JSON::Value in_payload, int in_databaseId, const JSON::Object& in_sqlError, const String& in_screenColor, const JSON::Array& in_alternateColors, const String& in_printColor) override;
    768768private:
     
    814814namespace Inspector {
    815815
    816 void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* const in_notes, const double* const in_timestamp, const JSON::Object* in_values, const JSON::Value* const in_payload, const int* const in_databaseId, const JSON::Object* in_sqlError, const String* const in_screenColor, const JSON::Array* in_alternateColors, const String* const in_printColor)
     816void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* in_notes, const double* in_timestamp, const JSON::Object* in_values, const JSON::Value* in_payload, const int* in_databaseId, const JSON::Object* in_sqlError, const String* in_screenColor, const JSON::Array* in_alternateColors, const String* in_printColor)
    817817{
    818818    id errorCallback = ^(NSString *error) {
     
    923923    std::optional<TestProtocolDatabasePrimaryColors> o_in_screenColor = fromProtocolString<TestProtocolDatabasePrimaryColors>(in_screenColor);
    924924    if (!o_in_screenColor) {
    925         backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' of method '%s' cannot be processed", "screenColor", "Database.executeNoOptionalParameters"));
     925        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter 'screenColor' of method 'Database.executeNoOptionalParameters' cannot be processed" });
    926926        return;
    927927    }
     
    929929    std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> o_in_printColor = fromProtocolString<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor);
    930930    if (!o_in_printColor) {
    931         backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' of method '%s' cannot be processed", "printColor", "Database.executeNoOptionalParameters"));
     931        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter 'printColor' of method 'Database.executeNoOptionalParameters' cannot be processed" });
    932932        return;
    933933    }
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result

    r228196 r228546  
    272272        enable(requestId, WTFMove(parameters));
    273273    else
    274         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainA", '.', method, "' was not found"));
     274        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainA." + method + "' was not found");
    275275}
    276276
     
    316316        enable(requestId, WTFMove(parameters));
    317317    else
    318         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainB", '.', method, "' was not found"));
     318        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainB." + method + "' was not found");
    319319}
    320320
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result

    r228196 r228546  
    296296        loadResource1(requestId, WTFMove(parameters));
    297297    else
    298         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
     298        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network1." + method + "' was not found");
    299299}
    300300
     
    360360    auto findResult = dispatchMap.get().find(method);
    361361    if (findResult == dispatchMap.get().end()) {
    362         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network3", '.', method, "' was not found"));
     362        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network3." + method + "' was not found");
    363363        return;
    364364    }
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result

    r228196 r228546  
    254254        commandWithEnumReturnValue(requestId, WTFMove(parameters));
    255255    else
    256         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found"));
     256        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'CommandDomain." + method + "' was not found");
    257257}
    258258
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result

    r228196 r228546  
    235235public:
    236236    DatabaseFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
    237     void didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* const screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* const printColor);
     237    void didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* notes, const double* timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* printColor);
    238238    void didExecuteNoOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String& notes, double timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String& screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String& printColor);
    239239private:
     
    283283namespace Inspector {
    284284
    285 void DatabaseFrontendDispatcher::didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* const screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* const printColor)
     285void DatabaseFrontendDispatcher::didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* notes, const double* timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* printColor)
    286286{
    287287    Ref<JSON::Object> jsonMessage = JSON::Object::create();
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result

    r228196 r228546  
    253253        loadResource(requestId, WTFMove(parameters));
    254254    else
    255         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
     255        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network1." + method + "' was not found");
    256256}
    257257
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result

    r228196 r228546  
    560560
    561561template<> struct BindingTraits<Inspector::Protocol::Test::CastedAnimals> {
    562 #if !ASSERT_DISABLED
    563562static void assertValueHasExpectedType(JSON::Value*);
    564 #endif // !ASSERT_DISABLED
    565563};
    566564template<> struct BindingTraits<Inspector::Protocol::Test::TypeNeedingCast> {
    567565static RefPtr<Inspector::Protocol::Test::TypeNeedingCast> runtimeCast(RefPtr<JSON::Value>&& value);
    568 #if !ASSERT_DISABLED
    569566static void assertValueHasExpectedType(JSON::Value*);
    570 #endif // !ASSERT_DISABLED
    571567};
    572568template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject1> {
    573 #if !ASSERT_DISABLED
    574569static void assertValueHasExpectedType(JSON::Value*);
    575 #endif // !ASSERT_DISABLED
    576570};
    577571template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject2> {
    578 #if !ASSERT_DISABLED
    579572static void assertValueHasExpectedType(JSON::Value*);
    580 #endif // !ASSERT_DISABLED
    581573};
    582574
     
    694686
    695687
    696 #if !ASSERT_DISABLED
    697688void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(JSON::Value* value)
    698689{
     690#if ASSERT_DISABLED
     691    UNUSED_PARAM(value);
     692#else
    699693    ASSERT_ARG(value, value);
    700694    String result;
     
    702696    ASSERT(castSucceeded);
    703697    ASSERT(result == "Ducks" || result == "Hens" || result == "Crows" || result == "Flamingos");
    704 }
    705698#endif // !ASSERT_DISABLED
    706 
    707 #if !ASSERT_DISABLED
     699}
     700
    708701void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(JSON::Value* value)
    709702{
     703#if ASSERT_DISABLED
     704    UNUSED_PARAM(value);
     705#else
    710706    ASSERT_ARG(value, value);
    711707    RefPtr<JSON::Object> object;
     
    713709    ASSERT_UNUSED(castSucceeded, castSucceeded);
    714710    {
    715         JSON::Object::iterator stringPos = object->find(ASCIILiteral("string"));
     711        auto stringPos = object->find(ASCIILiteral("string"));
    716712        ASSERT(stringPos != object->end());
    717713        BindingTraits<String>::assertValueHasExpectedType(stringPos->value.get());
    718714    }
    719715    {
    720         JSON::Object::iterator numberPos = object->find(ASCIILiteral("number"));
     716        auto numberPos = object->find(ASCIILiteral("number"));
    721717        ASSERT(numberPos != object->end());
    722718        BindingTraits<int>::assertValueHasExpectedType(numberPos->value.get());
    723719    }
    724720    {
    725         JSON::Object::iterator animalsPos = object->find(ASCIILiteral("animals"));
     721        auto animalsPos = object->find(ASCIILiteral("animals"));
    726722        ASSERT(animalsPos != object->end());
    727723        BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(animalsPos->value.get());
    728724    }
    729725    {
    730         JSON::Object::iterator idPos = object->find(ASCIILiteral("id"));
     726        auto idPos = object->find(ASCIILiteral("id"));
    731727        ASSERT(idPos != object->end());
    732728        BindingTraits<int>::assertValueHasExpectedType(idPos->value.get());
    733729    }
    734730    {
    735         JSON::Object::iterator treePos = object->find(ASCIILiteral("tree"));
     731        auto treePos = object->find(ASCIILiteral("tree"));
    736732        ASSERT(treePos != object->end());
    737733        BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(treePos->value.get());
     
    741737    if (foundPropertiesCount != object->size())
    742738        FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
    743 }
    744739#endif // !ASSERT_DISABLED
     740}
    745741
    746742RefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::runtimeCast(RefPtr<JSON::Value>&& value)
     
    749745    bool castSucceeded = value->asObject(result);
    750746    ASSERT_UNUSED(castSucceeded, castSucceeded);
    751 #if !ASSERT_DISABLED
    752747    BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(result.get());
    753 #endif  // !ASSERT_DISABLED
    754748    COMPILE_ASSERT(sizeof(Inspector::Protocol::Test::TypeNeedingCast) == sizeof(JSON::ObjectBase), type_cast_problem);
    755749    return static_cast<Inspector::Protocol::Test::TypeNeedingCast*>(static_cast<JSON::ObjectBase*>(result.get()));
     
    757751
    758752
    759 #if !ASSERT_DISABLED
    760753void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(JSON::Value* value)
    761754{
     755#if ASSERT_DISABLED
     756    UNUSED_PARAM(value);
     757#else
    762758    ASSERT_ARG(value, value);
    763759    RefPtr<JSON::Object> object;
     
    767763    int foundPropertiesCount = 0;
    768764    {
    769         JSON::Object::iterator objPos = object->find(ASCIILiteral("obj"));
     765        auto objPos = object->find(ASCIILiteral("obj"));
    770766        if (objPos != object->end()) {
    771767            BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(objPos->value.get());
     
    775771    if (foundPropertiesCount != object->size())
    776772        FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
    777 }
    778773#endif // !ASSERT_DISABLED
    779 
    780 #if !ASSERT_DISABLED
     774}
     775
    781776void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(JSON::Value* value)
    782777{
     778#if ASSERT_DISABLED
     779    UNUSED_PARAM(value);
     780#else
    783781    ASSERT_ARG(value, value);
    784782    RefPtr<JSON::Object> object;
     
    788786    int foundPropertiesCount = 0;
    789787    {
    790         JSON::Object::iterator objPos = object->find(ASCIILiteral("obj"));
     788        auto objPos = object->find(ASCIILiteral("obj"));
    791789        if (objPos != object->end()) {
    792790            BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(objPos->value.get());
     
    796794    if (foundPropertiesCount != object->size())
    797795        FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
    798 }
    799796#endif // !ASSERT_DISABLED
     797}
    800798
    801799} // namespace Protocol
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result

    r228196 r228546  
    273273        enable(requestId, WTFMove(parameters));
    274274    else
    275         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainA", '.', method, "' was not found"));
     275        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainA." + method + "' was not found");
    276276}
    277277
     
    317317        enable(requestId, WTFMove(parameters));
    318318    else
    319         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainB", '.', method, "' was not found"));
     319        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainB." + method + "' was not found");
    320320}
    321321
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result

    r228196 r228546  
    239239        loadResource(requestId, WTFMove(parameters));
    240240    else
    241         m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network", '.', method, "' was not found"));
     241        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found");
    242242}
    243243
  • trunk/Source/WebCore/ChangeLog

    r228545 r228546  
     12018-02-15  Darin Adler  <darin@apple.com>
     2
     3        Web Inspector: get rid of remaining uses of OptOutput<T>
     4        https://bugs.webkit.org/show_bug.cgi?id=180607
     5
     6        Reviewed by Brian Burg.
     7
     8        * inspector/InspectorStyleSheet.cpp:
     9        (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*.
     10        (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead
     11        of lineEndings().get().
     12        (WebCore::InspectorStyle::styleWithProperties const): Ditto.
     13        (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto.
     14        (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of
     15        a std::unique_ptr<Vector>.
     16        (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto.
     17        * inspector/InspectorStyleSheet.h: Updated for the above.
     18
     19        * inspector/agents/InspectorCSSAgent.h: Removed some bogus const.
     20        * inspector/agents/InspectorCanvasAgent.cpp: Ditto.
     21        * inspector/agents/InspectorCanvasAgent.h: Ditto.
     22
     23        * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings
     24        so we don't waste space with a pointer to the string.
     25        (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed
     26        explicit creation of String, which was wasteful and unnecessary.
     27        (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto.
     28        (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto.
     29        (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto.
     30        (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const.
     31
     32        * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use
     33        final instead of override.
     34        * inspector/agents/InspectorPageAgent.cpp: Ditto.
     35        * inspector/agents/InspectorPageAgent.h: Ditto.
     36
    1372018-02-15  Chris Dumez  <cdumez@apple.com>
    238
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp

    r228218 r228546  
    386386};
    387387
    388 static RefPtr<Inspector::Protocol::CSS::SourceRange> buildSourceRangeObject(const SourceRange& range, Vector<size_t>* lineEndings, int* endingLine = nullptr)
    389 {
    390     if (!lineEndings)
     388static RefPtr<Inspector::Protocol::CSS::SourceRange> buildSourceRangeObject(const SourceRange& range, const Vector<size_t>& lineEndings, int* endingLine = nullptr)
     389{
     390    if (lineEndings.isEmpty())
    391391        return nullptr;
    392     TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, *lineEndings);
    393     TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, *lineEndings);
     392
     393    TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, lineEndings);
     394    TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, lineEndings);
    394395
    395396    if (endingLine)
     
    544545    RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
    545546    if (sourceData)
    546         result->setRange(buildSourceRangeObject(sourceData->ruleBodyRange, m_parentStyleSheet->lineEndings().get()));
     547        result->setRange(buildSourceRangeObject(sourceData->ruleBodyRange, m_parentStyleSheet->lineEndings()));
    547548
    548549    return WTFMove(result);
     
    626627    String previousPriority;
    627628    String previousStatus;
    628     std::unique_ptr<Vector<size_t>> lineEndings(m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : nullptr);
     629    Vector<size_t> lineEndings = m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : Vector<size_t> { };
    629630    auto sourceData = extractSourceData();
    630631    unsigned ruleBodyRangeStart = sourceData ? sourceData->ruleBodyRange.start : 0;
     
    668669            absolutePropertyRange.start += ruleBodyRangeStart;
    669670            absolutePropertyRange.end += ruleBodyRangeStart;
    670             property->setRange(buildSourceRangeObject(absolutePropertyRange, lineEndings.get()));
     671            property->setRange(buildSourceRangeObject(absolutePropertyRange, lineEndings));
    671672        }
    672673
     
    11501151        .release();
    11511152    if (sourceData)
    1152         result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings().get(), &endingLine));
     1153        result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings(), &endingLine));
    11531154    return result;
    11541155}
     
    12831284}
    12841285
    1285 std::unique_ptr<Vector<size_t>> InspectorStyleSheet::lineEndings() const
     1286Vector<size_t> InspectorStyleSheet::lineEndings() const
    12861287{
    12871288    if (!m_parsedStyleSheet->hasText())
    1288         return nullptr;
     1289        return { };
    12891290    return ContentSearchUtilities::lineEndings(m_parsedStyleSheet->text());
    12901291}
     
    15251526}
    15261527
    1527 std::unique_ptr<Vector<size_t>> InspectorStyleSheetForInlineStyle::lineEndings() const
     1528Vector<size_t> InspectorStyleSheetForInlineStyle::lineEndings() const
    15281529{
    15291530    return ContentSearchUtilities::lineEndings(elementStyleText());
  • trunk/Source/WebCore/inspector/InspectorStyleSheet.h

    r228218 r228546  
    199199    // Also accessed by friend class InspectorStyle.
    200200    virtual ExceptionOr<void> setStyleText(CSSStyleDeclaration*, const String&);
    201     virtual std::unique_ptr<Vector<size_t>> lineEndings() const;
     201    virtual Vector<size_t> lineEndings() const;
    202202
    203203private:
     
    247247    // Also accessed by friend class InspectorStyle.
    248248    ExceptionOr<void> setStyleText(CSSStyleDeclaration*, const String&) final;
    249     std::unique_ptr<Vector<size_t>> lineEndings() const final;
     249    Vector<size_t> lineEndings() const final;
    250250
    251251private:
  • trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.h

    r228218 r228546  
    100100    void getComputedStyleForNode(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSComputedStyleProperty>>&) override;
    101101    void getInlineStylesForNode(ErrorString&, int nodeId, RefPtr<Inspector::Protocol::CSS::CSSStyle>& inlineStyle, RefPtr<Inspector::Protocol::CSS::CSSStyle>& attributes) override;
    102     void getMatchedStylesForNode(ErrorString&, int nodeId, const bool* const includePseudo, const bool* const includeInherited, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>>& matchedCSSRules, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::PseudoIdMatches>>&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::InheritedStyleEntry>>& inheritedEntries) override;
     102    void getMatchedStylesForNode(ErrorString&, int nodeId, const bool* includePseudo, const bool* includeInherited, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>>& matchedCSSRules, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::PseudoIdMatches>>&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::InheritedStyleEntry>>& inheritedEntries) override;
    103103    void getAllStyleSheets(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSStyleSheetHeader>>& styleSheetInfos) override;
    104104    void getStyleSheet(ErrorString&, const String& styleSheetId, RefPtr<Inspector::Protocol::CSS::CSSStyleSheetBody>& result) override;
  • trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp

    r228218 r228546  
    242242}
    243243
    244 void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const String& canvasId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
     244void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
    245245{
    246246    auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId);
     
    263263}
    264264
    265 void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit)
     265void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* singleFrame, const int* memoryLimit)
    266266{
    267267    auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId);
  • trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h

    r228218 r228546  
    7373    void requestContent(ErrorString&, const String& canvasId, String* content) override;
    7474    void requestCSSCanvasClientNodes(ErrorString&, const String& canvasId, RefPtr<JSON::ArrayOf<int>>&) override;
    75     void resolveCanvasContext(ErrorString&, const String& canvasId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override;
    76     void startRecording(ErrorString&, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit) override;
     75    void resolveCanvasContext(ErrorString&, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override;
     76    void startRecording(ErrorString&, const String& canvasId, const bool* singleFrame, const int* memoryLimit) override;
    7777    void stopRecording(ErrorString&, const String& canvasId) override;
    7878    void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String*) override;
  • trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp

    r228218 r228546  
    4444
    4545enum DOMBreakpointType {
    46     SubtreeModified = 0,
     46    SubtreeModified,
    4747    AttributeModified,
    4848    NodeRemoved,
     
    5050};
    5151
    52 static const char* const listenerEventCategoryType = "listener:";
    53 static const char* const instrumentationEventCategoryType = "instrumentation:";
     52static const char listenerEventCategoryType[] = "listener:";
     53static const char instrumentationEventCategoryType[] = "instrumentation:";
    5454
    5555const uint32_t inheritableDOMBreakpointTypesMask = (1 << SubtreeModified);
     
    123123void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString& error, const String& eventName)
    124124{
    125     setBreakpoint(error, String(listenerEventCategoryType) + eventName);
     125    setBreakpoint(error, listenerEventCategoryType + eventName);
    126126}
    127127
    128128void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString& error, const String& eventName)
    129129{
    130     setBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
     130    setBreakpoint(error, instrumentationEventCategoryType + eventName);
    131131}
    132132
     
    143143void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString& error, const String& eventName)
    144144{
    145     removeBreakpoint(error, String(listenerEventCategoryType) + eventName);
     145    removeBreakpoint(error, listenerEventCategoryType + eventName);
    146146}
    147147
    148148void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString& error, const String& eventName)
    149149{
    150     removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
     150    removeBreakpoint(error, instrumentationEventCategoryType + eventName);
    151151}
    152152
     
    376376}
    377377
    378 void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* const optionalIsRegex)
     378void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex)
    379379{
    380380    if (url.isEmpty()) {
  • trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h

    r228218 r228546  
    5555
    5656    // DOMDebugger API
    57     void setXHRBreakpoint(ErrorString&, const String& url, const bool* const optionalIsRegex) override;
    58     void removeXHRBreakpoint(ErrorString&, const String& url) override;
    59     void setEventListenerBreakpoint(ErrorString&, const String& eventName) override;
    60     void removeEventListenerBreakpoint(ErrorString&, const String& eventName) override;
    61     void setInstrumentationBreakpoint(ErrorString&, const String& eventName) override;
    62     void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) override;
    63     void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
    64     void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
     57    void setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) final;
     58    void removeXHRBreakpoint(ErrorString&, const String& url) final;
     59    void setEventListenerBreakpoint(ErrorString&, const String& eventName) final;
     60    void removeEventListenerBreakpoint(ErrorString&, const String& eventName) final;
     61    void setInstrumentationBreakpoint(ErrorString&, const String& eventName) final;
     62    void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) final;
     63    void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) final;
     64    void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) final;
    6565
    6666    // InspectorInstrumentation
     
    7575    void mainFrameDOMContentLoaded();
    7676
    77     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
    78     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
    79     void discardAgent() override;
     77    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final;
     78    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
     79    void discardAgent() final;
    8080
    8181private:
    8282    // Inspector::InspectorDebuggerAgent::Listener implementation.
    83     void debuggerWasEnabled() override;
    84     void debuggerWasDisabled() override;
     83    void debuggerWasEnabled() final;
     84    void debuggerWasDisabled() final;
    8585    void disable();
    8686
  • trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp

    r228218 r228546  
    837837}
    838838
    839 void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
     839void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
    840840{
    841841    WebSocket* webSocket = webSocketForRequestId(requestId);
  • trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.h

    r228218 r228546  
    117117    void setResourceCachingDisabled(ErrorString&, bool disabled) final;
    118118    void loadResource(ErrorString&, const String& frameId, const String& url, Ref<LoadResourceCallback>&&) final;
    119     void resolveWebSocket(ErrorString&, const String& requestId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;
     119    void resolveWebSocket(ErrorString&, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;
    120120
    121121    virtual String loaderIdentifier(DocumentLoader*) = 0;
  • trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp

    r228218 r228546  
    316316}
    317317
    318 void InspectorPageAgent::reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources)
     318void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources)
    319319{
    320320    bool reloadFromOrigin = optionalReloadFromOrigin && *optionalReloadFromOrigin;
     
    472472}
    473473
    474 void InspectorPageAgent::searchInResource(ErrorString& errorString, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, const String* optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
     474void InspectorPageAgent::searchInResource(ErrorString& errorString, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>& results)
    475475{
    476476    results = JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>::create();
     
    525525}
    526526
    527 void InspectorPageAgent::searchInResources(ErrorString&, const String& text, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result)
     527void InspectorPageAgent::searchInResources(ErrorString&, const String& text, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result)
    528528{
    529529    result = JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>::create();
  • trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h

    r228218 r228546  
    8989
    9090    // Page API for InspectorFrontend
    91     void enable(ErrorString&) override;
    92     void disable(ErrorString&) override;
    93     void reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources) override;
    94     void navigate(ErrorString&, const String& url) override;
    95     void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) override;
    96     void deleteCookie(ErrorString&, const String& cookieName, const String& url) override;
    97     void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) override;
    98     void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) override;
    99     void searchInResource(ErrorString&, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, const String* const optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&) override;
    100     void searchInResources(ErrorString&, const String&, const bool* const caseSensitive, const bool* const isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&) override;
    101     void setShowPaintRects(ErrorString&, bool show) override;
    102     void setEmulatedMedia(ErrorString&, const String&) override;
    103     void getCompositingBordersVisible(ErrorString&, bool* out_param) override;
    104     void setCompositingBordersVisible(ErrorString&, bool) override;
    105     void snapshotNode(ErrorString&, int nodeId, String* outDataURL) override;
    106     void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) override;
    107     void archive(ErrorString&, String* data) override;
     91    void enable(ErrorString&) final;
     92    void disable(ErrorString&) final;
     93    void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final;
     94    void navigate(ErrorString&, const String& url) final;
     95    void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) final;
     96    void deleteCookie(ErrorString&, const String& cookieName, const String& url) final;
     97    void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) final;
     98    void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) final;
     99    void searchInResource(ErrorString&, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&) final;
     100    void searchInResources(ErrorString&, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&) final;
     101    void setShowPaintRects(ErrorString&, bool show) final;
     102    void setEmulatedMedia(ErrorString&, const String&) final;
     103    void getCompositingBordersVisible(ErrorString&, bool* out_param) final;
     104    void setCompositingBordersVisible(ErrorString&, bool) final;
     105    void snapshotNode(ErrorString&, int nodeId, String* outDataURL) final;
     106    void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) final;
     107    void archive(ErrorString&, String* data) final;
    108108
    109109    // InspectorInstrumentation
     
    124124
    125125    // Inspector Controller API
    126     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
    127     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
     126    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final;
     127    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
    128128
    129129    // Cross-agents API
  • trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h

    r228218 r228546  
    9999    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
    100100
    101     void start(ErrorString&, const int* const maxCallStackDepth = nullptr) final;
     101    void start(ErrorString&, const int* maxCallStackDepth = nullptr) final;
    102102    void stop(ErrorString&) final;
    103103    void setAutoCaptureEnabled(ErrorString&, bool) final;
  • trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h

    r224345 r228546  
    8686
    8787    Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
    88     void setOverlayMessage(ErrorString&, const String* const) final;
     88    void setOverlayMessage(ErrorString&, const String*) final;
    8989
    9090    Page& m_page;
Note: See TracChangeset for help on using the changeset viewer.