Changeset 228546 in webkit
- Timestamp:
- Feb 15, 2018 6:14:29 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 53 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r228538 r228546 1 2018-02-15 Darin Adler <darin@apple.com> 2 3 Web Inspector: get rid of remaining uses of OptOutput<T> 4 https://bugs.webkit.org/show_bug.cgi?id=180607 5 6 Reviewed by Brian Burg. 7 8 * inspector/AsyncStackTrace.cpp: Removed explicit Inspector prefix from code that 9 is inside the Inspector namespace already. Also use auto a bit. 10 * inspector/AsyncStackTrace.h: Ditto. 11 * inspector/ConsoleMessage.cpp: Ditto. 12 13 * inspector/ContentSearchUtilities.cpp: More Inspector namespace removal and ... 14 (Inspector::ContentSearchUtilities::getRegularExpressionMatchesByLines): Use a 15 Vector instead of a unique_ptr<Vector>. 16 (Inspector::ContentSearchUtilities::lineEndings): Ditto. 17 (Inspector::ContentSearchUtilities::stylesheetCommentPattern): Deleted. 18 (Inspector::ContentSearchUtilities::findMagicComment): Use std::array instead of 19 a Vector for a fixed size array; also got rid of reinterpret_cast. 20 (Inspector::ContentSearchUtilities::findStylesheetSourceMapURL): Moved the regular 21 expression here since it's the only place it was used. 22 23 * inspector/ContentSearchUtilities.h: Cut down on unneeded includes. 24 25 * inspector/InjectedScript.cpp: Removed explicit Inspector prefix from code that 26 is inside the Inspector namespace already. Also use auto a bit. 27 28 * inspector/InspectorProtocolTypes.h: Removed OptOutput. Simplified assertions. 29 Removed base template for BindingTraits; we only need the specializations. 30 31 * inspector/ScriptCallFrame.cpp: Removed explicit Inspector prefix from code that 32 is inside the Inspector namespace already. Also use auto a bit. 33 * inspector/ScriptCallFrame.h: Ditto. 34 * inspector/ScriptCallStack.cpp: Ditto. 35 * inspector/ScriptCallStack.h: Ditto. 36 * inspector/agents/InspectorConsoleAgent.cpp: Ditto. 37 * inspector/agents/InspectorConsoleAgent.h: Ditto. 38 39 * inspector/agents/InspectorDebuggerAgent.cpp: More Inspector namespace removal and ... 40 (Inspector::InspectorDebuggerAgent::evaluateOnCallFrame): Use std::optional& intead of 41 OptOutput* for out arguments. 42 * inspector/agents/InspectorDebuggerAgent.h: Ditto. 43 44 * inspector/agents/InspectorHeapAgent.cpp: More Inspector namespace removal and ... 45 (Inspector::InspectorHeapAgent::getPreview): Use std::optional& intead of OptOutput* 46 for out arguments. 47 * inspector/agents/InspectorHeapAgent.h: Ditto. 48 49 * inspector/agents/InspectorRuntimeAgent.cpp: More Inspector namespace removal and ... 50 (Inspector::InspectorRuntimeAgent::parse): Use std::optional& intead of OptOutput* 51 for out arguments. 52 (Inspector::InspectorRuntimeAgent::evaluate): Ditto. 53 (Inspector::InspectorRuntimeAgent::callFunctionOn): Ditto. 54 (Inspector::InspectorRuntimeAgent::saveResult): Ditto. 55 * inspector/agents/InspectorRuntimeAgent.h: Ditto. 56 57 * inspector/agents/InspectorScriptProfilerAgent.cpp: More Inspector namespace removal 58 and removed some bogus const. 59 * inspector/agents/InspectorScriptProfilerAgent.h: Ditto. 60 61 * inspector/scripts/codegen/cpp_generator.py: 62 (CppGenerator.cpp_type_for_unchecked_formal_in_parameter): Removed some bogus const. 63 (CppGenerator.cpp_type_for_type_with_name): Ditto. 64 (CppGenerator.cpp_type_for_formal_out_parameter): Use std::optional& instead of 65 Inspector::Protocol::OptOutput*. 66 (CppGenerator.cpp_type_for_formal_async_parameter): Ditto. 67 (CppGenerator.cpp_type_for_stack_in_parameter): Ditto. 68 (CppGenerator.cpp_type_for_stack_out_parameter): Ditto. 69 70 * inspector/scripts/codegen/cpp_generator_templates.py: Removed ASSERT_DISABLED 71 conditional around assertion code which will now compile to nothing if ASSERT is disabled. 72 Build strings more simply in a few cases. 73 74 * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: 75 (CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain): 76 Use has_value instead of isAssigned and * operator instead of getValue() since std::optional 77 replace OptOutput here. 78 (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): 79 Pass by reference instead of pointer now. 80 81 * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: 82 Removed ASSERT_DISABLED conditional around assertion code which will now compile to nothing 83 if ASSERT is disabled. 84 85 * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: 86 (CppProtocolTypesImplementationGenerator._generate_assertion_for_object_declaration): Generate 87 the assertion function unconditionally, but leave out the assertions if ASSERT_DISABLED is true. 88 (CppProtocolTypesImplementationGenerator): Use auto instead of writing out JSON::Object::iterator. 89 90 * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: 91 (ObjCBackendDispatcherImplementationGenerator._generate_conversions_for_command): Build strings 92 more simply. 93 94 * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result: 95 * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result: 96 * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result: 97 * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result: 98 Rebaselined. 99 1 100 2018-02-15 Filip Pizlo <fpizlo@apple.com> 2 101 -
trunk/Source/JavaScriptCore/inspector/AsyncStackTrace.cpp
r225231 r228546 28 28 29 29 #include "ScriptCallStack.h" 30 #include <wtf/Ref.h> 30 31 31 32 namespace Inspector { … … 97 98 } 98 99 99 RefPtr< Inspector::Protocol::Console::StackTrace> AsyncStackTrace::buildInspectorObject() const100 RefPtr<Protocol::Console::StackTrace> AsyncStackTrace::buildInspectorObject() const 100 101 { 101 RefPtr< Inspector::Protocol::Console::StackTrace> topStackTrace;102 RefPtr< Inspector::Protocol::Console::StackTrace> previousStackTrace;102 RefPtr<Protocol::Console::StackTrace> topStackTrace; 103 RefPtr<Protocol::Console::StackTrace> previousStackTrace; 103 104 104 105 auto* stackTrace = this; … … 107 108 ASSERT(callStack->size()); 108 109 109 RefPtr<Inspector::Protocol::Console::StackTrace> protocolObject = Inspector::Protocol::Console::StackTrace::create()110 auto protocolObject = Protocol::Console::StackTrace::create() 110 111 .setCallFrames(callStack->buildInspectorArray()) 111 112 .release(); … … 117 118 118 119 if (!topStackTrace) 119 topStackTrace = protocolObject ;120 topStackTrace = protocolObject.ptr(); 120 121 121 122 if (previousStackTrace) 122 previousStackTrace->setParentStackTrace(protocolObject );123 previousStackTrace->setParentStackTrace(protocolObject.ptr()); 123 124 124 previousStackTrace = protocolObject;125 previousStackTrace = WTFMove(protocolObject); 125 126 stackTrace = stackTrace->m_parent.get(); 126 127 } -
trunk/Source/JavaScriptCore/inspector/AsyncStackTrace.h
r212448 r228546 52 52 void didCancelAsyncCall(); 53 53 54 RefPtr< Inspector::Protocol::Console::StackTrace> buildInspectorObject() const;54 RefPtr<Protocol::Console::StackTrace> buildInspectorObject() const; 55 55 56 56 ~AsyncStackTrace(); -
trunk/Source/JavaScriptCore/inspector/ConsoleMessage.cpp
r228260 r228546 155 155 } 156 156 157 static Inspector::Protocol::Console::ChannelSource messageSourceValue(MessageSource source)157 static Protocol::Console::ChannelSource messageSourceValue(MessageSource source) 158 158 { 159 159 switch (source) { 160 case MessageSource::XML: return Inspector::Protocol::Console::ChannelSource::XML;161 case MessageSource::JS: return Inspector::Protocol::Console::ChannelSource::Javascript;162 case MessageSource::Network: return Inspector::Protocol::Console::ChannelSource::Network;163 case MessageSource::ConsoleAPI: return Inspector::Protocol::Console::ChannelSource::ConsoleAPI;164 case MessageSource::Storage: return Inspector::Protocol::Console::ChannelSource::Storage;165 case MessageSource::AppCache: return Inspector::Protocol::Console::ChannelSource::Appcache;166 case MessageSource::Rendering: return Inspector::Protocol::Console::ChannelSource::Rendering;167 case MessageSource::CSS: return Inspector::Protocol::Console::ChannelSource::CSS;168 case MessageSource::Security: return Inspector::Protocol::Console::ChannelSource::Security;169 case MessageSource::ContentBlocker: return Inspector::Protocol::Console::ChannelSource::ContentBlocker;170 case MessageSource::Other: return Inspector::Protocol::Console::ChannelSource::Other;171 case MessageSource::Media: return Inspector::Protocol::Console::ChannelSource::Media;172 case MessageSource::WebRTC: return Inspector::Protocol::Console::ChannelSource::WebRTC;173 } 174 return Inspector::Protocol::Console::ChannelSource::Other;175 } 176 177 static Inspector::Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type)160 case MessageSource::XML: return Protocol::Console::ChannelSource::XML; 161 case MessageSource::JS: return Protocol::Console::ChannelSource::Javascript; 162 case MessageSource::Network: return Protocol::Console::ChannelSource::Network; 163 case MessageSource::ConsoleAPI: return Protocol::Console::ChannelSource::ConsoleAPI; 164 case MessageSource::Storage: return Protocol::Console::ChannelSource::Storage; 165 case MessageSource::AppCache: return Protocol::Console::ChannelSource::Appcache; 166 case MessageSource::Rendering: return Protocol::Console::ChannelSource::Rendering; 167 case MessageSource::CSS: return Protocol::Console::ChannelSource::CSS; 168 case MessageSource::Security: return Protocol::Console::ChannelSource::Security; 169 case MessageSource::ContentBlocker: return Protocol::Console::ChannelSource::ContentBlocker; 170 case MessageSource::Other: return Protocol::Console::ChannelSource::Other; 171 case MessageSource::Media: return Protocol::Console::ChannelSource::Media; 172 case MessageSource::WebRTC: return Protocol::Console::ChannelSource::WebRTC; 173 } 174 return Protocol::Console::ChannelSource::Other; 175 } 176 177 static Protocol::Console::ConsoleMessage::Type messageTypeValue(MessageType type) 178 178 { 179 179 switch (type) { 180 case MessageType::Log: return Inspector::Protocol::Console::ConsoleMessage::Type::Log;181 case MessageType::Clear: return Inspector::Protocol::Console::ConsoleMessage::Type::Clear;182 case MessageType::Dir: return Inspector::Protocol::Console::ConsoleMessage::Type::Dir;183 case MessageType::DirXML: return Inspector::Protocol::Console::ConsoleMessage::Type::DirXML;184 case MessageType::Table: return Inspector::Protocol::Console::ConsoleMessage::Type::Table;185 case MessageType::Trace: return Inspector::Protocol::Console::ConsoleMessage::Type::Trace;186 case MessageType::StartGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroup;187 case MessageType::StartGroupCollapsed: return Inspector::Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed;188 case MessageType::EndGroup: return Inspector::Protocol::Console::ConsoleMessage::Type::EndGroup;189 case MessageType::Assert: return Inspector::Protocol::Console::ConsoleMessage::Type::Assert;190 case MessageType::Timing: return Inspector::Protocol::Console::ConsoleMessage::Type::Timing;191 case MessageType::Profile: return Inspector::Protocol::Console::ConsoleMessage::Type::Profile;192 case MessageType::ProfileEnd: return Inspector::Protocol::Console::ConsoleMessage::Type::ProfileEnd;193 } 194 return Inspector::Protocol::Console::ConsoleMessage::Type::Log;195 } 196 197 static Inspector::Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level)180 case MessageType::Log: return Protocol::Console::ConsoleMessage::Type::Log; 181 case MessageType::Clear: return Protocol::Console::ConsoleMessage::Type::Clear; 182 case MessageType::Dir: return Protocol::Console::ConsoleMessage::Type::Dir; 183 case MessageType::DirXML: return Protocol::Console::ConsoleMessage::Type::DirXML; 184 case MessageType::Table: return Protocol::Console::ConsoleMessage::Type::Table; 185 case MessageType::Trace: return Protocol::Console::ConsoleMessage::Type::Trace; 186 case MessageType::StartGroup: return Protocol::Console::ConsoleMessage::Type::StartGroup; 187 case MessageType::StartGroupCollapsed: return Protocol::Console::ConsoleMessage::Type::StartGroupCollapsed; 188 case MessageType::EndGroup: return Protocol::Console::ConsoleMessage::Type::EndGroup; 189 case MessageType::Assert: return Protocol::Console::ConsoleMessage::Type::Assert; 190 case MessageType::Timing: return Protocol::Console::ConsoleMessage::Type::Timing; 191 case MessageType::Profile: return Protocol::Console::ConsoleMessage::Type::Profile; 192 case MessageType::ProfileEnd: return Protocol::Console::ConsoleMessage::Type::ProfileEnd; 193 } 194 return Protocol::Console::ConsoleMessage::Type::Log; 195 } 196 197 static Protocol::Console::ConsoleMessage::Level messageLevelValue(MessageLevel level) 198 198 { 199 199 switch (level) { 200 case MessageLevel::Log: return Inspector::Protocol::Console::ConsoleMessage::Level::Log;201 case MessageLevel::Info: return Inspector::Protocol::Console::ConsoleMessage::Level::Info;202 case MessageLevel::Warning: return Inspector::Protocol::Console::ConsoleMessage::Level::Warning;203 case MessageLevel::Error: return Inspector::Protocol::Console::ConsoleMessage::Level::Error;204 case MessageLevel::Debug: return Inspector::Protocol::Console::ConsoleMessage::Level::Debug;205 } 206 return Inspector::Protocol::Console::ConsoleMessage::Level::Log;200 case MessageLevel::Log: return Protocol::Console::ConsoleMessage::Level::Log; 201 case MessageLevel::Info: return Protocol::Console::ConsoleMessage::Level::Info; 202 case MessageLevel::Warning: return Protocol::Console::ConsoleMessage::Level::Warning; 203 case MessageLevel::Error: return Protocol::Console::ConsoleMessage::Level::Error; 204 case MessageLevel::Debug: return Protocol::Console::ConsoleMessage::Level::Debug; 205 } 206 return Protocol::Console::ConsoleMessage::Level::Log; 207 207 } 208 208 209 209 void ConsoleMessage::addToFrontend(ConsoleFrontendDispatcher& consoleFrontendDispatcher, InjectedScriptManager& injectedScriptManager, bool generatePreview) 210 210 { 211 auto messageObject = Inspector::Protocol::Console::ConsoleMessage::create()211 auto messageObject = Protocol::Console::ConsoleMessage::create() 212 212 .setSource(messageSourceValue(m_source)) 213 213 .setLevel(messageLevelValue(m_level)) … … 228 228 InjectedScript injectedScript = injectedScriptManager.injectedScriptFor(scriptState()); 229 229 if (!injectedScript.hasNoValue()) { 230 auto argumentsObject = JSON::ArrayOf< Inspector::Protocol::Runtime::RemoteObject>::create();230 auto argumentsObject = JSON::ArrayOf<Protocol::Runtime::RemoteObject>::create(); 231 231 if (m_arguments && m_arguments->argumentCount()) { 232 232 if (m_type == MessageType::Table && generatePreview && m_arguments->argumentCount()) { -
trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp
r226128 r228546 36 36 #include <wtf/StdLibExtras.h> 37 37 #include <wtf/text/StringBuilder.h> 38 #include <wtf/text/TextPosition.h> 38 39 39 40 using namespace JSC::Yarr; … … 80 81 return result; 81 82 82 std::unique_ptr<Vector<size_t>> endings(lineEndings(text));83 size_t size = endings ->size();83 auto endings = lineEndings(text); 84 size_t size = endings.size(); 84 85 size_t start = 0; 85 86 86 87 for (size_t lineNumber = 0; lineNumber < size; ++lineNumber) { 87 size_t nextStart = endings ->at(lineNumber);88 size_t nextStart = endings[lineNumber]; 88 89 String line = text.substring(start, nextStart - start); 89 90 … … 98 99 } 99 100 100 std::unique_ptr<Vector<size_t>> lineEndings(const String& text)101 Vector<size_t> lineEndings(const String& text) 101 102 { 102 auto result = std::make_unique<Vector<size_t>>();103 Vector<size_t> result; 103 104 104 105 size_t start = 0; … … 106 107 size_t nextStart = text.find('\n', start); 107 108 if (nextStart == notFound || nextStart == (text.length() - 1)) { 108 result ->append(text.length());109 result.append(text.length()); 109 110 break; 110 111 } 111 112 112 113 nextStart += 1; 113 result ->append(nextStart);114 result.append(nextStart); 114 115 start = nextStart; 115 116 } 116 117 117 result ->append(text.length());118 result.append(text.length()); 118 119 119 120 return result; 120 121 } 121 122 122 static Ref< Inspector::Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent)123 static Ref<Protocol::GenericTypes::SearchMatch> buildObjectForSearchMatch(size_t lineNumber, const String& lineContent) 123 124 { 124 return Inspector::Protocol::GenericTypes::SearchMatch::create()125 return Protocol::GenericTypes::SearchMatch::create() 125 126 .setLineNumber(lineNumber) 126 127 .setLineContent(lineContent) … … 152 153 } 153 154 154 Ref<JSON::ArrayOf< Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)155 Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex) 155 156 { 156 auto result = JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>::create(); 157 158 RegularExpression regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex); 159 Vector<std::pair<size_t, String>> matches = getRegularExpressionMatchesByLines(regex, text); 160 161 for (const auto& match : matches) { 162 Ref<Inspector::Protocol::GenericTypes::SearchMatch> matchObject = buildObjectForSearchMatch(match.first, match.second); 163 result->addItem(WTFMove(matchObject)); 164 } 165 157 auto result = JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>::create(); 158 auto regex = ContentSearchUtilities::createSearchRegex(query, caseSensitive, isRegex); 159 for (const auto& match : getRegularExpressionMatchesByLines(regex, text)) 160 result->addItem(buildObjectForSearchMatch(match.first, match.second)); 166 161 return result; 167 }168 169 static String stylesheetCommentPattern(const String& name)170 {171 // "/*# <name>=<value> */" and deprecated "/*@"172 return "/\\*[#@][\040\t]" + name + "=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/";173 162 } 174 163 … … 186 175 187 176 ASSERT(pattern.m_numSubpatterns == 1); 188 Vector<int, 4> matches; 189 matches.grow(4); 190 unsigned result = interpret(bytecodePattern.get(), content, 0, reinterpret_cast<unsigned*>(matches.data())); 177 std::array<unsigned, 4> matches; 178 unsigned result = interpret(bytecodePattern.get(), content, 0, matches.data()); 191 179 if (result == offsetNoMatch) 192 180 return String(); … … 198 186 String findStylesheetSourceMapURL(const String& content) 199 187 { 200 return findMagicComment(content, stylesheetCommentPattern(ASCIILiteral("sourceMappingURL"))); 188 // "/*# <name>=<value> */" and deprecated "/*@" 189 return findMagicComment(content, ASCIILiteral { "/\\*[#@][\040\t]sourceMappingURL=[\040\t]*([^\\s\'\"]*)[\040\t]*\\*/" }); 201 190 } 202 191 -
trunk/Source/JavaScriptCore/inspector/ContentSearchUtilities.h
r225425 r228546 30 30 31 31 #include "InspectorProtocolObjects.h" 32 #include <wtf/Vector.h> 33 #include <wtf/text/TextPosition.h> 34 #include <wtf/text/WTFString.h> 32 #include <wtf/Forward.h> 35 33 36 34 namespace JSC { namespace Yarr { … … 44 42 JS_EXPORT_PRIVATE JSC::Yarr::RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex); 45 43 JS_EXPORT_PRIVATE int countRegularExpressionMatches(const JSC::Yarr::RegularExpression&, const String&); 46 JS_EXPORT_PRIVATE Ref<JSON::ArrayOf< Inspector::Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);44 JS_EXPORT_PRIVATE Ref<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex); 47 45 JS_EXPORT_PRIVATE TextPosition textPositionFromOffset(size_t offset, const Vector<size_t>& lineEndings); 48 JS_EXPORT_PRIVATE std::unique_ptr<Vector<size_t>> lineEndings(const String&);46 JS_EXPORT_PRIVATE Vector<size_t> lineEndings(const String&); 49 47 50 48 JS_EXPORT_PRIVATE String findStylesheetSourceMapURL(const String& content); -
trunk/Source/JavaScriptCore/inspector/InjectedScript.cpp
r225804 r228546 55 55 } 56 56 57 void InjectedScript::evaluate(ErrorString& errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr< Inspector::Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)57 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) 58 58 { 59 59 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluate"), inspectorEnvironment()->functionCallHandler()); … … 67 67 } 68 68 69 void InjectedScript::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, bool generatePreview, RefPtr< Inspector::Protocol::Runtime::RemoteObject>& result, bool& wasThrown)69 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) 70 70 { 71 71 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("callFunctionOn"), inspectorEnvironment()->functionCallHandler()); … … 80 80 } 81 81 82 void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr< Inspector::Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex)82 void InjectedScript::evaluateOnCallFrame(ErrorString& errorString, JSC::JSValue callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, bool generatePreview, bool saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, bool& wasThrown, std::optional<int>& savedResultIndex) 83 83 { 84 84 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("evaluateOnCallFrame"), inspectorEnvironment()->functionCallHandler()); … … 94 94 } 95 95 96 void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr< Inspector::Protocol::Debugger::FunctionDetails>& result)96 void InjectedScript::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& result) 97 97 { 98 98 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getFunctionDetails"), inspectorEnvironment()->functionCallHandler()); … … 106 106 } 107 107 108 result = BindingTraits< Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));108 result = BindingTraits<Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue)); 109 109 } 110 110 … … 121 121 } 122 122 123 result = BindingTraits< Inspector::Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue));123 result = BindingTraits<Protocol::Debugger::FunctionDetails>::runtimeCast(WTFMove(resultValue)); 124 124 } 125 125 … … 136 136 } 137 137 138 result = BindingTraits< Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(WTFMove(resultValue));139 } 140 141 void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::PropertyDescriptor>>& properties)138 result = BindingTraits<Protocol::Runtime::ObjectPreview>::runtimeCast(WTFMove(resultValue)); 139 } 140 141 void InjectedScript::getProperties(ErrorString& errorString, const String& objectId, bool ownProperties, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& properties) 142 142 { 143 143 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getProperties"), inspectorEnvironment()->functionCallHandler()); … … 152 152 } 153 153 154 properties = BindingTraits<JSON::ArrayOf< Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));155 } 156 157 void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::PropertyDescriptor>>& properties)154 properties = BindingTraits<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result)); 155 } 156 157 void InjectedScript::getDisplayableProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& properties) 158 158 { 159 159 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getDisplayableProperties"), inspectorEnvironment()->functionCallHandler()); … … 167 167 } 168 168 169 properties = BindingTraits<JSON::ArrayOf< Inspector::Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result));170 } 171 172 void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& properties)169 properties = BindingTraits<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>::runtimeCast(WTFMove(result)); 170 } 171 172 void InjectedScript::getInternalProperties(ErrorString& errorString, const String& objectId, bool generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& properties) 173 173 { 174 174 Deprecated::ScriptFunctionCall function(injectedScriptObject(), ASCIILiteral("getInternalProperties"), inspectorEnvironment()->functionCallHandler()); … … 182 182 } 183 183 184 auto array = BindingTraits<JSON::ArrayOf< Inspector::Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result));184 auto array = BindingTraits<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>::runtimeCast(WTFMove(result)); 185 185 properties = array->length() > 0 ? array : nullptr; 186 186 } … … 219 219 } 220 220 221 Ref<JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(JSC::JSValue callFrames) const221 Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> InjectedScript::wrapCallFrames(JSC::JSValue callFrames) const 222 222 { 223 223 ASSERT(!hasNoValue()); … … 228 228 auto callFramesValue = callFunctionWithEvalEnabled(function, hadException); 229 229 if (!callFramesValue) 230 return JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>::create();230 return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create(); 231 231 ASSERT(!hadException); 232 232 RefPtr<JSON::Value> result = toInspectorValue(*scriptState(), callFramesValue); 233 233 if (result->type() == JSON::Value::Type::Array) 234 return BindingTraits<JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull();235 236 return JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>::create();237 } 238 239 RefPtr< Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue value, const String& groupName, bool generatePreview) const234 return BindingTraits<JSON::ArrayOf<Protocol::Debugger::CallFrame>>::runtimeCast(WTFMove(result)).releaseNonNull(); 235 236 return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create(); 237 } 238 239 RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapObject(JSC::JSValue value, const String& groupName, bool generatePreview) const 240 240 { 241 241 ASSERT(!hasNoValue()); … … 255 255 ASSERT_UNUSED(castSucceeded, castSucceeded); 256 256 257 return BindingTraits< Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);257 return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject); 258 258 } 259 259 … … 278 278 ASSERT_UNUSED(castSucceeded, castSucceeded); 279 279 280 return BindingTraits< Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);281 } 282 283 RefPtr< Inspector::Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC::JSValue table, JSC::JSValue columns) const280 return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject); 281 } 282 283 RefPtr<Protocol::Runtime::RemoteObject> InjectedScript::wrapTable(JSC::JSValue table, JSC::JSValue columns) const 284 284 { 285 285 ASSERT(!hasNoValue()); … … 301 301 ASSERT_UNUSED(castSucceeded, castSucceeded); 302 302 303 return BindingTraits< Inspector::Protocol::Runtime::RemoteObject>::runtimeCast(resultObject);304 } 305 306 RefPtr< Inspector::Protocol::Runtime::ObjectPreview> InjectedScript::previewValue(JSC::JSValue value) const303 return BindingTraits<Protocol::Runtime::RemoteObject>::runtimeCast(resultObject); 304 } 305 306 RefPtr<Protocol::Runtime::ObjectPreview> InjectedScript::previewValue(JSC::JSValue value) const 307 307 { 308 308 ASSERT(!hasNoValue()); … … 319 319 ASSERT_UNUSED(castSucceeded, castSucceeded); 320 320 321 return BindingTraits< Inspector::Protocol::Runtime::ObjectPreview>::runtimeCast(resultObject);321 return BindingTraits<Protocol::Runtime::ObjectPreview>::runtimeCast(resultObject); 322 322 } 323 323 -
trunk/Source/JavaScriptCore/inspector/InspectorProtocolTypes.h
r225425 r228546 34 34 namespace Protocol { 35 35 36 template<typename T> struct BindingTraits;36 template<typename> struct BindingTraits; 37 37 38 template<typename T> 39 class OptOutput { 40 public: 41 OptOutput() : m_assigned(false) { } 42 43 void operator=(T value) 38 template<JSON::Value::Type type> struct PrimitiveBindingTraits { 39 static void assertValueHasExpectedType(JSON::Value* value) 44 40 { 45 m_value = value;46 m_assigned = true;41 ASSERT_UNUSED(value, value); 42 ASSERT_UNUSED(value, value->type() == type); 47 43 } 48 49 bool isAssigned() const { return m_assigned; }50 51 T getValue()52 {53 ASSERT(isAssigned());54 return m_value;55 }56 57 private:58 T m_value;59 bool m_assigned;60 61 WTF_MAKE_NONCOPYABLE(OptOutput);62 44 }; 63 45 64 // Helper methods for Protocol and other JSON types are provided by 65 // specializations of BindingTraits<T>. Some are generated for protocol types. 66 67 template<typename T> 68 struct BindingTraits { 69 typedef T BindingType; 70 71 static void push(JSON::Array&, BindingType&); 72 static JSON::Value::Type typeTag(); 73 static RefPtr<T> runtimeCast(RefPtr<JSON::Object>&&); 74 #if !ASSERT_DISABLED 75 static void assertValueHasExpectedType(JSON::Value*); 76 #endif // !ASSERT_DISABLED 77 }; 78 79 template<JSON::Value::Type TYPE> 80 struct PrimitiveBindingTraits { 81 #if !ASSERT_DISABLED 82 static void assertValueHasExpectedType(JSON::Value* value) 83 { 84 ASSERT_ARG(value, value && value->type() == TYPE); 85 } 86 #endif // !ASSERT_DISABLED 87 }; 88 89 template<typename T> 90 struct BindingTraits<JSON::ArrayOf<T>> { 46 template<typename T> struct BindingTraits<JSON::ArrayOf<T>> { 91 47 static RefPtr<JSON::ArrayOf<T>> runtimeCast(RefPtr<JSON::Value>&& value) 92 48 { … … 95 51 bool castSucceeded = value->asArray(array); 96 52 ASSERT_UNUSED(castSucceeded, castSucceeded); 97 #if !ASSERT_DISABLED98 53 assertValueHasExpectedType(array.get()); 99 #endif // !ASSERT_DISABLED100 54 COMPILE_ASSERT(sizeof(JSON::ArrayOf<T>) == sizeof(JSON::Array), type_cast_problem); 101 55 return static_cast<JSON::ArrayOf<T>*>(static_cast<JSON::ArrayBase*>(array.get())); 102 56 } 103 57 104 #if !ASSERT_DISABLED105 58 static void assertValueHasExpectedType(JSON::Value* value) 106 59 { 60 #if ASSERT_DISABLED 61 UNUSED_PARAM(value); 62 #else 107 63 ASSERT_ARG(value, value); 108 64 RefPtr<JSON::Array> array; … … 111 67 for (unsigned i = 0; i < array->length(); i++) 112 68 BindingTraits<T>::assertValueHasExpectedType(array->get(i).get()); 69 #endif // !ASSERT_DISABLED 113 70 } 114 #endif // !ASSERT_DISABLED115 71 }; 116 72 117 template<> 118 struct BindingTraits<JSON::Value> { 119 #if !ASSERT_DISABLED 73 template<> struct BindingTraits<JSON::Value> { 120 74 static void assertValueHasExpectedType(JSON::Value*) 121 75 { 122 76 } 123 #endif // !ASSERT_DISABLED124 77 }; 125 78 126 template<> struct BindingTraits<JSON::Array> : publicPrimitiveBindingTraits<JSON::Value::Type::Array> { };127 template<> struct BindingTraits<JSON::Object> : publicPrimitiveBindingTraits<JSON::Value::Type::Object> { };128 template<> struct BindingTraits<String> : publicPrimitiveBindingTraits<JSON::Value::Type::String> { };129 template<> struct BindingTraits<bool> : publicPrimitiveBindingTraits<JSON::Value::Type::Boolean> { };130 template<> struct BindingTraits<double> : publicPrimitiveBindingTraits<JSON::Value::Type::Double> { };131 template<> struct BindingTraits<int> : publicPrimitiveBindingTraits<JSON::Value::Type::Integer> { };79 template<> struct BindingTraits<JSON::Array> : PrimitiveBindingTraits<JSON::Value::Type::Array> { }; 80 template<> struct BindingTraits<JSON::Object> : PrimitiveBindingTraits<JSON::Value::Type::Object> { }; 81 template<> struct BindingTraits<String> : PrimitiveBindingTraits<JSON::Value::Type::String> { }; 82 template<> struct BindingTraits<bool> : PrimitiveBindingTraits<JSON::Value::Type::Boolean> { }; 83 template<> struct BindingTraits<double> : PrimitiveBindingTraits<JSON::Value::Type::Double> { }; 84 template<> struct BindingTraits<int> : PrimitiveBindingTraits<JSON::Value::Type::Integer> { }; 132 85 133 } // namespace Protocol86 } 134 87 135 88 using Protocol::BindingTraits; -
trunk/Source/JavaScriptCore/inspector/ScriptCallFrame.cpp
r225231 r228546 63 63 } 64 64 65 Ref< Inspector::Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const65 Ref<Protocol::Console::CallFrame> ScriptCallFrame::buildInspectorObject() const 66 66 { 67 return Inspector::Protocol::Console::CallFrame::create()67 return Protocol::Console::CallFrame::create() 68 68 .setFunctionName(m_functionName) 69 69 .setUrl(m_scriptName) -
trunk/Source/JavaScriptCore/inspector/ScriptCallFrame.h
r220188 r228546 55 55 bool operator==(const ScriptCallFrame& other) const { return isEqual(other); } 56 56 57 Ref< Inspector::Protocol::Console::CallFrame> buildInspectorObject() const;57 Ref<Protocol::Console::CallFrame> buildInspectorObject() const; 58 58 59 59 private: -
trunk/Source/JavaScriptCore/inspector/ScriptCallStack.cpp
r225425 r228546 106 106 } 107 107 108 Ref<JSON::ArrayOf< Inspector::Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const108 Ref<JSON::ArrayOf<Protocol::Console::CallFrame>> ScriptCallStack::buildInspectorArray() const 109 109 { 110 auto frames = JSON::ArrayOf< Inspector::Protocol::Console::CallFrame>::create();110 auto frames = JSON::ArrayOf<Protocol::Console::CallFrame>::create(); 111 111 for (size_t i = 0; i < m_frames.size(); i++) 112 112 frames->addItem(m_frames.at(i).buildInspectorObject()); -
trunk/Source/JavaScriptCore/inspector/ScriptCallStack.h
r225425 r228546 57 57 bool isEqual(ScriptCallStack*) const; 58 58 59 Ref<JSON::ArrayOf< Inspector::Protocol::Console::CallFrame>> buildInspectorArray() const;59 Ref<JSON::ArrayOf<Protocol::Console::CallFrame>> buildInspectorArray() const; 60 60 61 61 private: -
trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp
r228533 r228546 240 240 } 241 241 242 void InspectorConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf< Inspector::Protocol::Console::Channel>>& channels)242 void InspectorConsoleAgent::getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>& channels) 243 243 { 244 244 // Default implementation has no logging channels. 245 channels = JSON::ArrayOf< Inspector::Protocol::Console::Channel>::create();245 channels = JSON::ArrayOf<Protocol::Console::Channel>::create(); 246 246 } 247 247 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h
r228533 r228546 74 74 void count(JSC::ExecState*, Ref<ScriptArguments>&&); 75 75 76 void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf< Inspector::Protocol::Console::Channel>>&) override;76 void getLoggingChannels(ErrorString&, RefPtr<JSON::ArrayOf<Protocol::Console::Channel>>&) override; 77 77 void setLoggingChannelLevel(ErrorString&, const String& channel, const String& level) override; 78 78 -
trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp
r228260 r228546 174 174 static RefPtr<JSON::Object> buildAssertPauseReason(const String& message) 175 175 { 176 auto reason = Inspector::Protocol::Debugger::AssertPauseReason::create().release();176 auto reason = Protocol::Debugger::AssertPauseReason::create().release(); 177 177 if (!message.isNull()) 178 178 reason->setMessage(message); … … 182 182 static RefPtr<JSON::Object> buildCSPViolationPauseReason(const String& directiveText) 183 183 { 184 auto reason = Inspector::Protocol::Debugger::CSPViolationPauseReason::create()184 auto reason = Protocol::Debugger::CSPViolationPauseReason::create() 185 185 .setDirective(directiveText) 186 186 .release(); … … 195 195 return nullptr; 196 196 197 auto reason = Inspector::Protocol::Debugger::BreakpointPauseReason::create()197 auto reason = Protocol::Debugger::BreakpointPauseReason::create() 198 198 .setBreakpointId(it->value) 199 199 .release(); … … 343 343 static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output) 344 344 { 345 if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {345 if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Log)) { 346 346 *output = ScriptBreakpointActionTypeLog; 347 347 return true; 348 348 } 349 if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {349 if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Evaluate)) { 350 350 *output = ScriptBreakpointActionTypeEvaluate; 351 351 return true; 352 352 } 353 if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {353 if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Sound)) { 354 354 *output = ScriptBreakpointActionTypeSound; 355 355 return true; 356 356 } 357 if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {357 if (typeString == Protocol::InspectorHelpers::getEnumConstantValue(Protocol::Debugger::BreakpointAction::Type::Probe)) { 358 358 *output = ScriptBreakpointActionTypeProbe; 359 359 return true; … … 407 407 } 408 408 409 static RefPtr< Inspector::Protocol::Debugger::Location> buildDebuggerLocation(const JSC::Breakpoint& breakpoint)409 static RefPtr<Protocol::Debugger::Location> buildDebuggerLocation(const JSC::Breakpoint& breakpoint) 410 410 { 411 411 ASSERT(breakpoint.resolved); 412 412 413 auto location = Inspector::Protocol::Debugger::Location::create()413 auto location = Protocol::Debugger::Location::create() 414 414 .setScriptId(String::number(breakpoint.sourceID)) 415 415 .setLineNumber(breakpoint.line) … … 435 435 } 436 436 437 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString& errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::Location>>& locations)438 { 439 locations = JSON::ArrayOf< Inspector::Protocol::Debugger::Location>::create();437 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) 438 { 439 locations = JSON::ArrayOf<Protocol::Debugger::Location>::create(); 440 440 if (!optionalURL == !optionalURLRegex) { 441 441 errorString = ASCIILiteral("Either url or urlRegex must be specified."); … … 496 496 } 497 497 498 void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const JSON::Object& location, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation)498 void InspectorDebuggerAgent::setBreakpoint(ErrorString& errorString, const JSON::Object& location, const JSON::Object* options, Protocol::Debugger::BreakpointId* outBreakpointIdentifier, RefPtr<Protocol::Debugger::Location>& actualLocation) 499 499 { 500 500 JSC::SourceID sourceID; … … 660 660 } 661 661 662 void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf< Inspector::Protocol::GenericTypes::SearchMatch>>& results)662 void InspectorDebuggerAgent::searchInContent(ErrorString& error, const String& scriptIDStr, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>>& results) 663 663 { 664 664 JSC::SourceID sourceID = scriptIDStr.toIntPtr(); … … 684 684 } 685 685 686 void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr< Inspector::Protocol::Debugger::FunctionDetails>& details)686 void InspectorDebuggerAgent::getFunctionDetails(ErrorString& errorString, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>& details) 687 687 { 688 688 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(functionId); … … 827 827 } 828 828 829 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr< Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* outWasThrown, Inspector::Protocol::OptOutput<int>* outSavedResultIndex)829 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString& errorString, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& outWasThrown, std::optional<int>& savedResultIndex) 830 830 { 831 831 if (!m_currentCallStack) { … … 848 848 } 849 849 850 // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.851 850 bool wasThrown; 852 std::optional<int> savedResultIndex;853 851 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack.get(), callFrameId, expression, 854 852 objectGroup ? *objectGroup : emptyString(), includeCommandLineAPI && *includeCommandLineAPI, returnByValue && *returnByValue, generatePreview && *generatePreview, saveResult && *saveResult, 855 853 result, wasThrown, savedResultIndex); 856 *outWasThrown = wasThrown; 857 if (savedResultIndex.has_value()) 858 *outSavedResultIndex = savedResultIndex.value(); 854 outWasThrown = wasThrown; 859 855 860 856 if (pauseAndMute) { … … 874 870 } 875 871 876 Ref<JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript)872 Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> InspectorDebuggerAgent::currentCallFrames(const InjectedScript& injectedScript) 877 873 { 878 874 ASSERT(!injectedScript.hasNoValue()); 879 875 if (injectedScript.hasNoValue()) 880 return JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>::create();876 return JSON::ArrayOf<Protocol::Debugger::CallFrame>::create(); 881 877 882 878 return injectedScript.wrapCallFrames(m_currentCallStack.get()); … … 1010 1006 m_enablePauseWhenIdle = false; 1011 1007 1012 RefPtr< Inspector::Protocol::Console::StackTrace> asyncStackTrace;1008 RefPtr<Protocol::Console::StackTrace> asyncStackTrace; 1013 1009 if (m_currentAsyncCallIdentifier) { 1014 1010 auto it = m_pendingAsyncCalls.find(m_currentAsyncCallIdentifier.value()); -
trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.h
r228260 r228546 64 64 void setAsyncStackTraceDepth(ErrorString&, int depth) final; 65 65 void setBreakpointsActive(ErrorString&, bool active) final; 66 void setBreakpointByUrl(ErrorString&, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<JSON::ArrayOf<Inspector::Protocol::Debugger::Location>>& locations) final;67 void setBreakpoint(ErrorString&, const JSON::Object& location, const JSON::Object* options, Inspector::Protocol::Debugger::BreakpointId*, RefPtr<Inspector::Protocol::Debugger::Location>& actualLocation) final;66 void setBreakpointByUrl(ErrorString&, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const JSON::Object* options, Protocol::Debugger::BreakpointId*, RefPtr<JSON::ArrayOf<Protocol::Debugger::Location>>& locations) final; 67 void setBreakpoint(ErrorString&, const JSON::Object& location, const JSON::Object* options, Protocol::Debugger::BreakpointId*, RefPtr<Protocol::Debugger::Location>& actualLocation) final; 68 68 void removeBreakpoint(ErrorString&, const String& breakpointIdentifier) final; 69 69 void continueUntilNextRunLoop(ErrorString&) final; 70 70 void continueToLocation(ErrorString&, const JSON::Object& location) final; 71 void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&) final;71 void searchInContent(ErrorString&, const String& scriptID, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Protocol::GenericTypes::SearchMatch>>&) final; 72 72 void getScriptSource(ErrorString&, const String& scriptID, String* scriptSource) final; 73 void getFunctionDetails(ErrorString&, const String& functionId, RefPtr< Inspector::Protocol::Debugger::FunctionDetails>&) final;73 void getFunctionDetails(ErrorString&, const String& functionId, RefPtr<Protocol::Debugger::FunctionDetails>&) final; 74 74 void pause(ErrorString&) final; 75 75 void resume(ErrorString&) final; … … 79 79 void setPauseOnExceptions(ErrorString&, const String& pauseState) final; 80 80 void setPauseOnAssertions(ErrorString&, bool enabled) final; 81 void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* const generatePreview, const bool* const saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>*savedResultIndex) final;82 void setOverlayMessage(ErrorString&, const String* const) override;81 void evaluateOnCallFrame(ErrorString&, const String& callFrameId, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) final; 82 void setOverlayMessage(ErrorString&, const String*) override; 83 83 84 84 bool isPaused() const; … … 138 138 139 139 private: 140 Ref<JSON::ArrayOf< Inspector::Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&);140 Ref<JSON::ArrayOf<Protocol::Debugger::CallFrame>> currentCallFrames(const InjectedScript&); 141 141 142 142 void didParseSource(JSC::SourceID, const Script&) final; -
trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.cpp
r225804 r228546 167 167 } 168 168 169 void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview)169 void InspectorHeapAgent::getPreview(ErrorString& errorString, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Protocol::Runtime::ObjectPreview>& objectPreview) 170 170 { 171 171 // Prevent the cell from getting collected as we look it up. … … 216 216 } 217 217 218 void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* const optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)218 void InspectorHeapAgent::getRemoteObject(ErrorString& errorString, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result) 219 219 { 220 220 // Prevent the cell from getting collected as we look it up. … … 251 251 } 252 252 253 static Inspector::Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(CollectionScope scope)253 static Protocol::Heap::GarbageCollection::Type protocolTypeForHeapOperation(CollectionScope scope) 254 254 { 255 255 switch (scope) { 256 256 case CollectionScope::Full: 257 return Inspector::Protocol::Heap::GarbageCollection::Type::Full;257 return Protocol::Heap::GarbageCollection::Type::Full; 258 258 case CollectionScope::Eden: 259 return Inspector::Protocol::Heap::GarbageCollection::Type::Partial;259 return Protocol::Heap::GarbageCollection::Type::Partial; 260 260 } 261 261 ASSERT_NOT_REACHED(); 262 return Inspector::Protocol::Heap::GarbageCollection::Type::Full;262 return Protocol::Heap::GarbageCollection::Type::Full; 263 263 } 264 264 … … 302 302 } 303 303 304 void InspectorHeapAgent::dispatchGarbageCollectedEvent( Inspector::Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime)305 { 306 auto protocolObject = Inspector::Protocol::Heap::GarbageCollection::create()304 void InspectorHeapAgent::dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type type, double startTime, double endTime) 305 { 306 auto protocolObject = Protocol::Heap::GarbageCollection::create() 307 307 .setType(type) 308 308 .setStartTime(startTime) -
trunk/Source/JavaScriptCore/inspector/agents/InspectorHeapAgent.h
r228105 r228546 59 59 void startTracking(ErrorString&) final; 60 60 void stopTracking(ErrorString&) final; 61 void getPreview(ErrorString&, int heapObjectId, Inspector::Protocol::OptOutput<String>* resultString, RefPtr<Inspector::Protocol::Debugger::FunctionDetails>& functionDetails, RefPtr<Inspector::Protocol::Runtime::ObjectPreview>& objectPreview) final;62 void getRemoteObject(ErrorString&, int heapObjectId, const String* const optionalObjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) final;61 void getPreview(ErrorString&, int heapObjectId, std::optional<String>& resultString, RefPtr<Protocol::Debugger::FunctionDetails>&, RefPtr<Protocol::Runtime::ObjectPreview>&) final; 62 void getRemoteObject(ErrorString&, int heapObjectId, const String* optionalObjectGroup, RefPtr<Protocol::Runtime::RemoteObject>& result) final; 63 63 64 64 // HeapObserver … … 69 69 void clearHeapSnapshots(); 70 70 71 virtual void dispatchGarbageCollectedEvent( Inspector::Protocol::Heap::GarbageCollection::Type, double startTime, double endTime);71 virtual void dispatchGarbageCollectedEvent(Protocol::Heap::GarbageCollection::Type, double startTime, double endTime); 72 72 73 73 private: -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.cpp
r228533 r228546 48 48 #include <wtf/JSONValues.h> 49 49 50 namespace Inspector { 51 50 52 using namespace JSC; 51 53 52 namespace Inspector { 53 54 static bool asBool(const bool* const b) 55 { 56 return b ? *b : false; 54 static bool asBool(const bool* b) 55 { 56 return b && *b; 57 57 } 58 58 … … 71 71 static ScriptDebugServer::PauseOnExceptionsState setPauseOnExceptionsState(ScriptDebugServer& scriptDebugServer, ScriptDebugServer::PauseOnExceptionsState newState) 72 72 { 73 ScriptDebugServer::PauseOnExceptionsStatepresentState = scriptDebugServer.pauseOnExceptionsState();73 auto presentState = scriptDebugServer.pauseOnExceptionsState(); 74 74 if (presentState != newState) 75 75 scriptDebugServer.setPauseOnExceptionsState(newState); … … 77 77 } 78 78 79 static Ref< Inspector::Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation)80 { 81 return Inspector::Protocol::Runtime::ErrorRange::create()79 static Ref<Protocol::Runtime::ErrorRange> buildErrorRangeObject(const JSTokenLocation& tokenLocation) 80 { 81 return Protocol::Runtime::ErrorRange::create() 82 82 .setStartOffset(tokenLocation.startOffset) 83 83 .setEndOffset(tokenLocation.endOffset) … … 85 85 } 86 86 87 void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>& range)87 void InspectorRuntimeAgent::parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>& range) 88 88 { 89 89 JSLockHolder lock(m_vm); … … 94 94 switch (error.syntaxErrorType()) { 95 95 case ParserError::SyntaxErrorNone: 96 *result = Inspector::Protocol::Runtime::SyntaxErrorType::None;96 *result = Protocol::Runtime::SyntaxErrorType::None; 97 97 break; 98 98 case ParserError::SyntaxErrorIrrecoverable: 99 *result = Inspector::Protocol::Runtime::SyntaxErrorType::Irrecoverable;99 *result = Protocol::Runtime::SyntaxErrorType::Irrecoverable; 100 100 break; 101 101 case ParserError::SyntaxErrorUnterminatedLiteral: 102 *result = Inspector::Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral;102 *result = Protocol::Runtime::SyntaxErrorType::UnterminatedLiteral; 103 103 break; 104 104 case ParserError::SyntaxErrorRecoverable: 105 *result = Inspector::Protocol::Runtime::SyntaxErrorType::Recoverable;105 *result = Protocol::Runtime::SyntaxErrorType::Recoverable; 106 106 break; 107 107 } 108 108 109 109 if (error.syntaxErrorType() != ParserError::SyntaxErrorNone) { 110 *message = error.message();110 message = error.message(); 111 111 range = buildErrorRangeObject(error.token().m_location); 112 112 } 113 113 } 114 114 115 void InspectorRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* const returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* out_wasThrown, Inspector::Protocol::OptOutput<int>* out_savedResultIndex)115 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) 116 116 { 117 117 InjectedScript injectedScript = injectedScriptForEval(errorString, executionContextId); … … 125 125 muteConsole(); 126 126 127 // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.128 // <https://www.webkit.org/b/180607>129 127 bool wasThrown; 130 std::optional<int> savedResultIndex;131 128 injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : String(), asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), asBool(saveResult), result, wasThrown, savedResultIndex); 132 133 *out_wasThrown = wasThrown; 134 if (savedResultIndex.has_value()) 135 *out_savedResultIndex = savedResultIndex.value(); 129 outWasThrown = wasThrown; 136 130 137 131 if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { … … 141 135 } 142 136 143 void InspectorRuntimeAgent::callFunctionOn(ErrorString& errorString, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* out_wasThrown)137 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) 144 138 { 145 139 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); … … 163 157 injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), asBool(generatePreview), result, wasThrown); 164 158 165 *out_wasThrown = wasThrown;159 outWasThrown = wasThrown; 166 160 167 161 if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { … … 171 165 } 172 166 173 void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& objectId, RefPtr< Inspector::Protocol::Runtime::ObjectPreview>& preview)167 void InspectorRuntimeAgent::getPreview(ErrorString& errorString, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>& preview) 174 168 { 175 169 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); … … 188 182 } 189 183 190 void InspectorRuntimeAgent::getProperties(ErrorString& errorString, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)184 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) 191 185 { 192 186 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); … … 206 200 } 207 201 208 void InspectorRuntimeAgent::getDisplayableProperties(ErrorString& errorString, const String& objectId, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties)202 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) 209 203 { 210 204 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); … … 224 218 } 225 219 226 void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::CollectionEntry>>& entries)220 void InspectorRuntimeAgent::getCollectionEntries(ErrorString& errorString, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries) 227 221 { 228 222 InjectedScript injectedScript = m_injectedScriptManager.injectedScriptForObjectId(objectId); … … 238 232 } 239 233 240 void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, Inspector::Protocol::OptOutput<int>* out_savedResultIndex)234 void InspectorRuntimeAgent::saveResult(ErrorString& errorString, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex) 241 235 { 242 236 InjectedScript injectedScript; … … 255 249 } 256 250 257 // FIXME: remove this bridging code when generated protocol commands no longer use OptOutput<T>.258 // <https://www.webkit.org/b/180607>259 std::optional<int> savedResultIndex;260 261 251 injectedScript.saveResult(errorString, callArgument.toJSONString(), savedResultIndex); 262 263 if (savedResultIndex.has_value())264 *out_savedResultIndex = savedResultIndex.value();265 252 } 266 253 … … 277 264 } 278 265 279 void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const JSON::Array& locations, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::TypeDescription>>& typeDescriptions)266 void InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets(ErrorString& errorString, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>& typeDescriptions) 280 267 { 281 268 static const bool verbose = false; 282 269 283 typeDescriptions = JSON::ArrayOf< Inspector::Protocol::Runtime::TypeDescription>::create();270 typeDescriptions = JSON::ArrayOf<Protocol::Runtime::TypeDescription>::create(); 284 271 if (!m_vm.typeProfiler()) { 285 272 errorString = ASCIILiteral("The VM does not currently have Type Information."); … … 318 305 319 306 bool isValid = typeLocation && typeSet && !typeSet->isEmpty(); 320 auto description = Inspector::Protocol::Runtime::TypeDescription::create()307 auto description = Protocol::Runtime::TypeDescription::create() 321 308 .setIsValid(isValid) 322 309 .release(); … … 392 379 } 393 380 394 void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::BasicBlock>>& basicBlocks)381 void InspectorRuntimeAgent::getBasicBlocks(ErrorString& errorString, const String& sourceIDAsString, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& basicBlocks) 395 382 { 396 383 if (!m_vm.controlFlowProfiler()) { … … 403 390 ASSERT(okay); 404 391 const Vector<BasicBlockRange>& basicBlockRanges = m_vm.controlFlowProfiler()->getBasicBlocksForSourceID(sourceID, m_vm); 405 basicBlocks = JSON::ArrayOf< Inspector::Protocol::Runtime::BasicBlock>::create();392 basicBlocks = JSON::ArrayOf<Protocol::Runtime::BasicBlock>::create(); 406 393 for (const BasicBlockRange& block : basicBlockRanges) { 407 Ref<Inspector::Protocol::Runtime::BasicBlock> location = Inspector::Protocol::Runtime::BasicBlock::create()394 auto location = Protocol::Runtime::BasicBlock::create() 408 395 .setStartOffset(block.m_startOffset) 409 396 .setEndOffset(block.m_endOffset) -
trunk/Source/JavaScriptCore/inspector/agents/InspectorRuntimeAgent.h
r228105 r228546 58 58 void enable(ErrorString&) override { m_enabled = true; } 59 59 void disable(ErrorString&) override { m_enabled = false; } 60 void parse(ErrorString&, const String& expression, Inspector::Protocol::Runtime::SyntaxErrorType* result, Inspector::Protocol::OptOutput<String>* message, RefPtr<Inspector::Protocol::Runtime::ErrorRange>&) final;61 void evaluate(ErrorString&, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const doNotPauseOnExceptionsAndMuteConsole, const int* const executionContextId, const bool* const returnByValue, const bool* const generatePreview, const bool* const saveResult, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>* wasThrown, Inspector::Protocol::OptOutput<int>*savedResultIndex) final;62 void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* const doNotPauseOnExceptionsAndMuteConsole, const bool* const returnByValue, const bool* const generatePreview, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Inspector::Protocol::OptOutput<bool>*wasThrown) final;60 void parse(ErrorString&, const String& expression, Protocol::Runtime::SyntaxErrorType* result, std::optional<String>& message, RefPtr<Protocol::Runtime::ErrorRange>&) final; 61 void evaluate(ErrorString&, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown, std::optional<int>& savedResultIndex) final; 62 void callFunctionOn(ErrorString&, const String& objectId, const String& expression, const JSON::Array* optionalArguments, const bool* doNotPauseOnExceptionsAndMuteConsole, const bool* returnByValue, const bool* generatePreview, RefPtr<Protocol::Runtime::RemoteObject>& result, std::optional<bool>& wasThrown) final; 63 63 void releaseObject(ErrorString&, const ErrorString& objectId) final; 64 void getPreview(ErrorString&, const String& objectId, RefPtr< Inspector::Protocol::Runtime::ObjectPreview>&) final;65 void getProperties(ErrorString&, const String& objectId, const bool* const ownProperties, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;66 void getDisplayableProperties(ErrorString&, const String& objectId, const bool* const generatePreview, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final;67 void getCollectionEntries(ErrorString&, const String& objectId, const String* const objectGroup, const int* const startIndex, const int* const numberToFetch, RefPtr<JSON::ArrayOf<Inspector::Protocol::Runtime::CollectionEntry>>& entries) final;68 void saveResult(ErrorString&, const JSON::Object& callArgument, const int* const executionContextId, Inspector::Protocol::OptOutput<int>*savedResultIndex) final;64 void getPreview(ErrorString&, const String& objectId, RefPtr<Protocol::Runtime::ObjectPreview>&) final; 65 void getProperties(ErrorString&, const String& objectId, const bool* ownProperties, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final; 66 void getDisplayableProperties(ErrorString&, const String& objectId, const bool* generatePreview, RefPtr<JSON::ArrayOf<Protocol::Runtime::PropertyDescriptor>>& result, RefPtr<JSON::ArrayOf<Protocol::Runtime::InternalPropertyDescriptor>>& internalProperties) final; 67 void getCollectionEntries(ErrorString&, const String& objectId, const String* objectGroup, const int* startIndex, const int* numberToFetch, RefPtr<JSON::ArrayOf<Protocol::Runtime::CollectionEntry>>& entries) final; 68 void saveResult(ErrorString&, const JSON::Object& callArgument, const int* executionContextId, std::optional<int>& savedResultIndex) final; 69 69 void releaseObjectGroup(ErrorString&, const String& objectGroup) final; 70 void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::TypeDescription>>&) override;70 void getRuntimeTypesForVariablesAtOffsets(ErrorString&, const JSON::Array& locations, RefPtr<JSON::ArrayOf<Protocol::Runtime::TypeDescription>>&) override; 71 71 void enableTypeProfiler(ErrorString&) override; 72 72 void disableTypeProfiler(ErrorString&) override; 73 73 void enableControlFlowProfiler(ErrorString&) override; 74 74 void disableControlFlowProfiler(ErrorString&) override; 75 void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf< Inspector::Protocol::Runtime::BasicBlock>>& out_basicBlocks) override;75 void getBasicBlocks(ErrorString&, const String& in_sourceID, RefPtr<JSON::ArrayOf<Protocol::Runtime::BasicBlock>>& out_basicBlocks) override; 76 76 77 77 bool enabled() const { return m_enabled; } -
trunk/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.cpp
r225425 r228546 67 67 } 68 68 69 void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* constincludeSamples)69 void InspectorScriptProfilerAgent::startTracking(ErrorString&, const bool* includeSamples) 70 70 { 71 71 if (m_tracking) … … 136 136 } 137 137 138 static Inspector::Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason)138 static Protocol::ScriptProfiler::EventType toProtocol(ProfilingReason reason) 139 139 { 140 140 switch (reason) { 141 141 case ProfilingReason::API: 142 return Inspector::Protocol::ScriptProfiler::EventType::API;142 return Protocol::ScriptProfiler::EventType::API; 143 143 case ProfilingReason::Microtask: 144 return Inspector::Protocol::ScriptProfiler::EventType::Microtask;144 return Protocol::ScriptProfiler::EventType::Microtask; 145 145 case ProfilingReason::Other: 146 return Inspector::Protocol::ScriptProfiler::EventType::Other;146 return Protocol::ScriptProfiler::EventType::Other; 147 147 } 148 148 149 149 ASSERT_NOT_REACHED(); 150 return Inspector::Protocol::ScriptProfiler::EventType::Other;150 return Protocol::ScriptProfiler::EventType::Other; 151 151 } 152 152 … … 155 155 ASSERT(endTime >= startTime); 156 156 157 auto event = Inspector::Protocol::ScriptProfiler::Event::create()157 auto event = Protocol::ScriptProfiler::Event::create() 158 158 .setStartTime(startTime) 159 159 .setEndTime(endTime) -
trunk/Source/JavaScriptCore/inspector/agents/InspectorScriptProfilerAgent.h
r228105 r228546 51 51 52 52 // ScriptProfilerBackendDispatcherHandler 53 void startTracking(ErrorString&, const bool* constincludeSamples) override;53 void startTracking(ErrorString&, const bool* includeSamples) override; 54 54 void stopTracking(ErrorString&) override; 55 55 -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py
r225425 r228546 1 1 #!/usr/bin/env python 2 2 # 3 # Copyright (c) 2014 , 2016Apple Inc. All rights reserved.3 # Copyright (c) 2014-2018 Apple Inc. All rights reserved. 4 4 # Copyright (c) 2014 University of Washington. All rights reserved. 5 5 # … … 143 143 cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) 144 144 if parameter.is_optional: 145 return 'const %s* const' % cpp_name145 return 'const %s*' % cpp_name 146 146 elif _type.raw_name() in ['string']: 147 147 return 'const %s&' % cpp_name … … 166 166 builder_type = CppGenerator.cpp_protocol_type_for_type(_type) 167 167 if is_optional: 168 return 'const %s* const' % builder_type168 return 'const %s*' % builder_type 169 169 elif _type.aliased_type.qualified_name() in ['integer', 'number']: 170 170 return CppGenerator.cpp_name_for_primitive_type(_type.aliased_type) … … 180 180 return 'RefPtr<JSON::Value>' 181 181 elif is_optional: 182 return 'const %s* const' % cpp_name182 return 'const %s*' % cpp_name 183 183 elif _type.qualified_name() in ['string']: 184 184 return 'const %s&' % cpp_name … … 208 208 cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) 209 209 if parameter.is_optional: 210 return " Inspector::Protocol::OptOutput<%s>*" % cpp_name210 return "std::optional<%s>&" % cpp_name 211 211 else: 212 212 return '%s*' % cpp_name … … 234 234 cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) 235 235 if parameter.is_optional: 236 return " Inspector::Protocol::OptOutput<%s>*" % cpp_name236 return "std::optional<%s>&" % cpp_name 237 237 elif _type.qualified_name() in ['integer', 'number']: 238 238 return CppGenerator.cpp_name_for_primitive_type(_type) … … 266 266 return "RefPtr<%s>" % CppGenerator.cpp_name_for_primitive_type(_type) 267 267 elif parameter.is_optional and _type.qualified_name() not in ['boolean', 'string', 'integer']: 268 return " Inspector::Protocol::OptOutput<%s>" % cpp_name268 return "std::optional<%s>" % cpp_name 269 269 else: 270 270 return cpp_name … … 278 278 builder_type = CppGenerator.cpp_protocol_type_for_type(_type) 279 279 if parameter.is_optional: 280 return " Inspector::Protocol::OptOutput<%s>" % builder_type280 return "std::optional<%s>" % builder_type 281 281 return '%s' % builder_type 282 282 if isinstance(_type, PrimitiveType): 283 283 cpp_name = CppGenerator.cpp_name_for_primitive_type(_type) 284 284 if parameter.is_optional: 285 return " Inspector::Protocol::OptOutput<%s>" % cpp_name285 return "std::optional<%s>" % cpp_name 286 286 else: 287 287 return cpp_name -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator_templates.py
r224576 r228546 1 1 #!/usr/bin/env python 2 2 # 3 # Copyright (c) 2014 , 2015Apple Inc. All rights reserved.3 # Copyright (c) 2014-2018 Apple Inc. All rights reserved. 4 4 # Copyright (c) 2014 University of Washington. All rights reserved. 5 5 # … … 129 129 ${dispatchCases} 130 130 else 131 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));131 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found"); 132 132 }""") 133 133 … … 157 157 auto findResult = dispatchMap.get().find(method); 158 158 if (findResult == dispatchMap.get().end()) { 159 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));159 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'${domainName}." + method + "' was not found"); 160 160 return; 161 161 } … … 180 180 """${inParameterDeclarations} 181 181 if (m_backendDispatcher->hasProtocolErrors()) { 182 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method \'%s\' can't be processed", "${domainName}.${commandName}"));182 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method \'${domainName}.${commandName}\' can't be processed" }); 183 183 return; 184 184 } … … 250 250 bool castSucceeded = value->asObject(result); 251 251 ASSERT_UNUSED(castSucceeded, castSucceeded); 252 #if !ASSERT_DISABLED253 252 BindingTraits<${objectType}>::assertValueHasExpectedType(result.get()); 254 #endif // !ASSERT_DISABLED255 253 COMPILE_ASSERT(sizeof(${objectType}) == sizeof(JSON::ObjectBase), type_cast_problem); 256 254 return static_cast<${objectType}*>(static_cast<JSON::ObjectBase*>(result.get())); -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py
r228196 r228546 1 1 #!/usr/bin/env python 2 2 # 3 # Copyright (c) 2014-201 6Apple Inc. All rights reserved.3 # Copyright (c) 2014-2018 Apple Inc. All rights reserved. 4 4 # Copyright (c) 2014 University of Washington. All rights reserved. 5 5 # … … 164 164 if parameter.is_optional: 165 165 if CppGenerator.should_use_wrapper_for_return_type(parameter.type): 166 out_parameter_assignments.append(' if (%(parameterName)s. isAssigned())' % param_args)167 out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s.getValue());' % param_args)166 out_parameter_assignments.append(' if (%(parameterName)s.has_value())' % param_args) 167 out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), *%(parameterName)s);' % param_args) 168 168 else: 169 169 out_parameter_assignments.append(' if (%(parameterName)s)' % param_args) … … 257 257 if parameter.is_optional: 258 258 if CppGenerator.should_use_wrapper_for_return_type(parameter.type): 259 out_parameter_assignments.append(' if (out_%(parameterName)s. isAssigned())' % param_args)260 out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s.getValue());' % param_args)259 out_parameter_assignments.append(' if (out_%(parameterName)s.has_value())' % param_args) 260 out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), *out_%(parameterName)s);' % param_args) 261 261 else: 262 262 out_parameter_assignments.append(' if (out_%(parameterName)s)' % param_args) … … 267 267 out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args) 268 268 269 if CppGenerator.should_pass_by_copy_for_return_type(parameter.type) :269 if CppGenerator.should_pass_by_copy_for_return_type(parameter.type) or parameter.is_optional and CppGenerator.should_use_wrapper_for_return_type(parameter.type): 270 270 method_parameters.append('out_' + parameter.parameter_name) 271 271 else: -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py
r228196 r228546 1 1 #!/usr/bin/env python 2 2 # 3 # Copyright (c) 2014 , 2016Apple Inc. All rights reserved.3 # Copyright (c) 2014-2018 Apple Inc. All rights reserved. 4 4 # Copyright (c) 2014 University of Washington. All rights reserved. 5 5 # … … 366 366 if argument[1]: 367 367 lines.append('static RefPtr<%s> runtimeCast(RefPtr<JSON::Value>&& value);' % argument[0]) 368 lines.append('#if !ASSERT_DISABLED')369 368 lines.append('%s assertValueHasExpectedType(JSON::Value*);' % ' '.join(function_keywords)) 370 lines.append('#endif // !ASSERT_DISABLED')371 369 lines.append('};') 372 370 return '\n'.join(lines) -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py
r228196 r228546 1 1 #!/usr/bin/env python 2 2 # 3 # Copyright (c) 2014 , 2016Apple Inc. All rights reserved.3 # Copyright (c) 2014-2018 Apple Inc. All rights reserved. 4 4 # Copyright (c) 2014 University of Washington. All rights reserved. 5 5 # … … 206 206 lines = [] 207 207 208 lines.append('#if !ASSERT_DISABLED')209 208 lines.append('void BindingTraits<%s>::assertValueHasExpectedType(JSON::Value* value)' % (CppGenerator.cpp_protocol_type_for_type(object_declaration.type))) 210 209 lines.append("""{ 210 #if ASSERT_DISABLED 211 UNUSED_PARAM(value); 212 #else 211 213 ASSERT_ARG(value, value); 212 214 RefPtr<JSON::Object> object; … … 220 222 221 223 lines.append(""" { 222 JSON::Object::iterator%(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));224 auto %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s")); 223 225 ASSERT(%(memberName)sPos != object->end()); 224 226 %(assertMethod)s(%(memberName)sPos->value.get()); … … 236 238 237 239 lines.append(""" { 238 JSON::Object::iterator%(memberName)sPos = object->find(ASCIILiteral("%(memberName)s"));240 auto %(memberName)sPos = object->find(ASCIILiteral("%(memberName)s")); 239 241 if (%(memberName)sPos != object->end()) { 240 242 %(assertMethod)s(%(memberName)sPos->value.get());""" % args) … … 248 250 lines.append(' if (foundPropertiesCount != object->size())') 249 251 lines.append(' FATAL("Unexpected properties in object: %s\\n", object->toJSONString().ascii().data());') 252 lines.append('#endif // !ASSERT_DISABLED') 250 253 lines.append('}') 251 lines.append('#endif // !ASSERT_DISABLED')252 254 return '\n'.join(lines) 253 255 254 256 def _generate_assertion_for_enum(self, enum_member, object_declaration): 255 257 lines = [] 256 lines.append('#if !ASSERT_DISABLED')257 258 lines.append('void %s(JSON::Value* value)' % CppGenerator.cpp_assertion_method_for_type_member(enum_member, object_declaration)) 258 259 lines.append('{') 260 lines.append('#if ASSERT_DISABLED') 261 lines.append(' UNUSED_PARAM(value);') 262 lines.append('#else') 259 263 lines.append(' ASSERT_ARG(value, value);') 260 264 lines.append(' String result;') … … 264 268 assert_condition = ' || '.join(['result == "%s"' % enum_value for enum_value in enum_member.type.enum_values()]) 265 269 lines.append(' ASSERT(%s);' % assert_condition) 270 lines.append('#endif // !ASSERT_DISABLED') 266 271 lines.append('}') 267 lines.append('#endif // !ASSERT_DISABLED')268 272 269 273 return '\n'.join(lines) -
trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py
r225231 r228546 1 1 #!/usr/bin/env python 2 2 # 3 # Copyright (c) 2014-201 6Apple Inc. All rights reserved.3 # Copyright (c) 2014-2018 Apple Inc. All rights reserved. 4 4 # Copyright (c) 2014 University of Washington. All rights reserved. 5 5 # … … 178 178 if isinstance(parameter.type, EnumType): 179 179 lines.append(' if (!%s) {' % objc_in_param_name) 180 lines.append(' backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter \'%%s\' of method \'%%s\' cannot be processed", "%s", "%s.%s"));' % (parameter.parameter_name, domain.domain_name, command.command_name))180 lines.append(' backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter \'%s\' of method \'%s.%s\' cannot be processed" });' % (parameter.parameter_name, domain.domain_name, command.command_name)) 181 181 lines.append(' return;') 182 182 lines.append(' }') -
trunk/Source/JavaScriptCore/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result
r228196 r228546 239 239 loadResource(requestId, WTFMove(parameters)); 240 240 else 241 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network", '.', method, "' was not found"));241 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found"); 242 242 } 243 243 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result
r228196 r228546 158 158 Black = 6, 159 159 }; // enum class PrintColor 160 virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<JSON::Object>* opt_out_values, Inspector::Protocol::OptOutput<JSON::Value>* opt_out_payload, Inspector::Protocol::OptOutput<int>*opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;160 virtual void executeSQLSyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, std::optional<String>& opt_out_notes, std::optional<double>& opt_out_timestamp, std::optional<JSON::Object>& opt_out_values, std::optional<JSON::Value>& opt_out_payload, std::optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; 161 161 class ExecuteSQLAsyncOptionalReturnValuesCallback : public BackendDispatcher::CallbackBase { 162 162 public: 163 163 ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&&, int id); 164 void sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<JSON::Object>* values, Inspector::Protocol::OptOutput<JSON::Value>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>*printColor);164 void sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, std::optional<String>& notes, std::optional<double>& timestamp, std::optional<JSON::Object>& values, std::optional<JSON::Value>& payload, std::optional<int>& databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, std::optional<String>& screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, std::optional<String>& printColor); 165 165 }; 166 166 virtual void executeSQLAsyncOptionalReturnValues(ErrorString&, int in_databaseId, const String& in_query, Ref<ExecuteSQLAsyncOptionalReturnValuesCallback>&& callback) = 0; … … 274 274 executeSQLAsync(requestId, WTFMove(parameters)); 275 275 else 276 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));276 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found"); 277 277 } 278 278 … … 282 282 String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); 283 283 if (m_backendDispatcher->hasProtocolErrors()) { 284 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSyncOptionalReturnValues"));284 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLSyncOptionalReturnValues' can't be processed" }); 285 285 return; 286 286 } … … 296 296 Ref<JSON::Object> result = JSON::Object::create(); 297 297 RefPtr<JSON::ArrayOf<String>> out_columnNames; 298 Inspector::Protocol::OptOutput<String> out_notes;299 Inspector::Protocol::OptOutput<double> out_timestamp;300 Inspector::Protocol::OptOutput<JSON::Object> out_values;301 Inspector::Protocol::OptOutput<JSON::Value> out_payload;302 Inspector::Protocol::OptOutput<int> out_databaseId;298 std::optional<String> out_notes; 299 std::optional<double> out_timestamp; 300 std::optional<JSON::Object> out_values; 301 std::optional<JSON::Value> out_payload; 302 std::optional<int> out_databaseId; 303 303 RefPtr<Inspector::Protocol::Database::Error> out_sqlError; 304 304 Inspector::Protocol::Database::PrimaryColors out_screenColor; 305 305 RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors; 306 306 DatabaseBackendDispatcherHandler::PrintColor out_printColor; 307 m_agent->executeSQLSyncOptionalReturnValues(error, in_databaseId, in_query, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);307 m_agent->executeSQLSyncOptionalReturnValues(error, in_databaseId, in_query, out_columnNames, out_notes, out_timestamp, out_values, out_payload, out_databaseId, out_sqlError, out_screenColor, out_alternateColors, out_printColor); 308 308 309 309 if (!error.length()) { 310 310 if (out_columnNames) 311 311 result->setArray(ASCIILiteral("columnNames"), out_columnNames); 312 if (out_notes. isAssigned())313 result->setString(ASCIILiteral("notes"), out_notes.getValue());314 if (out_timestamp. isAssigned())315 result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());316 if (out_values. isAssigned())317 result->setObject(ASCIILiteral("values"), out_values.getValue());318 if (out_payload. isAssigned())319 result->setValue(ASCIILiteral("payload"), out_payload.getValue());320 if (out_databaseId. isAssigned())321 result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());312 if (out_notes.has_value()) 313 result->setString(ASCIILiteral("notes"), *out_notes); 314 if (out_timestamp.has_value()) 315 result->setDouble(ASCIILiteral("timestamp"), *out_timestamp); 316 if (out_values.has_value()) 317 result->setObject(ASCIILiteral("values"), *out_values); 318 if (out_payload.has_value()) 319 result->setValue(ASCIILiteral("payload"), *out_payload); 320 if (out_databaseId.has_value()) 321 result->setInteger(ASCIILiteral("databaseId"), *out_databaseId); 322 322 if (out_sqlError) 323 323 result->setObject(ASCIILiteral("sqlError"), out_sqlError); 324 if (out_screenColor. isAssigned())325 result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());324 if (out_screenColor.has_value()) 325 result->setString(ASCIILiteral("screenColor"), *out_screenColor); 326 326 if (out_alternateColors) 327 327 result->setArray(ASCIILiteral("alternateColors"), out_alternateColors); 328 if (out_printColor. isAssigned())329 result->setString(ASCIILiteral("printColor"), out_printColor.getValue());328 if (out_printColor.has_value()) 329 result->setString(ASCIILiteral("printColor"), *out_printColor); 330 330 } 331 331 if (!error.length()) … … 337 337 DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::ExecuteSQLAsyncOptionalReturnValuesCallback(Ref<BackendDispatcher>&& backendDispatcher, int id) : BackendDispatcher::CallbackBase(WTFMove(backendDispatcher), id) { } 338 338 339 void DatabaseBackendDispatcherHandler::ExecuteSQLAsyncOptionalReturnValuesCallback::sendSuccess(RefPtr<JSON::ArrayOf<String>>&& columnNames, Inspector::Protocol::OptOutput<String>* notes, Inspector::Protocol::OptOutput<double>* timestamp, Inspector::Protocol::OptOutput<JSON::Object>* values, Inspector::Protocol::OptOutput<JSON::Value>* payload, Inspector::Protocol::OptOutput<int>* databaseId, RefPtr<Inspector::Protocol::Database::Error>&& sqlError, Inspector::Protocol::OptOutput<String>* screenColor, RefPtr<Inspector::Protocol::Database::ColorList>&& alternateColors, Inspector::Protocol::OptOutput<String>*printColor)339 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) 340 340 { 341 341 Ref<JSON::Object> jsonMessage = JSON::Object::create(); 342 342 if (columnNames) 343 343 jsonMessage->setArray(ASCIILiteral("columnNames"), columnNames); 344 if (notes. isAssigned())345 jsonMessage->setString(ASCIILiteral("notes"), notes.getValue());346 if (timestamp. isAssigned())347 jsonMessage->setDouble(ASCIILiteral("timestamp"), timestamp.getValue());348 if (values. isAssigned())349 jsonMessage->setObject(ASCIILiteral("values"), values.getValue());350 if (payload. isAssigned())351 jsonMessage->setValue(ASCIILiteral("payload"), payload.getValue());352 if (databaseId. isAssigned())353 jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId.getValue());344 if (notes.has_value()) 345 jsonMessage->setString(ASCIILiteral("notes"), *notes); 346 if (timestamp.has_value()) 347 jsonMessage->setDouble(ASCIILiteral("timestamp"), *timestamp); 348 if (values.has_value()) 349 jsonMessage->setObject(ASCIILiteral("values"), *values); 350 if (payload.has_value()) 351 jsonMessage->setValue(ASCIILiteral("payload"), *payload); 352 if (databaseId.has_value()) 353 jsonMessage->setInteger(ASCIILiteral("databaseId"), *databaseId); 354 354 if (sqlError) 355 355 jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError); 356 if (screenColor. isAssigned())357 jsonMessage->setString(ASCIILiteral("screenColor"), screenColor.getValue());356 if (screenColor.has_value()) 357 jsonMessage->setString(ASCIILiteral("screenColor"), *screenColor); 358 358 if (alternateColors) 359 359 jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors); 360 if (printColor. isAssigned())361 jsonMessage->setString(ASCIILiteral("printColor"), printColor.getValue());360 if (printColor.has_value()) 361 jsonMessage->setString(ASCIILiteral("printColor"), *printColor); 362 362 CallbackBase::sendSuccess(WTFMove(jsonMessage)); 363 363 } … … 368 368 String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); 369 369 if (m_backendDispatcher->hasProtocolErrors()) { 370 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsyncOptionalReturnValues"));370 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLAsyncOptionalReturnValues' can't be processed" }); 371 371 return; 372 372 } … … 396 396 String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); 397 397 if (m_backendDispatcher->hasProtocolErrors()) { 398 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLSync"));398 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLSync' can't be processed" }); 399 399 return; 400 400 } … … 462 462 String in_query = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("query"), nullptr); 463 463 if (m_backendDispatcher->hasProtocolErrors()) { 464 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeSQLAsync"));464 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeSQLAsync' can't be processed" }); 465 465 return; 466 466 } -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result
r228196 r228546 90 90 public: 91 91 virtual ~AlternateDatabaseBackendDispatcher() { } 92 virtual void executeAllOptionalParameters(long callId, const JSON::Array* in_columnNames, const String* const in_notes, const double* const in_timestamp, const JSON::Object* in_values, const JSON::Value* const in_payload, const int* const in_databaseId, const JSON::Object* in_sqlError, const String* const in_screenColor, const JSON::Array* in_alternateColors, const String* constin_printColor) = 0;92 virtual void executeAllOptionalParameters(long callId, const JSON::Array* in_columnNames, const String* in_notes, const double* in_timestamp, const JSON::Object* in_values, const JSON::Value* in_payload, const int* in_databaseId, const JSON::Object* in_sqlError, const String* in_screenColor, const JSON::Array* in_alternateColors, const String* in_printColor) = 0; 93 93 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; 94 94 }; … … 153 153 Black = 6, 154 154 }; // enum class PrintColor 155 virtual void executeAllOptionalParameters(ErrorString&, const JSON::Array* opt_in_columnNames, const String* const opt_in_notes, const double* const opt_in_timestamp, const JSON::Object* opt_in_values, const JSON::Value* const opt_in_payload, const int* const opt_in_databaseId, const JSON::Object* opt_in_sqlError, const String* const opt_in_screenColor, const JSON::Array* opt_in_alternateColors, const String* const opt_in_printColor, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, Inspector::Protocol::OptOutput<String>* opt_out_notes, Inspector::Protocol::OptOutput<double>* opt_out_timestamp, Inspector::Protocol::OptOutput<JSON::Object>* opt_out_values, Inspector::Protocol::OptOutput<JSON::Value>* opt_out_payload, Inspector::Protocol::OptOutput<int>*opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0;155 virtual void executeAllOptionalParameters(ErrorString&, const JSON::Array* opt_in_columnNames, const String* opt_in_notes, const double* opt_in_timestamp, const JSON::Object* opt_in_values, const JSON::Value* opt_in_payload, const int* opt_in_databaseId, const JSON::Object* opt_in_sqlError, const String* opt_in_screenColor, const JSON::Array* opt_in_alternateColors, const String* opt_in_printColor, RefPtr<JSON::ArrayOf<String>>& opt_out_columnNames, std::optional<String>& opt_out_notes, std::optional<double>& opt_out_timestamp, std::optional<JSON::Object>& opt_out_values, std::optional<JSON::Value>& opt_out_payload, std::optional<int>& opt_out_databaseId, RefPtr<Inspector::Protocol::Database::Error>& opt_out_sqlError, Inspector::Protocol::Database::PrimaryColors* opt_out_screenColor, RefPtr<Inspector::Protocol::Database::ColorList>& opt_out_alternateColors, DatabaseBackendDispatcherHandler::PrintColor* opt_out_printColor) = 0; 156 156 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; 157 157 protected: … … 251 251 executeNoOptionalParameters(requestId, WTFMove(parameters)); 252 252 else 253 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Database", '.', method, "' was not found"));253 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Database." + method + "' was not found"); 254 254 } 255 255 … … 261 261 String opt_in_notes = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("notes"), &opt_in_notes_valueFound); 262 262 bool opt_in_timestamp_valueFound = false; 263 Inspector::Protocol::OptOutput<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound);263 std::optional<double> opt_in_timestamp = m_backendDispatcher->getDouble(parameters.get(), ASCIILiteral("timestamp"), &opt_in_timestamp_valueFound); 264 264 bool opt_in_values_valueFound = false; 265 265 RefPtr<JSON::Object> opt_in_values = m_backendDispatcher->getObject(parameters.get(), ASCIILiteral("values"), &opt_in_values_valueFound); … … 277 277 String opt_in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), &opt_in_printColor_valueFound); 278 278 if (m_backendDispatcher->hasProtocolErrors()) { 279 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeAllOptionalParameters"));279 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeAllOptionalParameters' can't be processed" }); 280 280 return; 281 281 } … … 291 291 Ref<JSON::Object> result = JSON::Object::create(); 292 292 RefPtr<JSON::ArrayOf<String>> out_columnNames; 293 Inspector::Protocol::OptOutput<String> out_notes;294 Inspector::Protocol::OptOutput<double> out_timestamp;295 Inspector::Protocol::OptOutput<JSON::Object> out_values;296 Inspector::Protocol::OptOutput<JSON::Value> out_payload;297 Inspector::Protocol::OptOutput<int> out_databaseId;293 std::optional<String> out_notes; 294 std::optional<double> out_timestamp; 295 std::optional<JSON::Object> out_values; 296 std::optional<JSON::Value> out_payload; 297 std::optional<int> out_databaseId; 298 298 RefPtr<Inspector::Protocol::Database::Error> out_sqlError; 299 299 Inspector::Protocol::Database::PrimaryColors out_screenColor; 300 300 RefPtr<Inspector::Protocol::Database::ColorList> out_alternateColors; 301 301 DatabaseBackendDispatcherHandler::PrintColor out_printColor; 302 m_agent->executeAllOptionalParameters(error, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr, out_columnNames, &out_notes, &out_timestamp, out_values, &out_payload, &out_databaseId, out_sqlError, &out_screenColor, out_alternateColors, &out_printColor);302 m_agent->executeAllOptionalParameters(error, opt_in_columnNames_valueFound ? opt_in_columnNames.get() : nullptr, opt_in_notes_valueFound ? &opt_in_notes : nullptr, opt_in_timestamp_valueFound ? &opt_in_timestamp : nullptr, opt_in_values_valueFound ? opt_in_values.get() : nullptr, opt_in_payload_valueFound ? opt_in_payload.get() : nullptr, opt_in_databaseId_valueFound ? &opt_in_databaseId : nullptr, opt_in_sqlError_valueFound ? opt_in_sqlError.get() : nullptr, opt_in_screenColor_valueFound ? &opt_in_screenColor : nullptr, opt_in_alternateColors_valueFound ? opt_in_alternateColors.get() : nullptr, opt_in_printColor_valueFound ? &opt_in_printColor : nullptr, out_columnNames, out_notes, out_timestamp, out_values, out_payload, out_databaseId, out_sqlError, out_screenColor, out_alternateColors, out_printColor); 303 303 304 304 if (!error.length()) { 305 305 if (out_columnNames) 306 306 result->setArray(ASCIILiteral("columnNames"), out_columnNames); 307 if (out_notes. isAssigned())308 result->setString(ASCIILiteral("notes"), out_notes.getValue());309 if (out_timestamp. isAssigned())310 result->setDouble(ASCIILiteral("timestamp"), out_timestamp.getValue());311 if (out_values. isAssigned())312 result->setObject(ASCIILiteral("values"), out_values.getValue());313 if (out_payload. isAssigned())314 result->setValue(ASCIILiteral("payload"), out_payload.getValue());315 if (out_databaseId. isAssigned())316 result->setInteger(ASCIILiteral("databaseId"), out_databaseId.getValue());307 if (out_notes.has_value()) 308 result->setString(ASCIILiteral("notes"), *out_notes); 309 if (out_timestamp.has_value()) 310 result->setDouble(ASCIILiteral("timestamp"), *out_timestamp); 311 if (out_values.has_value()) 312 result->setObject(ASCIILiteral("values"), *out_values); 313 if (out_payload.has_value()) 314 result->setValue(ASCIILiteral("payload"), *out_payload); 315 if (out_databaseId.has_value()) 316 result->setInteger(ASCIILiteral("databaseId"), *out_databaseId); 317 317 if (out_sqlError) 318 318 result->setObject(ASCIILiteral("sqlError"), out_sqlError); 319 if (out_screenColor. isAssigned())320 result->setString(ASCIILiteral("screenColor"), out_screenColor.getValue());319 if (out_screenColor.has_value()) 320 result->setString(ASCIILiteral("screenColor"), *out_screenColor); 321 321 if (out_alternateColors) 322 322 result->setArray(ASCIILiteral("alternateColors"), out_alternateColors); 323 if (out_printColor. isAssigned())324 result->setString(ASCIILiteral("printColor"), out_printColor.getValue());323 if (out_printColor.has_value()) 324 result->setString(ASCIILiteral("printColor"), *out_printColor); 325 325 } 326 326 if (!error.length()) … … 343 343 String in_printColor = m_backendDispatcher->getString(parameters.get(), ASCIILiteral("printColor"), nullptr); 344 344 if (m_backendDispatcher->hasProtocolErrors()) { 345 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Some arguments of method '%s' can't be processed", "Database.executeNoOptionalParameters"));345 m_backendDispatcher->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Some arguments of method 'Database.executeNoOptionalParameters' can't be processed" }); 346 346 return; 347 347 } … … 764 764 public: 765 765 ObjCInspectorDatabaseBackendDispatcher(id<TestProtocolDatabaseDomainHandler> handler) { m_delegate = handler; } 766 virtual void executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* const in_notes, const double* const in_timestamp, const JSON::Object* in_values, const JSON::Value* const in_payload, const int* const in_databaseId, const JSON::Object* in_sqlError, const String* const in_screenColor, const JSON::Array* in_alternateColors, const String* constin_printColor) override;766 virtual void executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* in_notes, const double* in_timestamp, const JSON::Object* in_values, const JSON::Value* in_payload, const int* in_databaseId, const JSON::Object* in_sqlError, const String* in_screenColor, const JSON::Array* in_alternateColors, const String* in_printColor) override; 767 767 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; 768 768 private: … … 814 814 namespace Inspector { 815 815 816 void ObjCInspectorDatabaseBackendDispatcher::executeAllOptionalParameters(long requestId, const JSON::Array* in_columnNames, const String* const in_notes, const double* const in_timestamp, const JSON::Object* in_values, const JSON::Value* const in_payload, const int* const in_databaseId, const JSON::Object* in_sqlError, const String* const in_screenColor, const JSON::Array* in_alternateColors, const String* constin_printColor)816 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) 817 817 { 818 818 id errorCallback = ^(NSString *error) { … … 923 923 std::optional<TestProtocolDatabasePrimaryColors> o_in_screenColor = fromProtocolString<TestProtocolDatabasePrimaryColors>(in_screenColor); 924 924 if (!o_in_screenColor) { 925 backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' of method '%s' cannot be processed", "screenColor", "Database.executeNoOptionalParameters"));925 backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter 'screenColor' of method 'Database.executeNoOptionalParameters' cannot be processed" }); 926 926 return; 927 927 } … … 929 929 std::optional<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor> o_in_printColor = fromProtocolString<TestProtocolDatabaseExecuteNoOptionalParametersPrintColor>(in_printColor); 930 930 if (!o_in_printColor) { 931 backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, String::format("Parameter '%s' of method '%s' cannot be processed", "printColor", "Database.executeNoOptionalParameters"));931 backendDispatcher()->reportProtocolError(BackendDispatcher::InvalidParams, ASCIILiteral { "Parameter 'printColor' of method 'Database.executeNoOptionalParameters' cannot be processed" }); 932 932 return; 933 933 } -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domain-availability.json-result
r228196 r228546 272 272 enable(requestId, WTFMove(parameters)); 273 273 else 274 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainA", '.', method, "' was not found"));274 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainA." + method + "' was not found"); 275 275 } 276 276 … … 316 316 enable(requestId, WTFMove(parameters)); 317 317 else 318 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainB", '.', method, "' was not found"));318 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainB." + method + "' was not found"); 319 319 } 320 320 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result
r228196 r228546 296 296 loadResource1(requestId, WTFMove(parameters)); 297 297 else 298 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));298 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network1." + method + "' was not found"); 299 299 } 300 300 … … 360 360 auto findResult = dispatchMap.get().find(method); 361 361 if (findResult == dispatchMap.get().end()) { 362 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network3", '.', method, "' was not found"));362 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network3." + method + "' was not found"); 363 363 return; 364 364 } -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/enum-values.json-result
r228196 r228546 254 254 commandWithEnumReturnValue(requestId, WTFMove(parameters)); 255 255 else 256 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "CommandDomain", '.', method, "' was not found"));256 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'CommandDomain." + method + "' was not found"); 257 257 } 258 258 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result
r228196 r228546 235 235 public: 236 236 DatabaseFrontendDispatcher(FrontendRouter& frontendRouter) : m_frontendRouter(frontendRouter) { } 237 void didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* const screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* constprintColor);237 void didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* notes, const double* timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* printColor); 238 238 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); 239 239 private: … … 283 283 namespace Inspector { 284 284 285 void DatabaseFrontendDispatcher::didExecuteOptionalParameters(RefPtr<JSON::ArrayOf<String>> columnNames, const String* const notes, const double* const timestamp, RefPtr<JSON::Object> values, RefPtr<JSON::Value> payload, RefPtr<Inspector::Protocol::Database::Error> sqlError, const String* const screenColor, RefPtr<Inspector::Protocol::Database::ColorList> alternateColors, const String* constprintColor)285 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) 286 286 { 287 287 Ref<JSON::Object> jsonMessage = JSON::Object::create(); -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result
r228196 r228546 253 253 loadResource(requestId, WTFMove(parameters)); 254 254 else 255 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network1", '.', method, "' was not found"));255 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network1." + method + "' was not found"); 256 256 } 257 257 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result
r228196 r228546 560 560 561 561 template<> struct BindingTraits<Inspector::Protocol::Test::CastedAnimals> { 562 #if !ASSERT_DISABLED563 562 static void assertValueHasExpectedType(JSON::Value*); 564 #endif // !ASSERT_DISABLED565 563 }; 566 564 template<> struct BindingTraits<Inspector::Protocol::Test::TypeNeedingCast> { 567 565 static RefPtr<Inspector::Protocol::Test::TypeNeedingCast> runtimeCast(RefPtr<JSON::Value>&& value); 568 #if !ASSERT_DISABLED569 566 static void assertValueHasExpectedType(JSON::Value*); 570 #endif // !ASSERT_DISABLED571 567 }; 572 568 template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject1> { 573 #if !ASSERT_DISABLED574 569 static void assertValueHasExpectedType(JSON::Value*); 575 #endif // !ASSERT_DISABLED576 570 }; 577 571 template<> struct BindingTraits<Inspector::Protocol::Test::RecursiveObject2> { 578 #if !ASSERT_DISABLED579 572 static void assertValueHasExpectedType(JSON::Value*); 580 #endif // !ASSERT_DISABLED581 573 }; 582 574 … … 694 686 695 687 696 #if !ASSERT_DISABLED697 688 void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(JSON::Value* value) 698 689 { 690 #if ASSERT_DISABLED 691 UNUSED_PARAM(value); 692 #else 699 693 ASSERT_ARG(value, value); 700 694 String result; … … 702 696 ASSERT(castSucceeded); 703 697 ASSERT(result == "Ducks" || result == "Hens" || result == "Crows" || result == "Flamingos"); 704 }705 698 #endif // !ASSERT_DISABLED 706 707 #if !ASSERT_DISABLED 699 } 700 708 701 void BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(JSON::Value* value) 709 702 { 703 #if ASSERT_DISABLED 704 UNUSED_PARAM(value); 705 #else 710 706 ASSERT_ARG(value, value); 711 707 RefPtr<JSON::Object> object; … … 713 709 ASSERT_UNUSED(castSucceeded, castSucceeded); 714 710 { 715 JSON::Object::iteratorstringPos = object->find(ASCIILiteral("string"));711 auto stringPos = object->find(ASCIILiteral("string")); 716 712 ASSERT(stringPos != object->end()); 717 713 BindingTraits<String>::assertValueHasExpectedType(stringPos->value.get()); 718 714 } 719 715 { 720 JSON::Object::iteratornumberPos = object->find(ASCIILiteral("number"));716 auto numberPos = object->find(ASCIILiteral("number")); 721 717 ASSERT(numberPos != object->end()); 722 718 BindingTraits<int>::assertValueHasExpectedType(numberPos->value.get()); 723 719 } 724 720 { 725 JSON::Object::iteratoranimalsPos = object->find(ASCIILiteral("animals"));721 auto animalsPos = object->find(ASCIILiteral("animals")); 726 722 ASSERT(animalsPos != object->end()); 727 723 BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(animalsPos->value.get()); 728 724 } 729 725 { 730 JSON::Object::iteratoridPos = object->find(ASCIILiteral("id"));726 auto idPos = object->find(ASCIILiteral("id")); 731 727 ASSERT(idPos != object->end()); 732 728 BindingTraits<int>::assertValueHasExpectedType(idPos->value.get()); 733 729 } 734 730 { 735 JSON::Object::iteratortreePos = object->find(ASCIILiteral("tree"));731 auto treePos = object->find(ASCIILiteral("tree")); 736 732 ASSERT(treePos != object->end()); 737 733 BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(treePos->value.get()); … … 741 737 if (foundPropertiesCount != object->size()) 742 738 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data()); 743 }744 739 #endif // !ASSERT_DISABLED 740 } 745 741 746 742 RefPtr<Inspector::Protocol::Test::TypeNeedingCast> BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::runtimeCast(RefPtr<JSON::Value>&& value) … … 749 745 bool castSucceeded = value->asObject(result); 750 746 ASSERT_UNUSED(castSucceeded, castSucceeded); 751 #if !ASSERT_DISABLED752 747 BindingTraits<Inspector::Protocol::Test::TypeNeedingCast>::assertValueHasExpectedType(result.get()); 753 #endif // !ASSERT_DISABLED754 748 COMPILE_ASSERT(sizeof(Inspector::Protocol::Test::TypeNeedingCast) == sizeof(JSON::ObjectBase), type_cast_problem); 755 749 return static_cast<Inspector::Protocol::Test::TypeNeedingCast*>(static_cast<JSON::ObjectBase*>(result.get())); … … 757 751 758 752 759 #if !ASSERT_DISABLED760 753 void BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(JSON::Value* value) 761 754 { 755 #if ASSERT_DISABLED 756 UNUSED_PARAM(value); 757 #else 762 758 ASSERT_ARG(value, value); 763 759 RefPtr<JSON::Object> object; … … 767 763 int foundPropertiesCount = 0; 768 764 { 769 JSON::Object::iteratorobjPos = object->find(ASCIILiteral("obj"));765 auto objPos = object->find(ASCIILiteral("obj")); 770 766 if (objPos != object->end()) { 771 767 BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(objPos->value.get()); … … 775 771 if (foundPropertiesCount != object->size()) 776 772 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data()); 777 }778 773 #endif // !ASSERT_DISABLED 779 780 #if !ASSERT_DISABLED 774 } 775 781 776 void BindingTraits<Inspector::Protocol::Test::RecursiveObject2>::assertValueHasExpectedType(JSON::Value* value) 782 777 { 778 #if ASSERT_DISABLED 779 UNUSED_PARAM(value); 780 #else 783 781 ASSERT_ARG(value, value); 784 782 RefPtr<JSON::Object> object; … … 788 786 int foundPropertiesCount = 0; 789 787 { 790 JSON::Object::iteratorobjPos = object->find(ASCIILiteral("obj"));788 auto objPos = object->find(ASCIILiteral("obj")); 791 789 if (objPos != object->end()) { 792 790 BindingTraits<Inspector::Protocol::Test::RecursiveObject1>::assertValueHasExpectedType(objPos->value.get()); … … 796 794 if (foundPropertiesCount != object->size()) 797 795 FATAL("Unexpected properties in object: %s\n", object->toJSONString().ascii().data()); 798 }799 796 #endif // !ASSERT_DISABLED 797 } 800 798 801 799 } // namespace Protocol -
trunk/Source/JavaScriptCore/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result
r228196 r228546 273 273 enable(requestId, WTFMove(parameters)); 274 274 else 275 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainA", '.', method, "' was not found"));275 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainA." + method + "' was not found"); 276 276 } 277 277 … … 317 317 enable(requestId, WTFMove(parameters)); 318 318 else 319 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "DomainB", '.', method, "' was not found"));319 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'DomainB." + method + "' was not found"); 320 320 } 321 321 -
trunk/Source/JavaScriptCore/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result
r228196 r228546 239 239 loadResource(requestId, WTFMove(parameters)); 240 240 else 241 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, makeString('\'', "Network", '.', method, "' was not found"));241 m_backendDispatcher->reportProtocolError(BackendDispatcher::MethodNotFound, "'Network." + method + "' was not found"); 242 242 } 243 243 -
trunk/Source/WebCore/ChangeLog
r228545 r228546 1 2018-02-15 Darin Adler <darin@apple.com> 2 3 Web Inspector: get rid of remaining uses of OptOutput<T> 4 https://bugs.webkit.org/show_bug.cgi?id=180607 5 6 Reviewed by Brian Burg. 7 8 * inspector/InspectorStyleSheet.cpp: 9 (WebCore::buildSourceRangeObject): Take a const Vector& instead of a Vector*. 10 (WebCore::InspectorStyle::buildObjectForStyle const): Pass lineEndings() instead 11 of lineEndings().get(). 12 (WebCore::InspectorStyle::styleWithProperties const): Ditto. 13 (WebCore::InspectorStyleSheet::buildObjectForSelectorList): Ditto. 14 (WebCore::InspectorStyleSheet::lineEndings const): Return a Vector instead of 15 a std::unique_ptr<Vector>. 16 (WebCore::InspectorStyleSheetForInlineStyle::lineEndings const): Ditto. 17 * inspector/InspectorStyleSheet.h: Updated for the above. 18 19 * inspector/agents/InspectorCSSAgent.h: Removed some bogus const. 20 * inspector/agents/InspectorCanvasAgent.cpp: Ditto. 21 * inspector/agents/InspectorCanvasAgent.h: Ditto. 22 23 * inspector/agents/InspectorDOMDebuggerAgent.cpp: Improved type of global strings 24 so we don't waste space with a pointer to the string. 25 (WebCore::InspectorDOMDebuggerAgent::setEventListenerBreakpoint): Removed 26 explicit creation of String, which was wasteful and unnecessary. 27 (WebCore::InspectorDOMDebuggerAgent::setInstrumentationBreakpoint): Ditto. 28 (WebCore::InspectorDOMDebuggerAgent::removeEventListenerBreakpoint): Ditto. 29 (WebCore::InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint): Ditto. 30 (WebCore::InspectorDOMDebuggerAgent::setXHRBreakpoint): Removed bogus const. 31 32 * inspector/agents/InspectorDOMDebuggerAgent.h: Removed bogus const and use 33 final instead of override. 34 * inspector/agents/InspectorPageAgent.cpp: Ditto. 35 * inspector/agents/InspectorPageAgent.h: Ditto. 36 1 37 2018-02-15 Chris Dumez <cdumez@apple.com> 2 38 -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r228218 r228546 386 386 }; 387 387 388 static RefPtr<Inspector::Protocol::CSS::SourceRange> buildSourceRangeObject(const SourceRange& range, Vector<size_t>*lineEndings, int* endingLine = nullptr)389 { 390 if ( !lineEndings)388 static RefPtr<Inspector::Protocol::CSS::SourceRange> buildSourceRangeObject(const SourceRange& range, const Vector<size_t>& lineEndings, int* endingLine = nullptr) 389 { 390 if (lineEndings.isEmpty()) 391 391 return nullptr; 392 TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, *lineEndings); 393 TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, *lineEndings); 392 393 TextPosition start = ContentSearchUtilities::textPositionFromOffset(range.start, lineEndings); 394 TextPosition end = ContentSearchUtilities::textPositionFromOffset(range.end, lineEndings); 394 395 395 396 if (endingLine) … … 544 545 RefPtr<CSSRuleSourceData> sourceData = extractSourceData(); 545 546 if (sourceData) 546 result->setRange(buildSourceRangeObject(sourceData->ruleBodyRange, m_parentStyleSheet->lineEndings() .get()));547 result->setRange(buildSourceRangeObject(sourceData->ruleBodyRange, m_parentStyleSheet->lineEndings())); 547 548 548 549 return WTFMove(result); … … 626 627 String previousPriority; 627 628 String previousStatus; 628 std::unique_ptr<Vector<size_t>> lineEndings(m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : nullptr);629 Vector<size_t> lineEndings = m_parentStyleSheet ? m_parentStyleSheet->lineEndings() : Vector<size_t> { }; 629 630 auto sourceData = extractSourceData(); 630 631 unsigned ruleBodyRangeStart = sourceData ? sourceData->ruleBodyRange.start : 0; … … 668 669 absolutePropertyRange.start += ruleBodyRangeStart; 669 670 absolutePropertyRange.end += ruleBodyRangeStart; 670 property->setRange(buildSourceRangeObject(absolutePropertyRange, lineEndings .get()));671 property->setRange(buildSourceRangeObject(absolutePropertyRange, lineEndings)); 671 672 } 672 673 … … 1150 1151 .release(); 1151 1152 if (sourceData) 1152 result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings() .get(), &endingLine));1153 result->setRange(buildSourceRangeObject(sourceData->ruleHeaderRange, lineEndings(), &endingLine)); 1153 1154 return result; 1154 1155 } … … 1283 1284 } 1284 1285 1285 std::unique_ptr<Vector<size_t>> InspectorStyleSheet::lineEndings() const1286 Vector<size_t> InspectorStyleSheet::lineEndings() const 1286 1287 { 1287 1288 if (!m_parsedStyleSheet->hasText()) 1288 return nullptr;1289 return { }; 1289 1290 return ContentSearchUtilities::lineEndings(m_parsedStyleSheet->text()); 1290 1291 } … … 1525 1526 } 1526 1527 1527 std::unique_ptr<Vector<size_t>> InspectorStyleSheetForInlineStyle::lineEndings() const1528 Vector<size_t> InspectorStyleSheetForInlineStyle::lineEndings() const 1528 1529 { 1529 1530 return ContentSearchUtilities::lineEndings(elementStyleText()); -
trunk/Source/WebCore/inspector/InspectorStyleSheet.h
r228218 r228546 199 199 // Also accessed by friend class InspectorStyle. 200 200 virtual ExceptionOr<void> setStyleText(CSSStyleDeclaration*, const String&); 201 virtual std::unique_ptr<Vector<size_t>> lineEndings() const;201 virtual Vector<size_t> lineEndings() const; 202 202 203 203 private: … … 247 247 // Also accessed by friend class InspectorStyle. 248 248 ExceptionOr<void> setStyleText(CSSStyleDeclaration*, const String&) final; 249 std::unique_ptr<Vector<size_t>> lineEndings() const final;249 Vector<size_t> lineEndings() const final; 250 250 251 251 private: -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.h
r228218 r228546 100 100 void getComputedStyleForNode(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSComputedStyleProperty>>&) override; 101 101 void getInlineStylesForNode(ErrorString&, int nodeId, RefPtr<Inspector::Protocol::CSS::CSSStyle>& inlineStyle, RefPtr<Inspector::Protocol::CSS::CSSStyle>& attributes) override; 102 void getMatchedStylesForNode(ErrorString&, int nodeId, const bool* const includePseudo, const bool* constincludeInherited, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>>& matchedCSSRules, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::PseudoIdMatches>>&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::InheritedStyleEntry>>& inheritedEntries) override;102 void getMatchedStylesForNode(ErrorString&, int nodeId, const bool* includePseudo, const bool* includeInherited, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::RuleMatch>>& matchedCSSRules, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::PseudoIdMatches>>&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::InheritedStyleEntry>>& inheritedEntries) override; 103 103 void getAllStyleSheets(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::CSS::CSSStyleSheetHeader>>& styleSheetInfos) override; 104 104 void getStyleSheet(ErrorString&, const String& styleSheetId, RefPtr<Inspector::Protocol::CSS::CSSStyleSheetBody>& result) override; -
trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.cpp
r228218 r228546 242 242 } 243 243 244 void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const String& canvasId, const String* constobjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)244 void InspectorCanvasAgent::resolveCanvasContext(ErrorString& errorString, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) 245 245 { 246 246 auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId); … … 263 263 } 264 264 265 void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* const singleFrame, const int* constmemoryLimit)265 void InspectorCanvasAgent::startRecording(ErrorString& errorString, const String& canvasId, const bool* singleFrame, const int* memoryLimit) 266 266 { 267 267 auto* inspectorCanvas = assertInspectorCanvas(errorString, canvasId); -
trunk/Source/WebCore/inspector/agents/InspectorCanvasAgent.h
r228218 r228546 73 73 void requestContent(ErrorString&, const String& canvasId, String* content) override; 74 74 void requestCSSCanvasClientNodes(ErrorString&, const String& canvasId, RefPtr<JSON::ArrayOf<int>>&) override; 75 void resolveCanvasContext(ErrorString&, const String& canvasId, const String* constobjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override;76 void startRecording(ErrorString&, const String& canvasId, const bool* const singleFrame, const int* constmemoryLimit) override;75 void resolveCanvasContext(ErrorString&, const String& canvasId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) override; 76 void startRecording(ErrorString&, const String& canvasId, const bool* singleFrame, const int* memoryLimit) override; 77 77 void stopRecording(ErrorString&, const String& canvasId) override; 78 78 void requestShaderSource(ErrorString&, const String& programId, const String& shaderType, String*) override; -
trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
r228218 r228546 44 44 45 45 enum DOMBreakpointType { 46 SubtreeModified = 0,46 SubtreeModified, 47 47 AttributeModified, 48 48 NodeRemoved, … … 50 50 }; 51 51 52 static const char * const listenerEventCategoryType= "listener:";53 static const char * const instrumentationEventCategoryType= "instrumentation:";52 static const char listenerEventCategoryType[] = "listener:"; 53 static const char instrumentationEventCategoryType[] = "instrumentation:"; 54 54 55 55 const uint32_t inheritableDOMBreakpointTypesMask = (1 << SubtreeModified); … … 123 123 void InspectorDOMDebuggerAgent::setEventListenerBreakpoint(ErrorString& error, const String& eventName) 124 124 { 125 setBreakpoint(error, String(listenerEventCategoryType)+ eventName);125 setBreakpoint(error, listenerEventCategoryType + eventName); 126 126 } 127 127 128 128 void InspectorDOMDebuggerAgent::setInstrumentationBreakpoint(ErrorString& error, const String& eventName) 129 129 { 130 setBreakpoint(error, String(instrumentationEventCategoryType)+ eventName);130 setBreakpoint(error, instrumentationEventCategoryType + eventName); 131 131 } 132 132 … … 143 143 void InspectorDOMDebuggerAgent::removeEventListenerBreakpoint(ErrorString& error, const String& eventName) 144 144 { 145 removeBreakpoint(error, String(listenerEventCategoryType)+ eventName);145 removeBreakpoint(error, listenerEventCategoryType + eventName); 146 146 } 147 147 148 148 void InspectorDOMDebuggerAgent::removeInstrumentationBreakpoint(ErrorString& error, const String& eventName) 149 149 { 150 removeBreakpoint(error, String(instrumentationEventCategoryType)+ eventName);150 removeBreakpoint(error, instrumentationEventCategoryType + eventName); 151 151 } 152 152 … … 376 376 } 377 377 378 void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* constoptionalIsRegex)378 void InspectorDOMDebuggerAgent::setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) 379 379 { 380 380 if (url.isEmpty()) { -
trunk/Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h
r228218 r228546 55 55 56 56 // DOMDebugger API 57 void setXHRBreakpoint(ErrorString&, const String& url, const bool* const optionalIsRegex) override;58 void removeXHRBreakpoint(ErrorString&, const String& url) override;59 void setEventListenerBreakpoint(ErrorString&, const String& eventName) override;60 void removeEventListenerBreakpoint(ErrorString&, const String& eventName) override;61 void setInstrumentationBreakpoint(ErrorString&, const String& eventName) override;62 void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) override;63 void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;64 void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) override;57 void setXHRBreakpoint(ErrorString&, const String& url, const bool* optionalIsRegex) final; 58 void removeXHRBreakpoint(ErrorString&, const String& url) final; 59 void setEventListenerBreakpoint(ErrorString&, const String& eventName) final; 60 void removeEventListenerBreakpoint(ErrorString&, const String& eventName) final; 61 void setInstrumentationBreakpoint(ErrorString&, const String& eventName) final; 62 void removeInstrumentationBreakpoint(ErrorString&, const String& eventName) final; 63 void setDOMBreakpoint(ErrorString&, int nodeId, const String& type) final; 64 void removeDOMBreakpoint(ErrorString&, int nodeId, const String& type) final; 65 65 66 66 // InspectorInstrumentation … … 75 75 void mainFrameDOMContentLoaded(); 76 76 77 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;78 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;79 void discardAgent() override;77 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final; 78 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final; 79 void discardAgent() final; 80 80 81 81 private: 82 82 // Inspector::InspectorDebuggerAgent::Listener implementation. 83 void debuggerWasEnabled() override;84 void debuggerWasDisabled() override;83 void debuggerWasEnabled() final; 84 void debuggerWasDisabled() final; 85 85 void disable(); 86 86 -
trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp
r228218 r228546 837 837 } 838 838 839 void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* constobjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result)839 void InspectorNetworkAgent::resolveWebSocket(ErrorString& errorString, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) 840 840 { 841 841 WebSocket* webSocket = webSocketForRequestId(requestId); -
trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.h
r228218 r228546 117 117 void setResourceCachingDisabled(ErrorString&, bool disabled) final; 118 118 void loadResource(ErrorString&, const String& frameId, const String& url, Ref<LoadResourceCallback>&&) final; 119 void resolveWebSocket(ErrorString&, const String& requestId, const String* constobjectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final;119 void resolveWebSocket(ErrorString&, const String& requestId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>&) final; 120 120 121 121 virtual String loaderIdentifier(DocumentLoader*) = 0; -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp
r228218 r228546 316 316 } 317 317 318 void InspectorPageAgent::reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* constoptionalRevalidateAllResources)318 void InspectorPageAgent::reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) 319 319 { 320 320 bool reloadFromOrigin = optionalReloadFromOrigin && *optionalReloadFromOrigin; … … 472 472 } 473 473 474 void InspectorPageAgent::searchInResource(ErrorString& errorString, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* constoptionalIsRegex, const String* optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>& results)474 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) 475 475 { 476 476 results = JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>::create(); … … 525 525 } 526 526 527 void InspectorPageAgent::searchInResources(ErrorString&, const String& text, const bool* const optionalCaseSensitive, const bool* constoptionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result)527 void InspectorPageAgent::searchInResources(ErrorString&, const String& text, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>& result) 528 528 { 529 529 result = JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>::create(); -
trunk/Source/WebCore/inspector/agents/InspectorPageAgent.h
r228218 r228546 89 89 90 90 // Page API for InspectorFrontend 91 void enable(ErrorString&) override;92 void disable(ErrorString&) override;93 void reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources) override;94 void navigate(ErrorString&, const String& url) override;95 void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) override;96 void deleteCookie(ErrorString&, const String& cookieName, const String& url) override;97 void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) override;98 void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) override;99 void searchInResource(ErrorString&, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, const String* const optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&) override;100 void searchInResources(ErrorString&, const String&, const bool* c onst caseSensitive, const bool* const isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&) override;101 void setShowPaintRects(ErrorString&, bool show) override;102 void setEmulatedMedia(ErrorString&, const String&) override;103 void getCompositingBordersVisible(ErrorString&, bool* out_param) override;104 void setCompositingBordersVisible(ErrorString&, bool) override;105 void snapshotNode(ErrorString&, int nodeId, String* outDataURL) override;106 void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) override;107 void archive(ErrorString&, String* data) override;91 void enable(ErrorString&) final; 92 void disable(ErrorString&) final; 93 void reload(ErrorString&, const bool* optionalReloadFromOrigin, const bool* optionalRevalidateAllResources) final; 94 void navigate(ErrorString&, const String& url) final; 95 void getCookies(ErrorString&, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::Cookie>>& cookies) final; 96 void deleteCookie(ErrorString&, const String& cookieName, const String& url) final; 97 void getResourceTree(ErrorString&, RefPtr<Inspector::Protocol::Page::FrameResourceTree>&) final; 98 void getResourceContent(ErrorString&, const String& frameId, const String& url, String* content, bool* base64Encoded) final; 99 void searchInResource(ErrorString&, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, const String* optionalRequestId, RefPtr<JSON::ArrayOf<Inspector::Protocol::GenericTypes::SearchMatch>>&) final; 100 void searchInResources(ErrorString&, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<JSON::ArrayOf<Inspector::Protocol::Page::SearchResult>>&) final; 101 void setShowPaintRects(ErrorString&, bool show) final; 102 void setEmulatedMedia(ErrorString&, const String&) final; 103 void getCompositingBordersVisible(ErrorString&, bool* out_param) final; 104 void setCompositingBordersVisible(ErrorString&, bool) final; 105 void snapshotNode(ErrorString&, int nodeId, String* outDataURL) final; 106 void snapshotRect(ErrorString&, int x, int y, int width, int height, const String& coordinateSystem, String* outDataURL) final; 107 void archive(ErrorString&, String* data) final; 108 108 109 109 // InspectorInstrumentation … … 124 124 125 125 // Inspector Controller API 126 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) override;127 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;126 void didCreateFrontendAndBackend(Inspector::FrontendRouter*, Inspector::BackendDispatcher*) final; 127 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final; 128 128 129 129 // Cross-agents API -
trunk/Source/WebCore/inspector/agents/InspectorTimelineAgent.h
r228218 r228546 99 99 void willDestroyFrontendAndBackend(Inspector::DisconnectReason) final; 100 100 101 void start(ErrorString&, const int* constmaxCallStackDepth = nullptr) final;101 void start(ErrorString&, const int* maxCallStackDepth = nullptr) final; 102 102 void stop(ErrorString&) final; 103 103 void setAutoCaptureEnabled(ErrorString&, bool) final; -
trunk/Source/WebCore/inspector/agents/page/PageDebuggerAgent.h
r224345 r228546 86 86 87 87 Inspector::InjectedScript injectedScriptForEval(ErrorString&, const int* executionContextId) override; 88 void setOverlayMessage(ErrorString&, const String* const) final;88 void setOverlayMessage(ErrorString&, const String*) final; 89 89 90 90 Page& m_page;
Note: See TracChangeset
for help on using the changeset viewer.