Web Inspector: get rid of remaining uses of OptOutput<T>
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 02:14:29 +0000 (02:14 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 16 Feb 2018 02:14:29 +0000 (02:14 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228546 268f45cc-cd09-0410-ab3c-d52691b4dbfc

53 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/AsyncStackTrace.cpp
Source/JavaScriptCore/inspector/AsyncStackTrace.h
Source/JavaScriptCore/inspector/ConsoleMessage.cpp
Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
Source/JavaScriptCore/inspector/ContentSearchUtilities.h
Source/JavaScriptCore/inspector/InjectedScript.cpp
Source/JavaScriptCore/inspector/InspectorProtocolTypes.h
Source/JavaScriptCore/inspector/ScriptCallFrame.cpp
Source/JavaScriptCore/inspector/ScriptCallFrame.h
Source/JavaScriptCore/inspector/ScriptCallStack.cpp
Source/JavaScriptCore/inspector/ScriptCallStack.h
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp
Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h
Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result
Source/JavaScriptCore/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result
Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result
Source/WebCore/ChangeLog
Source/WebCore/inspector/InspectorStyleSheet.cpp
Source/WebCore/inspector/InspectorStyleSheet.h
Source/WebCore/inspector/agents/InspectorCSSAgent.h
Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
Source/WebCore/inspector/agents/InspectorCanvasAgent.h
Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h
Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
Source/WebCore/inspector/agents/InspectorNetworkAgent.h
Source/WebCore/inspector/agents/InspectorPageAgent.cpp
Source/WebCore/inspector/agents/InspectorPageAgent.h
Source/WebCore/inspector/agents/InspectorTimelineAgent.h
Source/WebCore/inspector/agents/page/PageDebuggerAgent.h

index 9e0208c..85bc051 100644 (file)
@@ -1,3 +1,102 @@
+2018-02-15  Darin Adler  <darin@apple.com>
+
+        Web Inspector: get rid of remaining uses of OptOutput<T>
+        https://bugs.webkit.org/show_bug.cgi?id=180607
+
+        Reviewed by Brian Burg.
+
+        * 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.
+
 2018-02-15  Filip Pizlo  <fpizlo@apple.com>
 
         Unreviewed, roll out r228366 since it did not progress anything.
index 9e68b49..314b87c 100644 (file)
@@ -27,6 +27,7 @@
 #include "AsyncStackTrace.h"
 
 #include "ScriptCallStack.h"
+#include <wtf/Ref.h>
 
 namespace Inspector {
 
@@ -96,17 +97,17 @@ void AsyncStackTrace::didCancelAsyncCall()
     m_state = State::Canceled;
 }
 
-RefPtr<Inspector::Protocol::Console::StackTrace> AsyncStackTrace::buildInspectorObject() const
+RefPtr<Protocol::Console::StackTrace> AsyncStackTrace::buildInspectorObject() const
 {
-    RefPtr<Inspector::Protocol::Console::StackTrace> topStackTrace;
-    RefPtr<Inspector::Protocol::Console::StackTrace> previousStackTrace;
+    RefPtr<Protocol::Console::StackTrace> topStackTrace;
+    RefPtr<Protocol::Console::StackTrace> previousStackTrace;
 
     auto* stackTrace = this;
     while (stackTrace) {
         auto& callStack = stackTrace->m_callStack;
         ASSERT(callStack->size());
 
-        RefPtr<Inspector::Protocol::Console::StackTrace> protocolObject = Inspector::Protocol::Console::StackTrace::create()
+        auto protocolObject = Protocol::Console::StackTrace::create()
             .setCallFrames(callStack->buildInspectorArray())
             .release();
 
@@ -116,12 +117,12 @@ RefPtr<Inspector::Protocol::Console::StackTrace> AsyncStackTrace::buildInspector
             protocolObject->setTopCallFrameIsBoundary(true);
 
         if (!topStackTrace)
-            topStackTrace = protocolObject;
+            topStackTrace = protocolObject.ptr();
 
         if (previousStackTrace)
-            previousStackTrace->setParentStackTrace(protocolObject);
+            previousStackTrace->setParentStackTrace(protocolObject.ptr());
 
-        previousStackTrace = protocolObject;
+        previousStackTrace = WTFMove(protocolObject);
         stackTrace = stackTrace->m_parent.get();
     }
 
index a618fe7..1c3ccf4 100644 (file)
@@ -51,7 +51,7 @@ public:
     void didDispatchAsyncCall();
     void didCancelAsyncCall();
 
-    RefPtr<Inspector::Protocol::Console::StackTrace> buildInspectorObject() const;
+    RefPtr<Protocol::Console::StackTrace> buildInspectorObject() const;
 
     ~AsyncStackTrace();
 
index 4c17515..5cfb04d 100644 (file)
@@ -154,61 +154,61 @@ void ConsoleMessage::autogenerateMetadata(JSC::ExecState* state)
     }
 }
 
-static Inspector::Protocol::Console::ChannelSource messageSourceValue(MessageSource source)
+static Protocol::Console::ChannelSource messageSourceValue(MessageSource source)
 {
     switch (source) {
-    case MessageSource::XML: return Inspector::Protocol::Console::ChannelSource::XML;
-    case MessageSource::JS: return Inspector::Protocol::Console::ChannelSource::Javascript;
-    case MessageSource::Network: return Inspector::Protocol::Console::ChannelSource::Network;
-    case MessageSource::ConsoleAPI: return Inspector::Protocol::Console::ChannelSource::ConsoleAPI;
-    case MessageSource::Storage: return Inspector::Protocol::Console::ChannelSource::Storage;
-    case MessageSource::AppCache: return Inspector::Protocol::Console::ChannelSource::Appcache;
-    case MessageSource::Rendering: return Inspector::Protocol::Console::ChannelSource::Rendering;
-    case MessageSource::CSS: return Inspector::Protocol::Console::ChannelSource::CSS;
-    case MessageSource::Security: return Inspector::Protocol::Console::ChannelSource::Security;
-    case MessageSource::ContentBlocker: return Inspector::Protocol::Console::ChannelSource::ContentBlocker;
-    case MessageSource::Other: return Inspector::Protocol::Console::ChannelSource::Other;
-    case MessageSource::Media: return Inspector::Protocol::Console::ChannelSource::Media;
-    case MessageSource::WebRTC: return Inspector::Protocol::Console::ChannelSource::WebRTC;
+    case MessageSource::XML: return Protocol::Console::ChannelSource::XML;
+    case MessageSource::JS: return Protocol::Console::ChannelSource::Javascript;
+    case MessageSource::Network: return Protocol::Console::ChannelSource::Network;
+    case MessageSource::ConsoleAPI: return Protocol::Console::ChannelSource::ConsoleAPI;
+    case MessageSource::Storage: return Protocol::Console::ChannelSource::Storage;
+    case MessageSource::AppCache: return Protocol::Console::ChannelSource::Appcache;
+    case MessageSource::Rendering: return Protocol::Console::ChannelSource::Rendering;
+    case MessageSource::CSS: return Protocol::Console::ChannelSource::CSS;
+    case MessageSource::Security: return Protocol::Console::ChannelSource::Security;
+    case MessageSource::ContentBlocker: return Protocol::Console::ChannelSource::ContentBlocker;
+    case MessageSource::Other: return Protocol::Console::ChannelSource::Other;
+    case MessageSource::Media: return Protocol::Console::ChannelSource::Media;
+    case MessageSource::WebRTC: return Protocol::Console::ChannelSource::WebRTC;
     }
-    return Inspector::Protocol::Console::ChannelSource::Other;
+    return Protocol::Console::ChannelSource::Other;
 }
 
-static Inspector::Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type)
+static Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type)
 {
     switch (type) {
-    case MessageType::Log: return Inspector::Protocol::Console::ConsoleMessage::Type::Log;
-    case MessageType::Clear: return Inspector::Protocol::Console::ConsoleMessage::Type::Clear;
-    case MessageType::Dir: return Inspector::Protocol::Console::ConsoleMessage::Type::Dir;
-    case MessageType::DirXML: return Inspector::Protocol::Console::ConsoleMessage::Type::DirXML;
-    case MessageType::Table: return Inspector::Protocol::Console::ConsoleMessage::Type::Table;
-    case MessageType::Trace: return Inspector::Protocol::Console::ConsoleMessage::Type::Trace;
-    case MessageType::StartGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroup;
-    case MessageType::StartGroupCollapsed: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed;
-    case MessageType::EndGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::EndGroup;
-    case MessageType::Assert: return Inspector::Protocol::Console::ConsoleMessage::Type::Assert;
-    case MessageType::Timing: return Inspector::Protocol::Console::ConsoleMessage::Type::Timing;
-    case MessageType::Profile: return Inspector::Protocol::Console::ConsoleMessage::Type::Profile;
-    case MessageType::ProfileEnd: return Inspector::Protocol::Console::ConsoleMessage::Type::ProfileEnd;
+    case MessageType::Log: return Protocol::Console::ConsoleMessage::Type::Log;
+    case MessageType::Clear: return Protocol::Console::ConsoleMessage::Type::Clear;
+    case MessageType::Dir: return Protocol::Console::ConsoleMessage::Type::Dir;
+    case MessageType::DirXML: return Protocol::Console::ConsoleMessage::Type::DirXML;
+    case MessageType::Table: return Protocol::Console::ConsoleMessage::Type::Table;
+    case MessageType::Trace: return Protocol::Console::ConsoleMessage::Type::Trace;
+    case MessageType::StartGroup: return Protocol::Console::ConsoleMessage::Type::StartGroup;
+    case MessageType::StartGroupCollapsed: return Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed;
+    case MessageType::EndGroup: return Protocol::Console::ConsoleMessage::Type::EndGroup;
+    case MessageType::Assert: return Protocol::Console::ConsoleMessage::Type::Assert;
+    case MessageType::Timing: return Protocol::Console::ConsoleMessage::Type::Timing;
+    case MessageType::Profile: return Protocol::Console::ConsoleMessage::Type::Profile;
+    case MessageType::ProfileEnd: return Protocol::Console::ConsoleMessage::Type::ProfileEnd;
     }
-    return Inspector::Protocol::Console::ConsoleMessage::Type::Log;
+    return Protocol::Console::ConsoleMessage::Type::Log;
 }
 
-static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level)
+static Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level)
 {
     switch (level) {
-    case MessageLevel::Log: return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
-    case MessageLevel::Info: return Inspector::Protocol::Console::ConsoleMessage::Level::Info;
-    case MessageLevel::Warning: return Inspector::Protocol::Console::ConsoleMessage::Level::Warning;
-    case MessageLevel::Error: return Inspector::Protocol::Console::ConsoleMessage::Level::Error;
-    case MessageLevel::Debug: return Inspector::Protocol::Console::ConsoleMessage::Level::Debug;
+    case MessageLevel::Log: return Protocol::Console::ConsoleMessage::Level::Log;
+    case MessageLevel::Info: return Protocol::Console::ConsoleMessage::Level::Info;
+    case MessageLevel::Warning: return Protocol::Console::ConsoleMessage::Level::Warning;
+    case MessageLevel::Error: return Protocol::Console::ConsoleMessage::Level::Error;
+    case MessageLevel::Debug: return Protocol::Console::ConsoleMessage::Level::Debug;
     }
-    return Inspector::Protocol::Console::ConsoleMessage::Level::Log;
+    return Protocol::Console::ConsoleMessage::Level::Log;
 }
 
 void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher& consoleFrontendDispatcher, InjectedScriptManager& injectedScriptManager, bool generatePreview)
 {
-    auto messageObject = Inspector::Protocol::Console::ConsoleMessage::create()
+    auto messageObject = Protocol::Console::ConsoleMessage::create()
         .setSource(messageSourceValue(m_source))
         .setLevel(messageLevelValue(m_level))
         .setText(m_message)
@@ -227,7 +227,7 @@ void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher& consoleFrontendDis
     if ((m_arguments && m_arguments->argumentCount()) || m_jsonLogValues.size()) {
         InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(scriptState());
         if (!injectedScript.hasNoValue()) {
-            auto argumentsObject = JSON::ArrayOf<Inspector::Protocol::Runtime::RemoteObject>::create();
+            auto argumentsObject = JSON::ArrayOf<Protocol::Runtime::RemoteObject>::create();
             if (m_arguments && m_arguments->argumentCount()) {
                 if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) {
                     auto table = m_arguments->argumentAt(0);
index f91b210..aaa81e2 100644 (file)
@@ -35,6 +35,7 @@
 #include <wtf/BumpPointerAllocator.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringBuilder.h>
+#include <wtf/text/TextPosition.h>
 
 using namespace JSC::Yarr;
 
@@ -79,12 +80,12 @@ static Vector<std::pair<size_t, String>> getRegularExpressionMatchesByLines(cons
     if (text.isEmpty())
         return result;
 
-    std::unique_ptr<Vector<size_t>> endings(lineEndings(text));
-    size_t size = endings->size();
+    auto endings = lineEndings(text);
+    size_t size = endings.size();
     size_t start = 0;
 
     for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) {
-        size_t nextStart = endings->at(lineNumber);
+        size_t nextStart = endings[lineNumber];
         String line = text.substring(start, nextStart - start);
 
         int matchLength;
@@ -97,31 +98,31 @@ static Vector<std::pair<size_t, String>> getRegularExpressionMatchesByLines(cons
     return result;
 }
 
-std::unique_ptr<Vector<size_t>> lineEndings(const String& text)
+Vector<size_t> lineEndings(const String& text)
 {
-    auto result = std::make_unique<Vector<size_t>>();
+    Vector<size_t> result;
 
     size_t start = 0;
     while (start < text.length()) {
         size_t nextStart = text.find('\n', start);
         if (nextStart == notFound || nextStart == (text.length() - 1)) {
-            result->append(text.length());
+            result.append(text.length());
             break;
         }
 
         nextStart += 1;
-        result->append(nextStart);
+        result.append(nextStart);
         start = nextStart;
     }
 
-    result->append(text.length());
+    result.append(text.length());
 
     return result;
 }
 
-static Ref<Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
+static Ref<Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)
 {
-    return Inspector::Protocol::GenericTypes::SearchMatch::create()
+    return Protocol::GenericTypes::SearchMatch::create()
         .setLineNumber(lineNumber)
         .setLineContent(lineContent)
         .release();
@@ -151,27 +152,15 @@ int countRegularExpressionMatches(const RegularExpression& regex, const String&
     return result;
 }
 
-Ref<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
+Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)
 {
-    auto result = JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>::create();
-
-    RegularExpression regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex);
-    Vector<std::pair<size_t, String>> matches = getRegularExpressionMatchesByLines(regex, text);
-
-    for (const auto& match : matches) {
-        Ref<Inspector::Protocol::GenericTypes::SearchMatch> matchObject = buildObjectForSearchMatch(match.first, match.second);
-        result->addItem(WTFMove(matchObject));
-    }
-
+    auto result = JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>::create();
+    auto regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex);
+    for (const auto& match : getRegularExpressionMatchesByLines(regex, text))
+        result->addItem(buildObjectForSearchMatch(match.first, match.second));
     return result;
 }
 
-static String stylesheetCommentPattern(const String& name)
-{
-    // "/*# <name>=<value> */" and deprecated "/*@"
-    return "/\\*[#@][\040\t]" + name + "=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/";
-}
-
 static String findMagicComment(const String& content, const String& patternString)
 {
     if (content.isEmpty())
@@ -185,9 +174,8 @@ static String findMagicComment(const String& content, const String& patternStrin
     ASSERT(bytecodePattern);
 
     ASSERT(pattern.m_numSubpatterns == 1);
-    Vector<int, 4> matches;
-    matches.grow(4);
-    unsigned result = interpret(bytecodePattern.get(), content, 0, reinterpret_cast<unsigned*>(matches.data()));
+    std::array<unsigned, 4> matches;
+    unsigned result = interpret(bytecodePattern.get(), content, 0, matches.data());
     if (result == offsetNoMatch)
         return String();
 
@@ -197,7 +185,8 @@ static String findMagicComment(const String& content, const String& patternStrin
 
 String findStylesheetSourceMapURL(const String& content)
 {
-    return findMagicComment(content, stylesheetCommentPattern(ASCIILiteral("sourceMappingURL")));
+    // "/*# <name>=<value> */" and deprecated "/*@"
+    return findMagicComment(content, ASCIILiteral { "/\\*[#@][\040\t]sourceMappingURL=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/" });
 }
 
 } // namespace ContentSearchUtilities
index 55b191e..d2ea8ee 100644 (file)
@@ -29,9 +29,7 @@
 #pragma once
 
 #include "InspectorProtocolObjects.h"
-#include <wtf/Vector.h>
-#include <wtf/text/TextPosition.h>
-#include <wtf/text/WTFString.h>
+#include <wtf/Forward.h>
 
 namespace JSC { namespace Yarr {
 class RegularExpression;
@@ -43,9 +41,9 @@ namespace ContentSearchUtilities {
 
 JS_EXPORT_PRIVATE JSC::Yarr::RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex);
 JS_EXPORT_PRIVATE int countRegularExpressionMatches(const JSC::Yarr::RegularExpression&, const String&);
-JS_EXPORT_PRIVATE Ref<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
+JS_EXPORT_PRIVATE Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);
 JS_EXPORT_PRIVATE TextPosition textPositionFromOffset(size_t offset, const Vector<size_t>& lineEndings);
-JS_EXPORT_PRIVATE std::unique_ptr<Vector<size_t>> lineEndings(const String&);
+JS_EXPORT_PRIVATE Vector<size_t> lineEndings(const String&);
 
 JS_EXPORT_PRIVATE String findStylesheetSourceMapURL(const String& content);
 
index 3efc3fd..fa828d0 100644 (file)
@@ -54,7 +54,7 @@ InjectedScript::~InjectedScript()
 {
 }
 
-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)
+void 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)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluate"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(expression);
@@ -66,7 +66,7 @@ void InjectedScript::evaluate(ErrorString& errorString, const String& expression
     makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
 }
 
-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)
+void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, bool& wasThrown)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("callFunctionOn"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(objectId);
@@ -79,7 +79,7 @@ void InjectedScript::callFunctionOn(ErrorString& errorString, const String& obje
     makeEvalCall(errorString, function, result, wasThrown, unused);
 }
 
-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)
+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<Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluateOnCallFrame"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(callFrames);
@@ -93,7 +93,7 @@ void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue
     makeEvalCall(errorString, function, result, wasThrown, savedResultIndex);
 }
 
-void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& result)
+void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& result)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getFunctionDetails"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(functionId);
@@ -105,7 +105,7 @@ void InjectedScript::getFunctionDetails(ErrorString& errorString, const String&
         return;
     }
 
-    result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
+    result = BindingTraits<Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
 }
 
 void InjectedScript::functionDetails(ErrorString& errorString, JSC::JSValue value, RefPtr<Protocol::Debugger::FunctionDetails>& result)
@@ -120,7 +120,7 @@ void InjectedScript::functionDetails(ErrorString& errorString, JSC::JSValue valu
         return;
     }
 
-    result = BindingTraits<Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
+    result = BindingTraits<Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));
 }
 
 void InjectedScript::getPreview(ErrorString& errorString, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>& result)
@@ -135,10 +135,10 @@ void InjectedScript::getPreview(ErrorString& errorString, const String& objectId
         return;
     }
 
-    result = BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(WTFMove(resultValue));
+    result = BindingTraits<Protocol::Runtime::ObjectPreview>::runtimeCast(WTFMove(resultValue));
 }
 
-void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& properties)
+void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& properties)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(objectId);
@@ -151,10 +151,10 @@ void InjectedScript::getProperties(ErrorString& errorString, const String& objec
         return;
     }
 
-    properties = BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
+    properties = BindingTraits<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
 }
 
-void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& properties)
+void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& properties)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getDisplayableProperties"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(objectId);
@@ -166,10 +166,10 @@ void InjectedScript::getDisplayableProperties(ErrorString& errorString, const St
         return;
     }
 
-    properties = BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
+    properties = BindingTraits<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));
 }
 
-void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& properties)
+void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& properties)
 {
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getInternalProperties"), inspectorEnvironment()->functionCallHandler());
     function.appendArgument(objectId);
@@ -181,7 +181,7 @@ void InjectedScript::getInternalProperties(ErrorString& errorString, const Strin
         return;
     }
 
-    auto array = BindingTraits<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result));
+    auto array = BindingTraits<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result));
     properties = array->length() > 0 ? array : nullptr;
 }
 
@@ -218,7 +218,7 @@ void InjectedScript::saveResult(ErrorString& errorString, const String& callArgu
         savedResultIndex = resultIndex;
 }
 
-Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(JSC::JSValue callFrames) const
+Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(JSC::JSValue callFrames) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("wrapCallFrames"), inspectorEnvironment()->functionCallHandler());
@@ -227,16 +227,16 @@ Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wra
     bool hadException = false;
     auto callFramesValue = callFunctionWithEvalEnabled(function, hadException);
     if (!callFramesValue)
-        return JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>::create();
+        return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create();
     ASSERT(!hadException);
     RefPtr<JSON::Value> result = toInspectorValue(*scriptState(), callFramesValue);
     if (result->type() == JSON::Value::Type::Array)
-        return BindingTraits<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull();
+        return BindingTraits<JSON::ArrayOf<Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull();
 
-    return JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>::create();
+    return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create();
 }
 
-RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue value, const String& groupName, bool generatePreview) const
+RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue value, const String& groupName, bool generatePreview) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapObject"), inspectorEnvironment()->functionCallHandler());
@@ -254,7 +254,7 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JS
     bool castSucceeded = toInspectorValue(*scriptState(), r)->asObject(resultObject);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
-    return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
+    return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
 }
 
 RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapJSONString(const String& json, const String& groupName, bool generatePreview) const
@@ -277,10 +277,10 @@ RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapJSONString(const Str
     bool castSucceeded = toInspectorValue(*scriptState(), evalResult)->asObject(resultObject);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
-    return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
+    return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
 }
 
-RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC::JSValue table, JSC::JSValue columns) const
+RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC::JSValue table, JSC::JSValue columns) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("wrapTable"), inspectorEnvironment()->functionCallHandler());
@@ -300,10 +300,10 @@ RefPtr<Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC
     bool castSucceeded = toInspectorValue(*scriptState(), r)->asObject(resultObject);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
-    return BindingTraits<Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
+    return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);
 }
 
-RefPtr<Inspector::Protocol::Runtime::ObjectPreview> InjectedScript::previewValue(JSC::JSValue value) const
+RefPtr<Protocol::Runtime::ObjectPreview> InjectedScript::previewValue(JSC::JSValue value) const
 {
     ASSERT(!hasNoValue());
     Deprecated::ScriptFunctionCall wrapFunction(injectedScriptObject(), ASCIILiteral("previewValue"), inspectorEnvironment()->functionCallHandler());
@@ -318,7 +318,7 @@ RefPtr<Inspector::Protocol::Runtime::ObjectPreview> InjectedScript::previewValue
     bool castSucceeded = toInspectorValue(*scriptState(), r)->asObject(resultObject);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
 
-    return BindingTraits<Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(resultObject);
+    return BindingTraits<Protocol::Runtime::ObjectPreview>::runtimeCast(resultObject);
 }
 
 void InjectedScript::setExceptionValue(JSC::JSValue value)
index 076573e..5b1565b 100644 (file)
@@ -33,104 +33,57 @@ namespace Inspector {
 
 namespace Protocol {
 
-template<typename T> struct BindingTraits;
+template<typename> struct BindingTraits;
 
-template<typename T>
-class OptOutput {
-public:
-    OptOutput() : m_assigned(false) { }
-
-    void operator=(T value)
-    {
-        m_value = value;
-        m_assigned = true;
-    }
-
-    bool isAssigned() const { return m_assigned; }
-
-    T getValue()
-    {
-        ASSERT(isAssigned());
-        return m_value;
-    }
-
-private:
-    T m_value;
-    bool m_assigned;
-
-    WTF_MAKE_NONCOPYABLE(OptOutput);
-};
-
-// Helper methods for Protocol and other JSON types are provided by
-// specializations of BindingTraits<T>. Some are generated for protocol types.
-
-template<typename T>
-struct BindingTraits {
-    typedef T BindingType;
-
-    static void push(JSON::Array&, BindingType&);
-    static JSON::Value::Type typeTag();
-    static RefPtr<T> runtimeCast(RefPtr<JSON::Object>&&);
-#if !ASSERT_DISABLED
-    static void assertValueHasExpectedType(JSON::Value*);
-#endif // !ASSERT_DISABLED
-};
-
-template<JSON::Value::Type TYPE>
-struct PrimitiveBindingTraits {
-#if !ASSERT_DISABLED
+template<JSON::Value::Type type> struct PrimitiveBindingTraits {
     static void assertValueHasExpectedType(JSON::Value* value)
     {
-        ASSERT_ARG(value, value && value->type() == TYPE);
+        ASSERT_UNUSED(value, value);
+        ASSERT_UNUSED(value, value->type() == type);
     }
-#endif // !ASSERT_DISABLED
 };
 
-template<typename T>
-struct BindingTraits<JSON::ArrayOf<T>> {
+template<typename T> struct BindingTraits<JSON::ArrayOf<T>> {
     static RefPtr<JSON::ArrayOf<T>> runtimeCast(RefPtr<JSON::Value>&& value)
     {
         ASSERT_ARG(value, value);
         RefPtr<JSON::Array> array;
         bool castSucceeded = value->asArray(array);
         ASSERT_UNUSED(castSucceeded, castSucceeded);
-#if !ASSERT_DISABLED
         assertValueHasExpectedType(array.get());
-#endif // !ASSERT_DISABLED
         COMPILE_ASSERT(sizeof(JSON::ArrayOf<T>) == sizeof(JSON::Array), type_cast_problem);
         return static_cast<JSON::ArrayOf<T>*>(static_cast<JSON::ArrayBase*>(array.get()));
     }
 
-#if !ASSERT_DISABLED
     static void assertValueHasExpectedType(JSON::Value* value)
     {
+#if ASSERT_DISABLED
+        UNUSED_PARAM(value);
+#else
         ASSERT_ARG(value, value);
         RefPtr<JSON::Array> array;
         bool castSucceeded = value->asArray(array);
         ASSERT_UNUSED(castSucceeded, castSucceeded);
         for (unsigned i = 0; i < array->length(); i++)
             BindingTraits<T>::assertValueHasExpectedType(array->get(i).get());
-    }
 #endif // !ASSERT_DISABLED
+    }
 };
 
-template<>
-struct BindingTraits<JSON::Value> {
-#if !ASSERT_DISABLED
+template<> struct BindingTraits<JSON::Value> {
     static void assertValueHasExpectedType(JSON::Value*)
     {
     }
-#endif // !ASSERT_DISABLED
 };
 
-template<> struct BindingTraits<JSON::Array> : public PrimitiveBindingTraits<JSON::Value::Type::Array> { };
-template<> struct BindingTraits<JSON::Object> : public PrimitiveBindingTraits<JSON::Value::Type::Object> { };
-template<> struct BindingTraits<String> : public PrimitiveBindingTraits<JSON::Value::Type::String> { };
-template<> struct BindingTraits<bool> : public PrimitiveBindingTraits<JSON::Value::Type::Boolean> { };
-template<> struct BindingTraits<double> : public PrimitiveBindingTraits<JSON::Value::Type::Double> { };
-template<> struct BindingTraits<int> : public PrimitiveBindingTraits<JSON::Value::Type::Integer> { };
+template<> struct BindingTraits<JSON::Array> : PrimitiveBindingTraits<JSON::Value::Type::Array> { };
+template<> struct BindingTraits<JSON::Object> : PrimitiveBindingTraits<JSON::Value::Type::Object> { };
+template<> struct BindingTraits<String> : PrimitiveBindingTraits<JSON::Value::Type::String> { };
+template<> struct BindingTraits<bool> : PrimitiveBindingTraits<JSON::Value::Type::Boolean> { };
+template<> struct BindingTraits<double> : PrimitiveBindingTraits<JSON::Value::Type::Double> { };
+template<> struct BindingTraits<int> : PrimitiveBindingTraits<JSON::Value::Type::Integer> { };
 
-} // namespace Protocol
+}
 
 using Protocol::BindingTraits;
 
index a7300af..183fef1 100644 (file)
@@ -62,9 +62,9 @@ bool ScriptCallFrame::isNative() const
     return m_scriptName == "[native code]";
 }
 
-Ref<Inspector::Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
+Ref<Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const
 {
-    return Inspector::Protocol::Console::CallFrame::create()
+    return Protocol::Console::CallFrame::create()
         .setFunctionName(m_functionName)
         .setUrl(m_scriptName)
         .setScriptId(String::number(m_sourceID))
index 637be6f..c2f5c29 100644 (file)
@@ -54,7 +54,7 @@ public:
 
     bool operator==(const ScriptCallFrame& other) const { return isEqual(other); }
 
-    Ref<Inspector::Protocol::Console::CallFrame> buildInspectorObject() const;
+    Ref<Protocol::Console::CallFrame> buildInspectorObject() const;
 
 private:
     String m_functionName;
index 95ce331..7d53b4c 100644 (file)
@@ -105,9 +105,9 @@ bool ScriptCallStack::isEqual(ScriptCallStack* o) const
     return true;
 }
 
-Ref<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const
+Ref<JSON::ArrayOf<Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const
 {
-    auto frames = JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>::create();
+    auto frames = JSON::ArrayOf<Protocol::Console::CallFrame>::create();
     for (size_t i = 0; i < m_frames.size(); i++)
         frames->addItem(m_frames.at(i).buildInspectorObject());
     return frames;
index 99280b0..f9eccdc 100644 (file)
@@ -56,7 +56,7 @@ public:
 
     bool isEqual(ScriptCallStack*) const;
 
-    Ref<JSON::ArrayOf<Inspector::Protocol::Console::CallFrame>> buildInspectorArray() const;
+    Ref<JSON::ArrayOf<Protocol::Console::CallFrame>> buildInspectorArray() const;
 
 private:
     ScriptCallStack();
index 1941175..2a67a1e 100644 (file)
@@ -239,10 +239,10 @@ void InspectorConsoleAgent::addConsoleMessage(std::unique_ptr<ConsoleMessage> co
     }
 }
 
-void InspectorConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>& channels)
+void InspectorConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>& channels)
 {
     // Default implementation has no logging channels.
-    channels = JSON::ArrayOf<Inspector::Protocol::Console::Channel>::create();
+    channels = JSON::ArrayOf<Protocol::Console::Channel>::create();
 }
 
 void InspectorConsoleAgent::setLoggingChannelLevel(ErrorString& errorString, const String&, const String&)
index f1bcc6a..6184764 100644 (file)
@@ -73,7 +73,7 @@ public:
     void takeHeapSnapshot(const String& title);
     void count(JSC::ExecState*, Ref<ScriptArguments>&&);
 
-    void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Console::Channel>>&) override;
+    void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>&) override;
     void setLoggingChannelLevel(ErrorString&, const String& channel, const String& level) override;
 
 protected:
index a8b2398..240816c 100644 (file)
@@ -173,7 +173,7 @@ void InspectorDebuggerAgent::setSuppressAllPauses(bool suppress)
 
 static RefPtr<JSON::Object> buildAssertPauseReason(const String& message)
 {
-    auto reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release();
+    auto reason = Protocol::Debugger::AssertPauseReason::create().release();
     if (!message.isNull())
         reason->setMessage(message);
     return reason->openAccessors();
@@ -181,7 +181,7 @@ static RefPtr<JSON::Object> buildAssertPauseReason(const String& message)
 
 static RefPtr<JSON::Object> buildCSPViolationPauseReason(const String& directiveText)
 {
-    auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create()
+    auto reason = Protocol::Debugger::CSPViolationPauseReason::create()
         .setDirective(directiveText)
         .release();
     return reason->openAccessors();
@@ -194,7 +194,7 @@ RefPtr<JSON::Object> InspectorDebuggerAgent::buildBreakpointPauseReason(JSC::Bre
     if (it == m_debuggerBreakpointIdentifierToInspectorBreakpointIdentifier.end())
         return nullptr;
 
-    auto reason = Inspector::Protocol::Debugger::BreakpointPauseReason::create()
+    auto reason = Protocol::Debugger::BreakpointPauseReason::create()
         .setBreakpointId(it->value)
         .release();
     return reason->openAccessors();
@@ -342,19 +342,19 @@ static bool matches(const String& url, const String& pattern, bool isRegex)
 
 static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output)
 {
-    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
+    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Log)) {
         *output = ScriptBreakpointActionTypeLog;
         return true;
     }
-    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
+    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
         *output = ScriptBreakpointActionTypeEvaluate;
         return true;
     }
-    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
+    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Sound)) {
         *output = ScriptBreakpointActionTypeSound;
         return true;
     }
-    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
+    if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Probe)) {
         *output = ScriptBreakpointActionTypeProbe;
         return true;
     }
@@ -406,11 +406,11 @@ bool InspectorDebuggerAgent::breakpointActionsFromProtocol(ErrorString& errorStr
     return true;
 }
 
-static RefPtr<Inspector::Protocol::Debugger::Location> buildDebuggerLocation(const JSC::Breakpoint& breakpoint)
+static RefPtr<Protocol::Debugger::Location> buildDebuggerLocation(const JSC::Breakpoint& breakpoint)
 {
     ASSERT(breakpoint.resolved);
 
-    auto location = Inspector::Protocol::Debugger::Location::create()
+    auto location = Protocol::Debugger::Location::create()
         .setScriptId(String::number(breakpoint.sourceID))
         .setLineNumber(breakpoint.line)
         .release();
@@ -434,9 +434,9 @@ static bool parseLocation(ErrorString& errorString, const JSON::Object& location
     return true;
 }
 
-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)
+void 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)
 {
-    locations = JSON::ArrayOf<Inspector::Protocol::Debugger::Location>::create();
+    locations = JSON::ArrayOf<Protocol::Debugger::Location>::create();
     if (!optionalURL == !optionalURLRegex) {
         errorString = ASCIILiteral("Either url or urlRegex must be specified.");
         return;
@@ -495,7 +495,7 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int li
     *outBreakpointIdentifier = breakpointIdentifier;
 }
 
-void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const JSON::Object& location, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation)
+void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const JSON::Object& location, const JSON::Object* options, Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Protocol::Debugger::Location>& actualLocation)
 {
     JSC::SourceID sourceID;
     unsigned lineNumber;
@@ -659,7 +659,7 @@ void InspectorDebuggerAgent::continueToLocation(ErrorString& errorString, const
     m_scriptDebugServer.continueProgram();
 }
 
-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)
+void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>>& results)
 {
     JSC::SourceID sourceID = scriptIDStr.toIntPtr();
     auto it = m_scripts.find(sourceID);
@@ -683,7 +683,7 @@ void InspectorDebuggerAgent::getScriptSource(ErrorString& error, const String& s
         error = ASCIILiteral("No script for id: ") + scriptIDStr;
 }
 
-void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& details)
+void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& details)
 {
     InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(functionId);
     if (injectedScript.hasNoValue()) {
@@ -826,7 +826,7 @@ void InspectorDebuggerAgent::setPauseOnAssertions(ErrorString&, bool enabled)
     m_pauseOnAssertionFailures = enabled;
 }
 
-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)
+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<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& outWasThrown, std::optional<int>& savedResultIndex)
 {
     if (!m_currentCallStack) {
         errorString = ASCIILiteral("Not paused");
@@ -847,15 +847,11 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const
         muteConsole();
     }
 
-    // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
     bool wasThrown;
-    std::optional<int> savedResultIndex;
     injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack.get(), callFrameId, expression,
         objectGroup ? *objectGroup : emptyString(), includeCommandLineAPI && *includeCommandLineAPI, returnByValue && *returnByValue, generatePreview && *generatePreview, saveResult && *saveResult,
         result, wasThrown, savedResultIndex);
-    *outWasThrown = wasThrown;
-    if (savedResultIndex.has_value())
-        *outSavedResultIndex = savedResultIndex.value();
+    outWasThrown = wasThrown;
 
     if (pauseAndMute) {
         unmuteConsole();
@@ -873,11 +869,11 @@ void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
         breakProgram(DebuggerFrontendDispatcher::Reason::CSPViolation, buildCSPViolationPauseReason(directiveText));
 }
 
-Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)
+Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)
 {
     ASSERT(!injectedScript.hasNoValue());
     if (injectedScript.hasNoValue())
-        return JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>::create();
+        return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create();
 
     return injectedScript.wrapCallFrames(m_currentCallStack.get());
 }
@@ -1009,7 +1005,7 @@ void InspectorDebuggerAgent::didPause(JSC::ExecState& scriptState, JSC::JSValue
     m_conditionToDispatchResumed = ShouldDispatchResumed::No;
     m_enablePauseWhenIdle = false;
 
-    RefPtr<Inspector::Protocol::Console::StackTrace> asyncStackTrace;
+    RefPtr<Protocol::Console::StackTrace> asyncStackTrace;
     if (m_currentAsyncCallIdentifier) {
         auto it = m_pendingAsyncCalls.find(m_currentAsyncCallIdentifier.value());
         if (it != m_pendingAsyncCalls.end())
index 36d58c3..a541284 100644 (file)
@@ -63,14 +63,14 @@ public:
     void disable(ErrorString&) final;
     void setAsyncStackTraceDepth(ErrorString&, int depth) final;
     void setBreakpointsActive(ErrorString&, bool active) final;
-    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;
-    void setBreakpoint(ErrorString&, const JSON::Object& location, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation) final;
+    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;
+    void setBreakpoint(ErrorString&, const JSON::Object& location, const JSON::Object* options, Protocol::Debugger::BreakpointId*, RefPtr<Protocol::Debugger::Location>& actualLocation) final;
     void removeBreakpoint(ErrorString&, const String& breakpointIdentifier) final;
     void continueUntilNextRunLoop(ErrorString&) final;
     void continueToLocation(ErrorString&, const JSON::Object& location) final;
-    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;
+    void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>>&) final;
     void getScriptSource(ErrorString&, const String& scriptID, String* scriptSource) final;
-    void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>&) final;
+    void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>&) final;
     void pause(ErrorString&) final;
     void resume(ErrorString&) final;
     void stepOver(ErrorString&) final;
@@ -78,8 +78,8 @@ public:
     void stepOut(ErrorString&) final;
     void setPauseOnExceptions(ErrorString&, const String& pauseState) final;
     void setPauseOnAssertions(ErrorString&, bool enabled) final;
-    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;
-    void setOverlayMessage(ErrorString&, const String* const) override;
+    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;
+    void setOverlayMessage(ErrorString&, const String*) override;
 
     bool isPaused() const;
     bool breakpointsActive() const;
@@ -137,7 +137,7 @@ protected:
     virtual void didClearAsyncStackTraceData() { }
 
 private:
-    Ref<JSON::ArrayOf<Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);
+    Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);
 
     void didParseSource(JSC::SourceID, const Script&) final;
     void failedToParseSource(const String& url, const String& data, int firstLine, int errorLine, const String& errorMessage) final;
index f68d1ca..018a8da 100644 (file)
@@ -166,7 +166,7 @@ std::optional<HeapSnapshotNode> InspectorHeapAgent::nodeForHeapObjectIdentifier(
     return optionalNode;
 }
 
-void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview)
+void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Protocol::Runtime::ObjectPreview>& objectPreview)
 {
     // Prevent the cell from getting collected as we look it up.
     VM& vm = m_environment.vm();
@@ -215,7 +215,7 @@ void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId,
     objectPreview = injectedScript.previewValue(cell);
 }
 
-void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* const optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
+void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result)
 {
     // Prevent the cell from getting collected as we look it up.
     VM& vm = m_environment.vm();
@@ -250,16 +250,16 @@ void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjec
     result = injectedScript.wrapObject(cell, objectGroup, true);
 }
 
-static Inspector::Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(CollectionScope scope)
+static Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(CollectionScope scope)
 {
     switch (scope) {
     case CollectionScope::Full:
-        return Inspector::Protocol::Heap::GarbageCollection::Type::Full;
+        return Protocol::Heap::GarbageCollection::Type::Full;
     case CollectionScope::Eden:
-        return Inspector::Protocol::Heap::GarbageCollection::Type::Partial;
+        return Protocol::Heap::GarbageCollection::Type::Partial;
     }
     ASSERT_NOT_REACHED();
-    return Inspector::Protocol::Heap::GarbageCollection::Type::Full;
+    return Protocol::Heap::GarbageCollection::Type::Full;
 }
 
 void InspectorHeapAgent::willGarbageCollect()
@@ -301,9 +301,9 @@ void InspectorHeapAgent::clearHeapSnapshots()
     }
 }
 
-void InspectorHeapAgent::dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime)
+void InspectorHeapAgent::dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime)
 {
-    auto protocolObject = Inspector::Protocol::Heap::GarbageCollection::create()
+    auto protocolObject = Protocol::Heap::GarbageCollection::create()
         .setType(type)
         .setStartTime(startTime)
         .setEndTime(endTime)
index dae3571..aeebf39 100644 (file)
@@ -58,8 +58,8 @@ public:
     void snapshot(ErrorString&, double* timestamp, String* snapshotData) final;
     void startTracking(ErrorString&) final;
     void stopTracking(ErrorString&) final;
-    void getPreview(ErrorString&, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview) final;
-    void getRemoteObject(ErrorString&, int heapObjectId, const String* const optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) final;
+    void getPreview(ErrorString&, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>&, RefPtr<Protocol::Runtime::ObjectPreview>&) final;
+    void getRemoteObject(ErrorString&, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result) final;
 
     // HeapObserver
     void willGarbageCollect() override;
@@ -68,7 +68,7 @@ public:
 protected:
     void clearHeapSnapshots();
 
-    virtual void dispatchGarbageCollectedEvent(Inspector::Protocol::Heap::GarbageCollection::Type, double startTime, double endTime);
+    virtual void dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type, double startTime, double endTime);
 
 private:
     std::optional<JSC::HeapSnapshotNode> nodeForHeapObjectIdentifier(ErrorString&, unsigned heapObjectIdentifier);
index 954322d..99da9da 100644 (file)
 #include <wtf/CurrentTime.h>
 #include <wtf/JSONValues.h>
 
-using namespace JSC;
-
 namespace Inspector {
 
-static bool asBool(const bool* const b)
+using namespace JSC;
+
+static bool asBool(const bool* b)
 {
-    return b ? *b : false;
+    return b && *b;
 }
 
 InspectorRuntimeAgent::InspectorRuntimeAgent(AgentContext& context)
@@ -70,21 +70,21 @@ InspectorRuntimeAgent::~InspectorRuntimeAgent()
 
 static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer& scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState)
 {
-    ScriptDebugServer::PauseOnExceptionsState presentState = scriptDebugServer.pauseOnExceptionsState();
+    auto presentState = scriptDebugServer.pauseOnExceptionsState();
     if (presentState != newState)
         scriptDebugServer.setPauseOnExceptionsState(newState);
     return presentState;
 }
 
-static Ref<Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
+static Ref<Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)
 {
-    return Inspector::Protocol::Runtime::ErrorRange::create()
+    return Protocol::Runtime::ErrorRange::create()
         .setStartOffset(tokenLocation.startOffset)
         .setEndOffset(tokenLocation.endOffset)
         .release();
 }
 
-void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range)
+void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>& range)
 {
     JSLockHolder lock(m_vm);
 
@@ -93,26 +93,26 @@ void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspec
 
     switch (error.syntaxErrorType()) {
     case ParserError::SyntaxErrorNone:
-        *result = Inspector::Protocol::Runtime::SyntaxErrorType::None;
+        *result = Protocol::Runtime::SyntaxErrorType::None;
         break;
     case ParserError::SyntaxErrorIrrecoverable:
-        *result = Inspector::Protocol::Runtime::SyntaxErrorType::Irrecoverable;
+        *result = Protocol::Runtime::SyntaxErrorType::Irrecoverable;
         break;
     case ParserError::SyntaxErrorUnterminatedLiteral:
-        *result = Inspector::Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral;
+        *result = Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral;
         break;
     case ParserError::SyntaxErrorRecoverable:
-        *result = Inspector::Protocol::Runtime::SyntaxErrorType::Recoverable;
+        *result = Protocol::Runtime::SyntaxErrorType::Recoverable;
         break;
     }
 
     if (error.syntaxErrorType() != ParserError::SyntaxErrorNone) {
-        *message = error.message();
+        message = error.message();
         range = buildErrorRangeObject(error.token().m_location);
     }
 }
 
-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)
+void 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)
 {
     InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId);
     if (injectedScript.hasNoValue())
@@ -124,15 +124,9 @@ void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& exp
     if (asBool(doNotPauseOnExceptionsAndMuteConsole))
         muteConsole();
 
-    // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
-    // <https://www.webkit.org/b/180607>
     bool wasThrown;
-    std::optional<int> savedResultIndex;
     injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), asBool(saveResult), result, wasThrown, savedResultIndex);
-    
-    *out_wasThrown = wasThrown;
-    if (savedResultIndex.has_value())
-        *out_savedResultIndex = savedResultIndex.value();
+    outWasThrown = wasThrown;
 
     if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
         unmuteConsole();
@@ -140,7 +134,7 @@ void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& exp
     }
 }
 
-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)
+void 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)
 {
     InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -162,7 +156,7 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const Strin
 
     injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), asBool(generatePreview), result, wasThrown);
 
-    *out_wasThrown = wasThrown;
+    outWasThrown = wasThrown;
 
     if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
         unmuteConsole();
@@ -170,7 +164,7 @@ void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const Strin
     }
 }
 
-void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& objectId, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& preview)
+void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>& preview)
 {
     InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -187,7 +181,7 @@ void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& o
     setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
 }
 
-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)
+void 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)
 {
     InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -205,7 +199,7 @@ void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String
     setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
 }
 
-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)
+void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)
 {
     InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -223,7 +217,7 @@ void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, c
     setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsState);
 }
 
-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)
+void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries)
 {
     InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId);
     if (injectedScript.hasNoValue()) {
@@ -237,7 +231,7 @@ void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const
     injectedScript.getCollectionEntries(errorString, objectId, objectGroup ? *objectGroup : String(), start, fetch, entries);
 }
 
-void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, Inspector::Protocol::OptOutput<int>* out_savedResultIndex)
+void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex)
 {
     InjectedScript injectedScript;
 
@@ -254,14 +248,7 @@ void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Obj
             return;
     }
     
-    // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.
-    // <https://www.webkit.org/b/180607>
-    std::optional<int> savedResultIndex;
-
     injectedScript.saveResult(errorString, callArgument.toJSONString(), savedResultIndex);
-
-    if (savedResultIndex.has_value())
-        *out_savedResultIndex = savedResultIndex.value();
 }
 
 void InspectorRuntimeAgent::releaseObject(ErrorString&, const String& objectId)
@@ -276,11 +263,11 @@ void InspectorRuntimeAgent::releaseObjectGroup(ErrorString&, const String& objec
     m_injectedScriptManager.releaseObjectGroup(objectGroup);
 }
 
-void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)
+void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>& typeDescriptions)
 {
     static const bool verbose = false;
 
-    typeDescriptions = JSON::ArrayOf<Inspector::Protocol::Runtime::TypeDescription>::create();
+    typeDescriptions = JSON::ArrayOf<Protocol::Runtime::TypeDescription>::create();
     if (!m_vm.typeProfiler()) {
         errorString = ASCIILiteral("The VM does not currently have Type Information.");
         return;
@@ -317,7 +304,7 @@ void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& er
         }
 
         bool isValid = typeLocation && typeSet && !typeSet->isEmpty();
-        auto description = Inspector::Protocol::Runtime::TypeDescription::create()
+        auto description = Protocol::Runtime::TypeDescription::create()
             .setIsValid(isValid)
             .release();
 
@@ -391,7 +378,7 @@ void InspectorRuntimeAgent::setControlFlowProfilerEnabledState(bool isControlFlo
     });
 }
 
-void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks)
+void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& basicBlocks)
 {
     if (!m_vm.controlFlowProfiler()) {
         errorString = ASCIILiteral("The VM does not currently have a Control Flow Profiler.");
@@ -402,9 +389,9 @@ void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const Strin
     intptr_t sourceID = sourceIDAsString.toIntPtrStrict(&okay);
     ASSERT(okay);
     const Vector<BasicBlockRange>& basicBlockRanges = m_vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, m_vm);
-    basicBlocks = JSON::ArrayOf<Inspector::Protocol::Runtime::BasicBlock>::create();
+    basicBlocks = JSON::ArrayOf<Protocol::Runtime::BasicBlock>::create();
     for (const BasicBlockRange& block : basicBlockRanges) {
-        Ref<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()
+        auto location = Protocol::Runtime::BasicBlock::create()
             .setStartOffset(block.m_startOffset)
             .setEndOffset(block.m_endOffset)
             .setHasExecuted(block.m_hasExecuted)
index 2d5d291..29927b1 100644 (file)
@@ -57,22 +57,22 @@ public:
 
     void enable(ErrorString&) override { m_enabled = true; }
     void disable(ErrorString&) override { m_enabled = false; }
-    void parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>&) final;
-    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;
-    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;
+    void parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>&) final;
+    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;
+    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;
     void releaseObject(ErrorString&, const ErrorString& objectId) final;
-    void getPreview(ErrorString&, const String& objectId, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>&) final;
-    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;
-    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;
-    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;
-    void saveResult(ErrorString&, const JSON::Object& callArgument, const int* const executionContextId, Inspector::Protocol::OptOutput<int>* savedResultIndex) final;
+    void getPreview(ErrorString&, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>&) final;
+    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;
+    void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;
+    void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries) final;
+    void saveResult(ErrorString&, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex) final;
     void releaseObjectGroup(ErrorString&, const String& objectGroup) final;
-    void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::TypeDescription>>&) override;
+    void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>&) override;
     void enableTypeProfiler(ErrorString&) override;
     void disableTypeProfiler(ErrorString&) override;
     void enableControlFlowProfiler(ErrorString&) override;
     void disableControlFlowProfiler(ErrorString&) override;
-    void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
+    void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;
 
     bool enabled() const { return m_enabled; }
 
index 5e895ae..597e08e 100644 (file)
@@ -66,7 +66,7 @@ void InspectorScriptProfilerAgent::willDestroyFrontendAndBackend(DisconnectReaso
     }
 }
 
-void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* const includeSamples)
+void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* includeSamples)
 {
     if (m_tracking)
         return;
@@ -135,26 +135,26 @@ void InspectorScriptProfilerAgent::didEvaluateScript(double startTime, Profiling
     addEvent(startTime, endTime, reason);
 }
 
-static Inspector::Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)
+static Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)
 {
     switch (reason) {
     case ProfilingReason::API:
-        return Inspector::Protocol::ScriptProfiler::EventType::API;
+        return Protocol::ScriptProfiler::EventType::API;
     case ProfilingReason::Microtask:
-        return Inspector::Protocol::ScriptProfiler::EventType::Microtask;
+        return Protocol::ScriptProfiler::EventType::Microtask;
     case ProfilingReason::Other:
-        return Inspector::Protocol::ScriptProfiler::EventType::Other;
+        return Protocol::ScriptProfiler::EventType::Other;
     }
 
     ASSERT_NOT_REACHED();
-    return Inspector::Protocol::ScriptProfiler::EventType::Other;
+    return Protocol::ScriptProfiler::EventType::Other;
 }
 
 void InspectorScriptProfilerAgent::addEvent(double startTime, double endTime, ProfilingReason reason)
 {
     ASSERT(endTime >= startTime);
 
-    auto event = Inspector::Protocol::ScriptProfiler::Event::create()
+    auto event = Protocol::ScriptProfiler::Event::create()
         .setStartTime(startTime)
         .setEndTime(endTime)
         .setType(toProtocol(reason))
index c9b8760..2c2fa60 100644 (file)
@@ -50,7 +50,7 @@ public:
     void willDestroyFrontendAndBackend(DisconnectReason) override;
 
     // ScriptProfilerBackendDispatcherHandler
-    void startTracking(ErrorString&, const bool* const includeSamples) override;
+    void startTracking(ErrorString&, const bool* includeSamples) override;
     void stopTracking(ErrorString&) override;
 
     void programmaticCaptureStarted();
index a90c0db..5f2e9c8 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
+# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
 # Copyright (c) 2014 University of Washington. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -142,7 +142,7 @@ class CppGenerator(Generator):
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if parameter.is_optional:
-                return 'const %s* const' % cpp_name
+                return 'const %s*' % cpp_name
             elif _type.raw_name() in ['string']:
                 return 'const %s&' % cpp_name
             else:
@@ -165,7 +165,7 @@ class CppGenerator(Generator):
         if isinstance(_type, AliasedType):
             builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
             if is_optional:
-                return 'const %s* const' % builder_type
+                return 'const %s*' % builder_type
             elif _type.aliased_type.qualified_name() in ['integer', 'number']:
                 return CppGenerator.cpp_name_for_primitive_type(_type.aliased_type)
             elif _type.aliased_type.qualified_name() in ['string']:
@@ -179,7 +179,7 @@ class CppGenerator(Generator):
             elif _type.qualified_name() in ['any']:
                 return 'RefPtr<JSON::Value>'
             elif is_optional:
-                return 'const %s* const' % cpp_name
+                return 'const %s*' % cpp_name
             elif _type.qualified_name() in ['string']:
                 return 'const %s&' % cpp_name
             else:
@@ -207,7 +207,7 @@ class CppGenerator(Generator):
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if parameter.is_optional:
-                return "Inspector::Protocol::OptOutput<%s>*" % cpp_name
+                return "std::optional<%s>&" % cpp_name
             else:
                 return '%s*' % cpp_name
         if isinstance(_type, EnumType):
@@ -233,7 +233,7 @@ class CppGenerator(Generator):
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if parameter.is_optional:
-                return "Inspector::Protocol::OptOutput<%s>*" % cpp_name
+                return "std::optional<%s>&" % cpp_name
             elif _type.qualified_name() in ['integer', 'number']:
                 return CppGenerator.cpp_name_for_primitive_type(_type)
             elif _type.qualified_name() in ['string']:
@@ -265,7 +265,7 @@ class CppGenerator(Generator):
             if _type.qualified_name() in ['any', 'object']:
                 return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type)
             elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer']:
-                return "Inspector::Protocol::OptOutput<%s>" % cpp_name
+                return "std::optional<%s>" % cpp_name
             else:
                 return cpp_name
 
@@ -277,12 +277,12 @@ class CppGenerator(Generator):
         if isinstance(_type, AliasedType):
             builder_type = CppGenerator.cpp_protocol_type_for_type(_type)
             if parameter.is_optional:
-                return "Inspector::Protocol::OptOutput<%s>" % builder_type
+                return "std::optional<%s>" % builder_type
             return '%s' % builder_type
         if isinstance(_type, PrimitiveType):
             cpp_name = CppGenerator.cpp_name_for_primitive_type(_type)
             if parameter.is_optional:
-                return "Inspector::Protocol::OptOutput<%s>" % cpp_name
+                return "std::optional<%s>" % cpp_name
             else:
                 return cpp_name
         if isinstance(_type, EnumType):
index 979332d..6fa1226 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2014, 2015 Apple Inc. All rights reserved.
+# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
 # Copyright (c) 2014 University of Washington. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -128,7 +128,7 @@ private:
 
 ${dispatchCases}
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found");
 }""")
 
     BackendDispatcherImplementationLargeSwitch = (
@@ -156,7 +156,7 @@ ${dispatchCases}
 
     auto findResult = dispatchMap.get().find(method);
     if (findResult == dispatchMap.get().end()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found");
         return;
     }
 
@@ -179,7 +179,7 @@ ${domainName}BackendDispatcher::${domainName}BackendDispatcher(BackendDispatcher
     BackendDispatcherImplementationPrepareCommandArguments = (
 """${inParameterDeclarations}
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method \'%s\' can't be processed", "${domainName}.${commandName}"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method \'${domainName}.${commandName}\' can't be processed" });
         return;
     }
 """)
@@ -249,9 +249,7 @@ ${constructorExample}
     RefPtr<JSON::Object> result;
     bool castSucceeded = value->asObject(result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
-#if !ASSERT_DISABLED
     BindingTraits<${objectType}>::assertValueHasExpectedType(result.get());
-#endif  // !ASSERT_DISABLED
     COMPILE_ASSERT(sizeof(${objectType}) == sizeof(JSON::ObjectBase), type_cast_problem);
     return static_cast<${objectType}*>(static_cast<JSON::ObjectBase*>(result.get()));
 }
index d17ce01..be6f45a 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2014-2016 Apple Inc. All rights reserved.
+# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
 # Copyright (c) 2014 University of Washington. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -163,8 +163,8 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
 
             if parameter.is_optional:
                 if CppGenerator.should_use_wrapper_for_return_type(parameter.type):
-                    out_parameter_assignments.append('    if (%(parameterName)s.isAssigned())' % param_args)
-                    out_parameter_assignments.append('        jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s.getValue());' % param_args)
+                    out_parameter_assignments.append('    if (%(parameterName)s.has_value())' % param_args)
+                    out_parameter_assignments.append('        jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), *%(parameterName)s);' % param_args)
                 else:
                     out_parameter_assignments.append('    if (%(parameterName)s)' % param_args)
                     out_parameter_assignments.append('        jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
@@ -256,8 +256,8 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
                 out_parameter_declarations.append('    %(parameterType)s out_%(parameterName)s;' % param_args)
                 if parameter.is_optional:
                     if CppGenerator.should_use_wrapper_for_return_type(parameter.type):
-                        out_parameter_assignments.append('        if (out_%(parameterName)s.isAssigned())' % param_args)
-                        out_parameter_assignments.append('            result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s.getValue());' % param_args)
+                        out_parameter_assignments.append('        if (out_%(parameterName)s.has_value())' % param_args)
+                        out_parameter_assignments.append('            result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), *out_%(parameterName)s);' % param_args)
                     else:
                         out_parameter_assignments.append('        if (out_%(parameterName)s)' % param_args)
                         out_parameter_assignments.append('            result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
@@ -266,7 +266,7 @@ class CppBackendDispatcherImplementationGenerator(CppGenerator):
                 else:
                     out_parameter_assignments.append('        result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
 
-                if CppGenerator.should_pass_by_copy_for_return_type(parameter.type):
+                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):
                     method_parameters.append('out_' + parameter.parameter_name)
                 else:
                     method_parameters.append('&out_' + parameter.parameter_name)
index 2a154e0..938e2ee 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
+# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
 # Copyright (c) 2014 University of Washington. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -365,9 +365,7 @@ class CppProtocolTypesHeaderGenerator(CppGenerator):
             lines.append('template<> %s BindingTraits<%s> {' % (' '.join(struct_keywords), argument[0]))
             if argument[1]:
                 lines.append('static RefPtr<%s> runtimeCast(RefPtr<JSON::Value>&& value);' % argument[0])
-            lines.append('#if !ASSERT_DISABLED')
             lines.append('%s assertValueHasExpectedType(JSON::Value*);' % ' '.join(function_keywords))
-            lines.append('#endif // !ASSERT_DISABLED')
             lines.append('};')
         return '\n'.join(lines)
 
index 2eb0762..f7a932e 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2014, 2016 Apple Inc. All rights reserved.
+# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
 # Copyright (c) 2014 University of Washington. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -205,9 +205,11 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
         should_count_properties = not Generator.type_has_open_fields(object_declaration.type)
         lines = []
 
-        lines.append('#if !ASSERT_DISABLED')
         lines.append('void BindingTraits<%s>::assertValueHasExpectedType(JSON::Value* value)' % (CppGenerator.cpp_protocol_type_for_type(object_declaration.type)))
         lines.append("""{
+#if ASSERT_DISABLED
+    UNUSED_PARAM(value);
+#else
     ASSERT_ARG(value, value);
     RefPtr<JSON::Object> object;
     bool castSucceeded = value->asObject(object);
@@ -219,7 +221,7 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
             }
 
             lines.append("""    {
-        JSON::Object::iterator %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
+        auto %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
         ASSERT(%(memberName)sPos != object->end());
         %(assertMethod)s(%(memberName)sPos->value.get());
     }""" % args)
@@ -235,7 +237,7 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
             }
 
             lines.append("""    {
-        JSON::Object::iterator %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
+        auto %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));
         if (%(memberName)sPos != object->end()) {
             %(assertMethod)s(%(memberName)sPos->value.get());""" % args)
 
@@ -247,15 +249,17 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
         if should_count_properties:
             lines.append('    if (foundPropertiesCount != object->size())')
             lines.append('        FATAL("Unexpected properties in object: %s\\n", object->toJSONString().ascii().data());')
-        lines.append('}')
         lines.append('#endif // !ASSERT_DISABLED')
+        lines.append('}')
         return '\n'.join(lines)
 
     def _generate_assertion_for_enum(self, enum_member, object_declaration):
         lines = []
-        lines.append('#if !ASSERT_DISABLED')
         lines.append('void %s(JSON::Value* value)' % CppGenerator.cpp_assertion_method_for_type_member(enum_member, object_declaration))
         lines.append('{')
+        lines.append('#if ASSERT_DISABLED')
+        lines.append('    UNUSED_PARAM(value);')
+        lines.append('#else')
         lines.append('    ASSERT_ARG(value, value);')
         lines.append('    String result;')
         lines.append('    bool castSucceeded = value->asString(result);')
@@ -263,7 +267,7 @@ class CppProtocolTypesImplementationGenerator(CppGenerator):
 
         assert_condition = ' || '.join(['result == "%s"' % enum_value for enum_value in enum_member.type.enum_values()])
         lines.append('    ASSERT(%s);' % assert_condition)
-        lines.append('}')
         lines.append('#endif // !ASSERT_DISABLED')
+        lines.append('}')
 
         return '\n'.join(lines)
index a164c02..2a24718 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 #
-# Copyright (c) 2014-2016 Apple Inc. All rights reserved.
+# Copyright (c) 2014-2018 Apple Inc. All rights reserved.
 # Copyright (c) 2014 University of Washington. All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -177,7 +177,7 @@ class ObjCBackendDispatcherImplementationGenerator(ObjCGenerator):
 
                 if isinstance(parameter.type, EnumType):
                     lines.append('    if (!%s) {' % objc_in_param_name)
-                    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))
+                    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))
                     lines.append('        return;')
                     lines.append('    }')
 
index 1311ccb..9a63823 100644 (file)
@@ -238,7 +238,7 @@ void NetworkBackendDispatcher::dispatch(long requestId, const String& method, Re
     if (method == "loadResource")
         loadResource(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found");
 }
 
 void NetworkBackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>&&)
index cf60350..40f3908 100644 (file)
@@ -157,11 +157,11 @@ public:
         Yellow = 5,
         Black = 6,
     }; // enum class PrintColor
-    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;
+    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;
     class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase {
     public:
         ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&&, int id);
-        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);
+        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);
     };
     virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0;
     virtual void executeSQLSync(ErrorString&, int in_databaseId, const String& in_query, 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, RefPtr<Inspector::Protocol::Database::ColorList>& out_alternateColors, Inspector::Protocol::Database::PrimaryColors* out_screenColor, DatabaseBackendDispatcherHandler::PrintColor* out_printColor) = 0;
@@ -273,7 +273,7 @@ void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, R
     else if (method == "executeSQLAsync")
         executeSQLAsync(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
 }
 
 void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestId, RefPtr<JSON::Object>&& parameters)
@@ -281,7 +281,7 @@ void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestI
     int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
     String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLSyncOptionalReturnValues' can't be processed" });
         return;
     }
 
@@ -295,38 +295,38 @@ void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestI
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
     RefPtr<JSON::ArrayOf<String>> out_columnNames;
-    Inspector::Protocol::OptOutput<String> out_notes;
-    Inspector::Protocol::OptOutput<double> out_timestamp;
-    Inspector::Protocol::OptOutput<JSON::Object> out_values;
-    Inspector::Protocol::OptOutput<JSON::Value> out_payload;
-    Inspector::Protocol::OptOutput<int> out_databaseId;
+    std::optional<String> out_notes;
+    std::optional<double> out_timestamp;
+    std::optional<JSON::Object> out_values;
+    std::optional<JSON::Value> out_payload;
+    std::optional<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;
-    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);
+    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);
 
     if (!error.length()) {
         if (out_columnNames)
             result->setArray(ASCIILiteral("columnNames"), out_columnNames);
-        if (out_notes.isAssigned())
-            result->setString(ASCIILiteral("notes"), out_notes.getValue());
-        if (out_timestamp.isAssigned())
-            result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
-        if (out_values.isAssigned())
-            result->setObject(ASCIILiteral("values"), out_values.getValue());
-        if (out_payload.isAssigned())
-            result->setValue(ASCIILiteral("payload"), out_payload.getValue());
-        if (out_databaseId.isAssigned())
-            result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
+        if (out_notes.has_value())
+            result->setString(ASCIILiteral("notes"), *out_notes);
+        if (out_timestamp.has_value())
+            result->setDouble(ASCIILiteral("timestamp"), *out_timestamp);
+        if (out_values.has_value())
+            result->setObject(ASCIILiteral("values"), *out_values);
+        if (out_payload.has_value())
+            result->setValue(ASCIILiteral("payload"), *out_payload);
+        if (out_databaseId.has_value())
+            result->setInteger(ASCIILiteral("databaseId"), *out_databaseId);
         if (out_sqlError)
             result->setObject(ASCIILiteral("sqlError"), out_sqlError);
-        if (out_screenColor.isAssigned())
-            result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());
+        if (out_screenColor.has_value())
+            result->setString(ASCIILiteral("screenColor"), *out_screenColor);
         if (out_alternateColors)
             result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
-        if (out_printColor.isAssigned())
-            result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
+        if (out_printColor.has_value())
+            result->setString(ASCIILiteral("printColor"), *out_printColor);
     }
     if (!error.length())
         m_backendDispatcher->sendResponse(requestId, WTFMove(result), false);
@@ -336,29 +336,29 @@ void DatabaseBackendDispatcher::executeSQLSyncOptionalReturnValues(long requestI
 
 DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { }
 
-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)
+void 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)
 {
     Ref<JSON::Object> jsonMessage = JSON::Object::create();
     if (columnNames)
         jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames);
-    if (notes.isAssigned())
-        jsonMessage->setString(ASCIILiteral("notes"), notes.getValue());
-    if (timestamp.isAssigned())
-        jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue());
-    if (values.isAssigned())
-        jsonMessage->setObject(ASCIILiteral("values"), values.getValue());
-    if (payload.isAssigned())
-        jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue());
-    if (databaseId.isAssigned())
-        jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue());
+    if (notes.has_value())
+        jsonMessage->setString(ASCIILiteral("notes"), *notes);
+    if (timestamp.has_value())
+        jsonMessage->setDouble(ASCIILiteral("timestamp"), *timestamp);
+    if (values.has_value())
+        jsonMessage->setObject(ASCIILiteral("values"), *values);
+    if (payload.has_value())
+        jsonMessage->setValue(ASCIILiteral("payload"), *payload);
+    if (databaseId.has_value())
+        jsonMessage->setInteger(ASCIILiteral("databaseId"), *databaseId);
     if (sqlError)
         jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
-    if (screenColor.isAssigned())
-        jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue());
+    if (screenColor.has_value())
+        jsonMessage->setString(ASCIILiteral("screenColor"), *screenColor);
     if (alternateColors)
         jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors);
-    if (printColor.isAssigned())
-        jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue());
+    if (printColor.has_value())
+        jsonMessage->setString(ASCIILiteral("printColor"), *printColor);
     CallbackBase::sendSuccess(WTFMove(jsonMessage));
 }
 
@@ -367,7 +367,7 @@ void DatabaseBackendDispatcher::executeSQLAsyncOptionalReturnValues(long request
     int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
     String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLAsyncOptionalReturnValues' can't be processed" });
         return;
     }
 
@@ -395,7 +395,7 @@ void DatabaseBackendDispatcher::executeSQLSync(long requestId, RefPtr<JSON::Obje
     int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
     String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLSync' can't be processed" });
         return;
     }
 
@@ -461,7 +461,7 @@ void DatabaseBackendDispatcher::executeSQLAsync(long requestId, RefPtr<JSON::Obj
     int in_databaseId = m_backendDispatcher->getInteger(parameters.get(), ASCIILiteral("databaseId"), nullptr);
     String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr);
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLAsync' can't be processed" });
         return;
     }
 
index 2e75838..9c64f28 100644 (file)
@@ -89,7 +89,7 @@ private:
 class AlternateDatabaseBackendDispatcher : public AlternateBackendDispatcher {
 public:
     virtual ~AlternateDatabaseBackendDispatcher() { }
-    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;
+    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;
     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;
 };
 
@@ -152,7 +152,7 @@ public:
         Yellow = 5,
         Black = 6,
     }; // enum class PrintColor
-    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;
+    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;
     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;
 protected:
     virtual ~DatabaseBackendDispatcherHandler();
@@ -250,7 +250,7 @@ void DatabaseBackendDispatcher::dispatch(long requestId, const String& method, R
     else if (method == "executeNoOptionalParameters")
         executeNoOptionalParameters(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found");
 }
 
 void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, RefPtr<JSON::Object>&& parameters)
@@ -260,7 +260,7 @@ void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, Ref
     bool opt_in_notes_valueFound = false;
     String opt_in_notes = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("notes"), &opt_in_notes_valueFound);
     bool opt_in_timestamp_valueFound = false;
-    Inspector::Protocol::OptOutput<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound);
+    std::optional<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound);
     bool opt_in_values_valueFound = false;
     RefPtr<JSON::Object> opt_in_values = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("values"), &opt_in_values_valueFound);
     bool opt_in_payload_valueFound = false;
@@ -276,7 +276,7 @@ void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, Ref
     bool opt_in_printColor_valueFound = false;
     String opt_in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), &opt_in_printColor_valueFound);
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeAllOptionalParameters"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeAllOptionalParameters' can't be processed" });
         return;
     }
 
@@ -290,38 +290,38 @@ void DatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, Ref
     ErrorString error;
     Ref<JSON::Object> result = JSON::Object::create();
     RefPtr<JSON::ArrayOf<String>> out_columnNames;
-    Inspector::Protocol::OptOutput<String> out_notes;
-    Inspector::Protocol::OptOutput<double> out_timestamp;
-    Inspector::Protocol::OptOutput<JSON::Object> out_values;
-    Inspector::Protocol::OptOutput<JSON::Value> out_payload;
-    Inspector::Protocol::OptOutput<int> out_databaseId;
+    std::optional<String> out_notes;
+    std::optional<double> out_timestamp;
+    std::optional<JSON::Object> out_values;
+    std::optional<JSON::Value> out_payload;
+    std::optional<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;
-    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);
+    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);
 
     if (!error.length()) {
         if (out_columnNames)
             result->setArray(ASCIILiteral("columnNames"), out_columnNames);
-        if (out_notes.isAssigned())
-            result->setString(ASCIILiteral("notes"), out_notes.getValue());
-        if (out_timestamp.isAssigned())
-            result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());
-        if (out_values.isAssigned())
-            result->setObject(ASCIILiteral("values"), out_values.getValue());
-        if (out_payload.isAssigned())
-            result->setValue(ASCIILiteral("payload"), out_payload.getValue());
-        if (out_databaseId.isAssigned())
-            result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());
+        if (out_notes.has_value())
+            result->setString(ASCIILiteral("notes"), *out_notes);
+        if (out_timestamp.has_value())
+            result->setDouble(ASCIILiteral("timestamp"), *out_timestamp);
+        if (out_values.has_value())
+            result->setObject(ASCIILiteral("values"), *out_values);
+        if (out_payload.has_value())
+            result->setValue(ASCIILiteral("payload"), *out_payload);
+        if (out_databaseId.has_value())
+            result->setInteger(ASCIILiteral("databaseId"), *out_databaseId);
         if (out_sqlError)
             result->setObject(ASCIILiteral("sqlError"), out_sqlError);
-        if (out_screenColor.isAssigned())
-            result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());
+        if (out_screenColor.has_value())
+            result->setString(ASCIILiteral("screenColor"), *out_screenColor);
         if (out_alternateColors)
             result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
-        if (out_printColor.isAssigned())
-            result->setString(ASCIILiteral("printColor"), out_printColor.getValue());
+        if (out_printColor.has_value())
+            result->setString(ASCIILiteral("printColor"), *out_printColor);
     }
     if (!error.length())
         m_backendDispatcher->sendResponse(requestId, WTFMove(result), false);
@@ -342,7 +342,7 @@ void DatabaseBackendDispatcher::executeNoOptionalParameters(long requestId, RefP
     RefPtr<JSON::Array> in_alternateColors = m_backendDispatcher->getArray(parameters.get(), ASCIILiteral("alternateColors"), nullptr);
     String in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), nullptr);
     if (m_backendDispatcher->hasProtocolErrors()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeNoOptionalParameters"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeNoOptionalParameters' can't be processed" });
         return;
     }
 
@@ -763,7 +763,7 @@ namespace Inspector {
 class ObjCInspectorDatabaseBackendDispatcher final : public AlternateDatabaseBackendDispatcher {
 public:
     ObjCInspectorDatabaseBackendDispatcher(id<TestProtocolDatabaseDomainHandler> handler) { m_delegate = handler; }
-    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;
+    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;
     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;
 private:
     RetainPtr<id<TestProtocolDatabaseDomainHandler>> m_delegate;
@@ -813,7 +813,7 @@ private:
 
 namespace Inspector {
 
-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)
+void 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)
 {
     id errorCallback = ^(NSString *error) {
         backendDispatcher()->reportProtocolError(requestId, BackendDispatcher::ServerError, error);
@@ -922,13 +922,13 @@ void ObjCInspectorDatabaseBackendDispatcher::executeNoOptionalParameters(long re
     TestProtocolDatabaseError *o_in_sqlError = [[[TestProtocolDatabaseError alloc] initWithJSONObject:&in_sqlError] autorelease];
     std::optional<TestProtocolDatabasePrimaryColors> o_in_screenColor = fromProtocolString<TestProtocolDatabasePrimaryColors>(in_screenColor);
     if (!o_in_screenColor) {
-        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' of method '%s' cannot be processed", "screenColor", "Database.executeNoOptionalParameters"));
+        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter 'screenColor' of method 'Database.executeNoOptionalParameters' cannot be processed" });
         return;
     }
     NSArray/*<NSString>*/ *o_in_alternateColors = toObjCStringArray(&in_alternateColors);
     std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> o_in_printColor = fromProtocolString<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor);
     if (!o_in_printColor) {
-        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' of method '%s' cannot be processed", "printColor", "Database.executeNoOptionalParameters"));
+        backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter 'printColor' of method 'Database.executeNoOptionalParameters' cannot be processed" });
         return;
     }
 
index 8f39d92..8a824fc 100644 (file)
@@ -271,7 +271,7 @@ void DomainABackendDispatcher::dispatch(long requestId, const String& method, Re
     if (method == "enable")
         enable(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainA", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainA." + method + "' was not found");
 }
 
 void DomainABackendDispatcher::enable(long requestId, RefPtr<JSON::Object>&&)
@@ -315,7 +315,7 @@ void DomainBBackendDispatcher::dispatch(long requestId, const String& method, Re
     if (method == "enable")
         enable(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainB", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainB." + method + "' was not found");
 }
 
 void DomainBBackendDispatcher::enable(long requestId, RefPtr<JSON::Object>&&)
index 58674d9..349c903 100644 (file)
@@ -295,7 +295,7 @@ void Network1BackendDispatcher::dispatch(long requestId, const String& method, R
     if (method == "loadResource1")
         loadResource1(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network1." + method + "' was not found");
 }
 
 void Network1BackendDispatcher::loadResource1(long requestId, RefPtr<JSON::Object>&&)
@@ -359,7 +359,7 @@ void Network3BackendDispatcher::dispatch(long requestId, const String& method, R
 
     auto findResult = dispatchMap.get().find(method);
     if (findResult == dispatchMap.get().end()) {
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network3", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network3." + method + "' was not found");
         return;
     }
 
index d054b82..2aedb73 100644 (file)
@@ -253,7 +253,7 @@ void CommandDomainBackendDispatcher::dispatch(long requestId, const String& meth
     if (method == "commandWithEnumReturnValue")
         commandWithEnumReturnValue(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'CommandDomain." + method + "' was not found");
 }
 
 void CommandDomainBackendDispatcher::commandWithEnumReturnValue(long requestId, RefPtr<JSON::Object>&&)
index 1d9966a..478637c 100644 (file)
@@ -234,7 +234,7 @@ class FrontendRouter;
 class DatabaseFrontendDispatcher {
 public:
     DatabaseFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { }
-    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);
+    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);
     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);
 private:
     FrontendRouter& m_frontendRouter;
@@ -282,7 +282,7 @@ private:
 
 namespace Inspector {
 
-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)
+void 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)
 {
     Ref<JSON::Object> jsonMessage = JSON::Object::create();
     jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("Database.didExecuteOptionalParameters"));
index 2355330..e437233 100644 (file)
@@ -252,7 +252,7 @@ void Network1BackendDispatcher::dispatch(long requestId, const String& method, R
     if (method == "loadResource")
         loadResource(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network1." + method + "' was not found");
 }
 
 void Network1BackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>&&)
index 2d03157..9de8511 100644 (file)
@@ -559,25 +559,17 @@ public:
 } // Test
 
 template<> struct BindingTraits<Inspector::Protocol::Test::CastedAnimals> {
-#if !ASSERT_DISABLED
 static void assertValueHasExpectedType(JSON::Value*);
-#endif // !ASSERT_DISABLED
 };
 template<> struct BindingTraits<Inspector::Protocol::Test::TypeNeedingCast> {
 static RefPtr<Inspector::Protocol::Test::TypeNeedingCast> runtimeCast(RefPtr<JSON::Value>&& value);
-#if !ASSERT_DISABLED
 static void assertValueHasExpectedType(JSON::Value*);
-#endif // !ASSERT_DISABLED
 };
 template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject1> {
-#if !ASSERT_DISABLED
 static void assertValueHasExpectedType(JSON::Value*);
-#endif // !ASSERT_DISABLED
 };
 template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject2> {
-#if !ASSERT_DISABLED
 static void assertValueHasExpectedType(JSON::Value*);
-#endif // !ASSERT_DISABLED
 };
 
 namespace TestHelpers {
@@ -693,46 +685,50 @@ std::optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString
 
 
 
-#if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(JSON::Value* value)
 {
+#if ASSERT_DISABLED
+    UNUSED_PARAM(value);
+#else
     ASSERT_ARG(value, value);
     String result;
     bool castSucceeded = value->asString(result);
     ASSERT(castSucceeded);
     ASSERT(result == "Ducks" || result == "Hens" || result == "Crows" || result == "Flamingos");
-}
 #endif // !ASSERT_DISABLED
+}
 
-#if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(JSON::Value* value)
 {
+#if ASSERT_DISABLED
+    UNUSED_PARAM(value);
+#else
     ASSERT_ARG(value, value);
     RefPtr<JSON::Object> object;
     bool castSucceeded = value->asObject(object);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
     {
-        JSON::Object::iterator stringPos = object->find(ASCIILiteral("string"));
+        auto stringPos = object->find(ASCIILiteral("string"));
         ASSERT(stringPos != object->end());
         BindingTraits<String>::assertValueHasExpectedType(stringPos->value.get());
     }
     {
-        JSON::Object::iterator numberPos = object->find(ASCIILiteral("number"));
+        auto numberPos = object->find(ASCIILiteral("number"));
         ASSERT(numberPos != object->end());
         BindingTraits<int>::assertValueHasExpectedType(numberPos->value.get());
     }
     {
-        JSON::Object::iterator animalsPos = object->find(ASCIILiteral("animals"));
+        auto animalsPos = object->find(ASCIILiteral("animals"));
         ASSERT(animalsPos != object->end());
         BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(animalsPos->value.get());
     }
     {
-        JSON::Object::iterator idPos = object->find(ASCIILiteral("id"));
+        auto idPos = object->find(ASCIILiteral("id"));
         ASSERT(idPos != object->end());
         BindingTraits<int>::assertValueHasExpectedType(idPos->value.get());
     }
     {
-        JSON::Object::iterator treePos = object->find(ASCIILiteral("tree"));
+        auto treePos = object->find(ASCIILiteral("tree"));
         ASSERT(treePos != object->end());
         BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(treePos->value.get());
     }
@@ -740,25 +736,25 @@ void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasEx
     int foundPropertiesCount = 5;
     if (foundPropertiesCount != object->size())
         FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
-}
 #endif // !ASSERT_DISABLED
+}
 
 RefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::runtimeCast(RefPtr<JSON::Value>&& value)
 {
     RefPtr<JSON::Object> result;
     bool castSucceeded = value->asObject(result);
     ASSERT_UNUSED(castSucceeded, castSucceeded);
-#if !ASSERT_DISABLED
     BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(result.get());
-#endif  // !ASSERT_DISABLED
     COMPILE_ASSERT(sizeof(Inspector::Protocol::Test::TypeNeedingCast) == sizeof(JSON::ObjectBase), type_cast_problem);
     return static_cast<Inspector::Protocol::Test::TypeNeedingCast*>(static_cast<JSON::ObjectBase*>(result.get()));
 }
 
 
-#if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(JSON::Value* value)
 {
+#if ASSERT_DISABLED
+    UNUSED_PARAM(value);
+#else
     ASSERT_ARG(value, value);
     RefPtr<JSON::Object> object;
     bool castSucceeded = value->asObject(object);
@@ -766,7 +762,7 @@ void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasE
 
     int foundPropertiesCount = 0;
     {
-        JSON::Object::iterator objPos = object->find(ASCIILiteral("obj"));
+        auto objPos = object->find(ASCIILiteral("obj"));
         if (objPos != object->end()) {
             BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(objPos->value.get());
             ++foundPropertiesCount;
@@ -774,12 +770,14 @@ void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasE
     }
     if (foundPropertiesCount != object->size())
         FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
-}
 #endif // !ASSERT_DISABLED
+}
 
-#if !ASSERT_DISABLED
 void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(JSON::Value* value)
 {
+#if ASSERT_DISABLED
+    UNUSED_PARAM(value);
+#else
     ASSERT_ARG(value, value);
     RefPtr<JSON::Object> object;
     bool castSucceeded = value->asObject(object);
@@ -787,7 +785,7 @@ void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasE
 
     int foundPropertiesCount = 0;
     {
-        JSON::Object::iterator objPos = object->find(ASCIILiteral("obj"));
+        auto objPos = object->find(ASCIILiteral("obj"));
         if (objPos != object->end()) {
             BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(objPos->value.get());
             ++foundPropertiesCount;
@@ -795,8 +793,8 @@ void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasE
     }
     if (foundPropertiesCount != object->size())
         FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data());
-}
 #endif // !ASSERT_DISABLED
+}
 
 } // namespace Protocol
 
index 64879c3..071b870 100644 (file)
@@ -272,7 +272,7 @@ void DomainABackendDispatcher::dispatch(long requestId, const String& method, Re
     if (method == "enable")
         enable(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainA", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainA." + method + "' was not found");
 }
 
 void DomainABackendDispatcher::enable(long requestId, RefPtr<JSON::Object>&&)
@@ -316,7 +316,7 @@ void DomainBBackendDispatcher::dispatch(long requestId, const String& method, Re
     if (method == "enable")
         enable(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainB", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainB." + method + "' was not found");
 }
 
 void DomainBBackendDispatcher::enable(long requestId, RefPtr<JSON::Object>&&)
index 1311ccb..9a63823 100644 (file)
@@ -238,7 +238,7 @@ void NetworkBackendDispatcher::dispatch(long requestId, const String& method, Re
     if (method == "loadResource")
         loadResource(requestId, WTFMove(parameters));
     else
-        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network", '.', method, "' was not found"));
+        m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found");
 }
 
 void NetworkBackendDispatcher::loadResource(long requestId, RefPtr<JSON::Object>&&)
index 55ff678..31ac184 100644 (file)
@@ -1,3 +1,39 @@
+2018-02-15  Darin Adler  <darin@apple.com>
+
+        Web Inspector: get rid of remaining uses of OptOutput<T>
+        https://bugs.webkit.org/show_bug.cgi?id=180607
+
+        Reviewed by Brian Burg.
+
+        * 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.
+
 2018-02-15  Chris Dumez  <cdumez@apple.com>
 
         Flaky Test: imported/w3c/web-platform-tests/fetch/api/redirect/redirect-to-dataurl-worker.html
index 8eb4c62..9d98581 100644 (file)
@@ -385,12 +385,13 @@ enum MediaListSource {
     MediaListSourceImportRule
 };
 
-static RefPtr<Inspector::Protocol::CSS::SourceRange> buildSourceRangeObject(const SourceRange& range, Vector<size_t>* lineEndings, int* endingLine = nullptr)
+static RefPtr<Inspector::Protocol::CSS::SourceRange> buildSourceRangeObject(const SourceRange& range, const Vector<size_t>& lineEndings, int* endingLine = nullptr)
 {
-    if (!lineEndings)
+    if (lineEndings.isEmpty())
         return nullptr;
-    TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, *lineEndings);
-    TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, *lineEndings);
+
+    TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, lineEndings);
+    TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, lineEndings);
 
     if (endingLine)
         *endingLine = end.m_line.zeroBasedInt();
@@ -543,7 +544,7 @@ RefPtr<Inspector::Protocol::CSS::CSSStyle> InspectorStyle::buildObjectForStyle()
 
     RefPtr<CSSRuleSourceData> sourceData = extractSourceData();
     if (sourceData)
-        result->setRange(buildSourceRangeObject(sourceData->ruleBodyRange, m_parentStyleSheet->lineEndings().get()));
+        result->setRange(buildSourceRangeObject(sourceData->ruleBodyRange, m_parentStyleSheet->lineEndings()));
 
     return WTFMove(result);
 }
@@ -625,7 +626,7 @@ Ref<Inspector::Protocol::CSS::CSSStyle> InspectorStyle::styleWithProperties() co
     HashSet<String> foundShorthands;
     String previousPriority;
     String previousStatus;
-    std::unique_ptr<Vector<size_t>> lineEndings(m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : nullptr);
+    Vector<size_t> lineEndings = m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : Vector<size_t> { };
     auto sourceData = extractSourceData();
     unsigned ruleBodyRangeStart = sourceData ? sourceData->ruleBodyRange.start : 0;
 
@@ -667,7 +668,7 @@ Ref<Inspector::Protocol::CSS::CSSStyle> InspectorStyle::styleWithProperties() co
             SourceRange absolutePropertyRange = propertyEntry.range;
             absolutePropertyRange.start += ruleBodyRangeStart;
             absolutePropertyRange.end += ruleBodyRangeStart;
-            property->setRange(buildSourceRangeObject(absolutePropertyRange, lineEndings.get()));
+            property->setRange(buildSourceRangeObject(absolutePropertyRange, lineEndings));
         }
 
         if (!it->disabled) {
@@ -1149,7 +1150,7 @@ Ref<Inspector::Protocol::CSS::SelectorList> InspectorStyleSheet::buildObjectForS
         .setText(selectorText)
         .release();
     if (sourceData)
-        result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings().get(), &endingLine));
+        result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings(), &endingLine));
     return result;
 }
 
@@ -1282,10 +1283,10 @@ RefPtr<CSSRuleSourceData> InspectorStyleSheet::ruleSourceDataFor(CSSStyleDeclara
     return m_parsedStyleSheet->ruleSourceDataAt(ruleIndexByStyle(style));
 }
 
-std::unique_ptr<Vector<size_t>> InspectorStyleSheet::lineEndings() const
+Vector<size_t> InspectorStyleSheet::lineEndings() const
 {
     if (!m_parsedStyleSheet->hasText())
-        return nullptr;
+        return { };
     return ContentSearchUtilities::lineEndings(m_parsedStyleSheet->text());
 }
 
@@ -1524,7 +1525,7 @@ ExceptionOr<void> InspectorStyleSheetForInlineStyle::setStyleText(CSSStyleDeclar
     return { };
 }
 
-std::unique_ptr<Vector<size_t>> InspectorStyleSheetForInlineStyle::lineEndings() const
+Vector<size_t> InspectorStyleSheetForInlineStyle::lineEndings() const
 {
     return ContentSearchUtilities::lineEndings(elementStyleText());
 }
index e019efa..32cec9e 100644 (file)
@@ -198,7 +198,7 @@ protected:
 
     // Also accessed by friend class InspectorStyle.
     virtual ExceptionOr<void> setStyleText(CSSStyleDeclaration*, const String&);
-    virtual std::unique_ptr<Vector<size_t>> lineEndings() const;
+    virtual Vector<size_t> lineEndings() const;
 
 private:
     typedef Vector<RefPtr<CSSStyleRule>> CSSStyleRuleVector;
@@ -246,7 +246,7 @@ protected:
 
     // Also accessed by friend class InspectorStyle.
     ExceptionOr<void> setStyleText(CSSStyleDeclaration*, const String&) final;
-    std::unique_ptr<Vector<size_t>> lineEndings() const final;
+    Vector<size_t> lineEndings() const final;
 
 private:
     CSSStyleDeclaration& inlineStyle() const;
index 80daf7a..35494fe 100644 (file)
@@ -99,7 +99,7 @@ public:
 
     void getComputedStyleForNode(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSComputedStyleProperty>>&) override;
     void getInlineStylesForNode(ErrorString&, int nodeId, RefPtr<Inspector::Protocol::CSS::CSSStyle>& inlineStyle, RefPtr<Inspector::Protocol::CSS::CSSStyle>& attributes) override;
-    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;
+    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;
     void getAllStyleSheets(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSStyleSheetHeader>>& styleSheetInfos) override;
     void getStyleSheet(ErrorString&, const String& styleSheetId, RefPtr<Inspector::Protocol::CSS::CSSStyleSheetBody>& result) override;
     void getStyleSheetText(ErrorString&, const String& styleSheetId, String* result) override;
index bc3efc6..83c545e 100644 (file)
@@ -241,7 +241,7 @@ static JSC::JSValue contextAsScriptValue(JSC::ExecState& state, CanvasRenderingC
     return { };
 }
 
-void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const String& canvasId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
+void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
 {
     auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId);
     if (!inspectorCanvas)
@@ -262,7 +262,7 @@ void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const
     result = injectedScript.wrapObject(value, objectGroupName);
 }
 
-void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit)
+void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* singleFrame, const int* memoryLimit)
 {
     auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId);
     if (!inspectorCanvas)
index f5e3230..775d2d6 100644 (file)
@@ -72,8 +72,8 @@ public:
     void requestNode(ErrorString&, const String& canvasId, int* nodeId) override;
     void requestContent(ErrorString&, const String& canvasId, String* content) override;
     void requestCSSCanvasClientNodes(ErrorString&, const String& canvasId, RefPtr<JSON::ArrayOf<int>>&) override;
-    void resolveCanvasContext(ErrorString&, const String& canvasId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override;
-    void startRecording(ErrorString&, const String& canvasId, const bool* const singleFrame, const int* const memoryLimit) override;
+    void resolveCanvasContext(ErrorString&, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override;
+    void startRecording(ErrorString&, const String& canvasId, const bool* singleFrame, const int* memoryLimit) override;
     void stopRecording(ErrorString&, const String& canvasId) override;
     void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String*) override;
     void updateShader(ErrorString&, const String& programId, const String& shaderType, const String& source) override;
index 03a8c3c..9e8b70b 100644 (file)
 namespace {
 
 enum DOMBreakpointType {
-    SubtreeModified = 0,
+    SubtreeModified,
     AttributeModified,
     NodeRemoved,
     DOMBreakpointTypesCount
 };
 
-static const char* const listenerEventCategoryType = "listener:";
-static const char* const instrumentationEventCategoryType = "instrumentation:";
+static const char listenerEventCategoryType[] = "listener:";
+static const char instrumentationEventCategoryType[] = "instrumentation:";
 
 const uint32_t inheritableDOMBreakpointTypesMask = (1 << SubtreeModified);
 const int domBreakpointDerivedTypeShift = 16;
@@ -122,12 +122,12 @@ void InspectorDOMDebuggerAgent::discardBindings()
 
 void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString& error, const String& eventName)
 {
-    setBreakpoint(error, String(listenerEventCategoryType) + eventName);
+    setBreakpoint(error, listenerEventCategoryType + eventName);
 }
 
 void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString& error, const String& eventName)
 {
-    setBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
+    setBreakpoint(error, instrumentationEventCategoryType + eventName);
 }
 
 void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString& error, const String& eventName)
@@ -142,12 +142,12 @@ void InspectorDOMDebuggerAgent::setBreakpoint(ErrorString& error, const String&
 
 void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString& error, const String& eventName)
 {
-    removeBreakpoint(error, String(listenerEventCategoryType) + eventName);
+    removeBreakpoint(error, listenerEventCategoryType + eventName);
 }
 
 void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString& error, const String& eventName)
 {
-    removeBreakpoint(error, String(instrumentationEventCategoryType) + eventName);
+    removeBreakpoint(error, instrumentationEventCategoryType + eventName);
 }
 
 void InspectorDOMDebuggerAgent::removeBreakpoint(ErrorString& error, const String& eventName)
@@ -375,7 +375,7 @@ void InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded(bool isDOMEvent, cons
         m_debuggerAgent->schedulePauseOnNextStatement(Inspector::DebuggerFrontendDispatcher::Reason::EventListener, WTFMove(eventData));
 }
 
-void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* const optionalIsRegex)
+void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex)
 {
     if (url.isEmpty()) {
         m_pauseOnAllXHRsEnabled = true;
index bfe01be..39acf5a 100644 (file)
@@ -54,14 +54,14 @@ public:
     virtual ~InspectorDOMDebuggerAgent();
 
     // DOMDebugger API
-    void setXHRBreakpoint(ErrorString&, const String& url, const bool* const optionalIsRegex) override;
-    void removeXHRBreakpoint(ErrorString&, const String& url) override;
-    void setEventListenerBreakpoint(ErrorString&, const String& eventName) override;
-    void removeEventListenerBreakpoint(ErrorString&, const String& eventName) override;
-    void setInstrumentationBreakpoint(ErrorString&, const String& eventName) override;
-    void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) override;
-    void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
-    void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;
+    void setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) final;
+    void removeXHRBreakpoint(ErrorString&, const String& url) final;
+    void setEventListenerBreakpoint(ErrorString&, const String& eventName) final;
+    void removeEventListenerBreakpoint(ErrorString&, const String& eventName) final;
+    void setInstrumentationBreakpoint(ErrorString&, const String& eventName) final;
+    void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) final;
+    void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) final;
+    void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) final;
 
     // InspectorInstrumentation
     void willInsertDOMNode(Node& parent);
@@ -74,14 +74,14 @@ public:
     void pauseOnNativeEventIfNeeded(bool isDOMEvent, const String& eventName, bool synchronous);
     void mainFrameDOMContentLoaded();
 
-    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
-    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
-    void discardAgent() override;
+    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final;
+    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
+    void discardAgent() final;
 
 private:
     // Inspector::InspectorDebuggerAgent::Listener implementation.
-    void debuggerWasEnabled() override;
-    void debuggerWasDisabled() override;
+    void debuggerWasEnabled() final;
+    void debuggerWasDisabled() final;
     void disable();
 
     void descriptionForDOMEvent(Node& target, int breakpointType, bool insertion, JSON::Object& description);
index 4e563c0..a4c440e 100644 (file)
@@ -836,7 +836,7 @@ static JSC::JSValue webSocketAsScriptValue(JSC::ExecState& state, WebSocket* web
     return toJS(&state, deprecatedGlobalObjectForPrototype(&state), webSocket);
 }
 
-void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
+void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)
 {
     WebSocket* webSocket = webSocketForRequestId(requestId);
     if (!webSocket) {
index 9a432bd..411f174 100644 (file)
@@ -116,7 +116,7 @@ public:
     void getResponseBody(ErrorString&, const String& requestId, String* content, bool* base64Encoded) final;
     void setResourceCachingDisabled(ErrorString&, bool disabled) final;
     void loadResource(ErrorString&, const String& frameId, const String& url, Ref<LoadResourceCallback>&&) final;
-    void resolveWebSocket(ErrorString&, const String& requestId, const String* const objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;
+    void resolveWebSocket(ErrorString&, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;
 
     virtual String loaderIdentifier(DocumentLoader*) = 0;
     virtual String frameIdentifier(DocumentLoader*) = 0;
index d980a68..ff01260 100644 (file)
@@ -315,7 +315,7 @@ void InspectorPageAgent::disable(ErrorString&)
     setEmulatedMedia(unused, emptyString());
 }
 
-void InspectorPageAgent::reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources)
+void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources)
 {
     bool reloadFromOrigin = optionalReloadFromOrigin && *optionalReloadFromOrigin;
     bool revalidateAllResources = optionalRevalidateAllResources && *optionalRevalidateAllResources;
@@ -471,7 +471,7 @@ void InspectorPageAgent::getResourceContent(ErrorString& errorString, const Stri
     resourceContent(errorString, frame, URL(ParsedURLString, url), content, base64Encoded);
 }
 
-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)
+void 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)
 {
     results = JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>::create();
 
@@ -524,7 +524,7 @@ static Ref<Inspector::Protocol::Page::SearchResult> buildObjectForSearchResult(c
         .release();
 }
 
-void InspectorPageAgent::searchInResources(ErrorString&, const String& text, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result)
+void InspectorPageAgent::searchInResources(ErrorString&, const String& text, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result)
 {
     result = JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>::create();
 
index d22e395..8ae10bb 100644 (file)
@@ -88,23 +88,23 @@ public:
     static Inspector::Protocol::Page::ResourceType cachedResourceTypeJSON(const CachedResource&);
 
     // Page API for InspectorFrontend
-    void enable(ErrorString&) override;
-    void disable(ErrorString&) override;
-    void reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources) override;
-    void navigate(ErrorString&, const String& url) override;
-    void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) override;
-    void deleteCookie(ErrorString&, const String& cookieName, const String& url) override;
-    void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) override;
-    void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) override;
-    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;
-    void searchInResources(ErrorString&, const String&, const bool* const caseSensitive, const bool* const isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&) override;
-    void setShowPaintRects(ErrorString&, bool show) override;
-    void setEmulatedMedia(ErrorString&, const String&) override;
-    void getCompositingBordersVisible(ErrorString&, bool* out_param) override;
-    void setCompositingBordersVisible(ErrorString&, bool) override;
-    void snapshotNode(ErrorString&, int nodeId, String* outDataURL) override;
-    void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) override;
-    void archive(ErrorString&, String* data) override;
+    void enable(ErrorString&) final;
+    void disable(ErrorString&) final;
+    void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final;
+    void navigate(ErrorString&, const String& url) final;
+    void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) final;
+    void deleteCookie(ErrorString&, const String& cookieName, const String& url) final;
+    void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) final;
+    void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) final;
+    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;
+    void searchInResources(ErrorString&, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&) final;
+    void setShowPaintRects(ErrorString&, bool show) final;
+    void setEmulatedMedia(ErrorString&, const String&) final;
+    void getCompositingBordersVisible(ErrorString&, bool* out_param) final;
+    void setCompositingBordersVisible(ErrorString&, bool) final;
+    void snapshotNode(ErrorString&, int nodeId, String* outDataURL) final;
+    void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) final;
+    void archive(ErrorString&, String* data) final;
 
     // InspectorInstrumentation
     void domContentEventFired();
@@ -123,8 +123,8 @@ public:
     void didRecalculateStyle();
 
     // Inspector Controller API
-    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;
-    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
+    void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final;
+    void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
 
     // Cross-agents API
     Page& page() { return m_page; }
index 936ddff..d2616db 100644 (file)
@@ -98,7 +98,7 @@ public:
     void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final;
     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final;
 
-    void start(ErrorString&, const int* const maxCallStackDepth = nullptr) final;
+    void start(ErrorString&, const int* maxCallStackDepth = nullptr) final;
     void stop(ErrorString&) final;
     void setAutoCaptureEnabled(ErrorString&, bool) final;
     void setInstruments(ErrorString&, const JSON::Array&) final;
index 31a24a7..d2b8b89 100644 (file)
@@ -85,7 +85,7 @@ private:
     void breakpointActionLog(JSC::ExecState&, const String&) override;
 
     Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override;
-    void setOverlayMessage(ErrorString&, const String* const) final;
+    void setOverlayMessage(ErrorString&, const String*) final;
 
     Page& m_page;