LCOV - code coverage report
Current view: top level - out/Release/gen/src/inspector/protocol - Debugger.cpp (source / functions) Hit Total Coverage
Test: app.info Lines: 661 1115 59.3 %
Date: 2019-01-20 Functions: 48 73 65.8 %

          Line data    Source code
       1             : // This file is generated
       2             : 
       3             : // Copyright (c) 2016 The Chromium Authors. All rights reserved.
       4             : // Use of this source code is governed by a BSD-style license that can be
       5             : // found in the LICENSE file.
       6             : 
       7             : #include "src/inspector/protocol/Debugger.h"
       8             : 
       9             : #include "src/inspector/protocol/Protocol.h"
      10             : 
      11             : namespace v8_inspector {
      12             : namespace protocol {
      13             : namespace Debugger {
      14             : 
      15             : // ------------- Enum values from types.
      16             : 
      17             : const char Metainfo::domainName[] = "Debugger";
      18             : const char Metainfo::commandPrefix[] = "Debugger.";
      19             : const char Metainfo::version[] = "1.3";
      20             : 
      21        4773 : std::unique_ptr<Location> Location::fromValue(protocol::Value* value, ErrorSupport* errors)
      22             : {
      23        4773 :     if (!value || value->type() != protocol::Value::TypeObject) {
      24           5 :         errors->addError("object expected");
      25             :         return nullptr;
      26             :     }
      27             : 
      28        2384 :     std::unique_ptr<Location> result(new Location());
      29             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
      30        2384 :     errors->push();
      31        4768 :     protocol::Value* scriptIdValue = object->get("scriptId");
      32        2384 :     errors->setName("scriptId");
      33        4768 :     result->m_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
      34        4768 :     protocol::Value* lineNumberValue = object->get("lineNumber");
      35        2384 :     errors->setName("lineNumber");
      36        2384 :     result->m_lineNumber = ValueConversions<int>::fromValue(lineNumberValue, errors);
      37        4768 :     protocol::Value* columnNumberValue = object->get("columnNumber");
      38        2384 :     if (columnNumberValue) {
      39        2144 :         errors->setName("columnNumber");
      40        2144 :         result->m_columnNumber = ValueConversions<int>::fromValue(columnNumberValue, errors);
      41             :     }
      42        2384 :     errors->pop();
      43        2384 :     if (errors->hasErrors())
      44             :         return nullptr;
      45             :     return result;
      46             : }
      47             : 
      48      604153 : std::unique_ptr<protocol::DictionaryValue> Location::toValue() const
      49             : {
      50      604153 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
      51     3020765 :     result->setValue("scriptId", ValueConversions<String>::toValue(m_scriptId));
      52     3020765 :     result->setValue("lineNumber", ValueConversions<int>::toValue(m_lineNumber));
      53      604153 :     if (m_columnNumber.isJust())
      54     2416612 :         result->setValue("columnNumber", ValueConversions<int>::toValue(m_columnNumber.fromJust()));
      55      604153 :     return result;
      56             : }
      57             : 
      58           0 : std::unique_ptr<Location> Location::clone() const
      59             : {
      60           0 :     ErrorSupport errors;
      61           0 :     return fromValue(toValue().get(), &errors);
      62             : }
      63             : 
      64         190 : std::unique_ptr<ScriptPosition> ScriptPosition::fromValue(protocol::Value* value, ErrorSupport* errors)
      65             : {
      66         190 :     if (!value || value->type() != protocol::Value::TypeObject) {
      67           0 :         errors->addError("object expected");
      68             :         return nullptr;
      69             :     }
      70             : 
      71          95 :     std::unique_ptr<ScriptPosition> result(new ScriptPosition());
      72             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
      73          95 :     errors->push();
      74         190 :     protocol::Value* lineNumberValue = object->get("lineNumber");
      75          95 :     errors->setName("lineNumber");
      76          95 :     result->m_lineNumber = ValueConversions<int>::fromValue(lineNumberValue, errors);
      77         190 :     protocol::Value* columnNumberValue = object->get("columnNumber");
      78          95 :     errors->setName("columnNumber");
      79          95 :     result->m_columnNumber = ValueConversions<int>::fromValue(columnNumberValue, errors);
      80          95 :     errors->pop();
      81          95 :     if (errors->hasErrors())
      82             :         return nullptr;
      83             :     return result;
      84             : }
      85             : 
      86           0 : std::unique_ptr<protocol::DictionaryValue> ScriptPosition::toValue() const
      87             : {
      88           0 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
      89           0 :     result->setValue("lineNumber", ValueConversions<int>::toValue(m_lineNumber));
      90           0 :     result->setValue("columnNumber", ValueConversions<int>::toValue(m_columnNumber));
      91           0 :     return result;
      92             : }
      93             : 
      94           0 : std::unique_ptr<ScriptPosition> ScriptPosition::clone() const
      95             : {
      96           0 :     ErrorSupport errors;
      97           0 :     return fromValue(toValue().get(), &errors);
      98             : }
      99             : 
     100           0 : std::unique_ptr<CallFrame> CallFrame::fromValue(protocol::Value* value, ErrorSupport* errors)
     101             : {
     102           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     103           0 :         errors->addError("object expected");
     104             :         return nullptr;
     105             :     }
     106             : 
     107           0 :     std::unique_ptr<CallFrame> result(new CallFrame());
     108             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     109           0 :     errors->push();
     110           0 :     protocol::Value* callFrameIdValue = object->get("callFrameId");
     111           0 :     errors->setName("callFrameId");
     112           0 :     result->m_callFrameId = ValueConversions<String>::fromValue(callFrameIdValue, errors);
     113           0 :     protocol::Value* functionNameValue = object->get("functionName");
     114           0 :     errors->setName("functionName");
     115           0 :     result->m_functionName = ValueConversions<String>::fromValue(functionNameValue, errors);
     116           0 :     protocol::Value* functionLocationValue = object->get("functionLocation");
     117           0 :     if (functionLocationValue) {
     118           0 :         errors->setName("functionLocation");
     119           0 :         result->m_functionLocation = ValueConversions<protocol::Debugger::Location>::fromValue(functionLocationValue, errors);
     120             :     }
     121           0 :     protocol::Value* locationValue = object->get("location");
     122           0 :     errors->setName("location");
     123           0 :     result->m_location = ValueConversions<protocol::Debugger::Location>::fromValue(locationValue, errors);
     124           0 :     protocol::Value* urlValue = object->get("url");
     125           0 :     errors->setName("url");
     126           0 :     result->m_url = ValueConversions<String>::fromValue(urlValue, errors);
     127           0 :     protocol::Value* scopeChainValue = object->get("scopeChain");
     128           0 :     errors->setName("scopeChain");
     129           0 :     result->m_scopeChain = ValueConversions<protocol::Array<protocol::Debugger::Scope>>::fromValue(scopeChainValue, errors);
     130           0 :     protocol::Value* thisValue = object->get("this");
     131           0 :     errors->setName("this");
     132           0 :     result->m_this = ValueConversions<protocol::Runtime::RemoteObject>::fromValue(thisValue, errors);
     133           0 :     protocol::Value* returnValueValue = object->get("returnValue");
     134           0 :     if (returnValueValue) {
     135           0 :         errors->setName("returnValue");
     136           0 :         result->m_returnValue = ValueConversions<protocol::Runtime::RemoteObject>::fromValue(returnValueValue, errors);
     137             :     }
     138           0 :     errors->pop();
     139           0 :     if (errors->hasErrors())
     140             :         return nullptr;
     141             :     return result;
     142             : }
     143             : 
     144      146904 : std::unique_ptr<protocol::DictionaryValue> CallFrame::toValue() const
     145             : {
     146      146904 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     147      734520 :     result->setValue("callFrameId", ValueConversions<String>::toValue(m_callFrameId));
     148      734520 :     result->setValue("functionName", ValueConversions<String>::toValue(m_functionName));
     149      146904 :     if (m_functionLocation.isJust())
     150      584892 :         result->setValue("functionLocation", ValueConversions<protocol::Debugger::Location>::toValue(m_functionLocation.fromJust()));
     151      587616 :     result->setValue("location", ValueConversions<protocol::Debugger::Location>::toValue(m_location.get()));
     152      734520 :     result->setValue("url", ValueConversions<String>::toValue(m_url));
     153      587616 :     result->setValue("scopeChain", ValueConversions<protocol::Array<protocol::Debugger::Scope>>::toValue(m_scopeChain.get()));
     154      587616 :     result->setValue("this", ValueConversions<protocol::Runtime::RemoteObject>::toValue(m_this.get()));
     155      146904 :     if (m_returnValue.isJust())
     156       22828 :         result->setValue("returnValue", ValueConversions<protocol::Runtime::RemoteObject>::toValue(m_returnValue.fromJust()));
     157      146904 :     return result;
     158             : }
     159             : 
     160           0 : std::unique_ptr<CallFrame> CallFrame::clone() const
     161             : {
     162           0 :     ErrorSupport errors;
     163           0 :     return fromValue(toValue().get(), &errors);
     164             : }
     165             : 
     166             : const char* Scope::TypeEnum::Global = "global";
     167             : const char* Scope::TypeEnum::Local = "local";
     168             : const char* Scope::TypeEnum::With = "with";
     169             : const char* Scope::TypeEnum::Closure = "closure";
     170             : const char* Scope::TypeEnum::Catch = "catch";
     171             : const char* Scope::TypeEnum::Block = "block";
     172             : const char* Scope::TypeEnum::Script = "script";
     173             : const char* Scope::TypeEnum::Eval = "eval";
     174             : const char* Scope::TypeEnum::Module = "module";
     175             : 
     176           0 : std::unique_ptr<Scope> Scope::fromValue(protocol::Value* value, ErrorSupport* errors)
     177             : {
     178           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     179           0 :         errors->addError("object expected");
     180             :         return nullptr;
     181             :     }
     182             : 
     183           0 :     std::unique_ptr<Scope> result(new Scope());
     184             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     185           0 :     errors->push();
     186           0 :     protocol::Value* typeValue = object->get("type");
     187           0 :     errors->setName("type");
     188           0 :     result->m_type = ValueConversions<String>::fromValue(typeValue, errors);
     189           0 :     protocol::Value* objectValue = object->get("object");
     190           0 :     errors->setName("object");
     191           0 :     result->m_object = ValueConversions<protocol::Runtime::RemoteObject>::fromValue(objectValue, errors);
     192           0 :     protocol::Value* nameValue = object->get("name");
     193           0 :     if (nameValue) {
     194           0 :         errors->setName("name");
     195           0 :         result->m_name = ValueConversions<String>::fromValue(nameValue, errors);
     196             :     }
     197           0 :     protocol::Value* startLocationValue = object->get("startLocation");
     198           0 :     if (startLocationValue) {
     199           0 :         errors->setName("startLocation");
     200           0 :         result->m_startLocation = ValueConversions<protocol::Debugger::Location>::fromValue(startLocationValue, errors);
     201             :     }
     202           0 :     protocol::Value* endLocationValue = object->get("endLocation");
     203           0 :     if (endLocationValue) {
     204           0 :         errors->setName("endLocation");
     205           0 :         result->m_endLocation = ValueConversions<protocol::Debugger::Location>::fromValue(endLocationValue, errors);
     206             :     }
     207           0 :     errors->pop();
     208           0 :     if (errors->hasErrors())
     209             :         return nullptr;
     210             :     return result;
     211             : }
     212             : 
     213      371828 : std::unique_ptr<protocol::DictionaryValue> Scope::toValue() const
     214             : {
     215      371828 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     216     1859140 :     result->setValue("type", ValueConversions<String>::toValue(m_type));
     217     1487312 :     result->setValue("object", ValueConversions<protocol::Runtime::RemoteObject>::toValue(m_object.get()));
     218      371828 :     if (m_name.isJust())
     219      443050 :         result->setValue("name", ValueConversions<String>::toValue(m_name.fromJust()));
     220      371828 :     if (m_startLocation.isJust())
     221      617712 :         result->setValue("startLocation", ValueConversions<protocol::Debugger::Location>::toValue(m_startLocation.fromJust()));
     222      371828 :     if (m_endLocation.isJust())
     223      617712 :         result->setValue("endLocation", ValueConversions<protocol::Debugger::Location>::toValue(m_endLocation.fromJust()));
     224      371828 :     return result;
     225             : }
     226             : 
     227           0 : std::unique_ptr<Scope> Scope::clone() const
     228             : {
     229           0 :     ErrorSupport errors;
     230           0 :     return fromValue(toValue().get(), &errors);
     231             : }
     232             : 
     233           0 : std::unique_ptr<SearchMatch> SearchMatch::fromValue(protocol::Value* value, ErrorSupport* errors)
     234             : {
     235           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     236           0 :         errors->addError("object expected");
     237             :         return nullptr;
     238             :     }
     239             : 
     240           0 :     std::unique_ptr<SearchMatch> result(new SearchMatch());
     241             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     242           0 :     errors->push();
     243           0 :     protocol::Value* lineNumberValue = object->get("lineNumber");
     244           0 :     errors->setName("lineNumber");
     245           0 :     result->m_lineNumber = ValueConversions<double>::fromValue(lineNumberValue, errors);
     246           0 :     protocol::Value* lineContentValue = object->get("lineContent");
     247           0 :     errors->setName("lineContent");
     248           0 :     result->m_lineContent = ValueConversions<String>::fromValue(lineContentValue, errors);
     249           0 :     errors->pop();
     250           0 :     if (errors->hasErrors())
     251             :         return nullptr;
     252             :     return result;
     253             : }
     254             : 
     255           0 : std::unique_ptr<protocol::DictionaryValue> SearchMatch::toValue() const
     256             : {
     257           0 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     258           0 :     result->setValue("lineNumber", ValueConversions<double>::toValue(m_lineNumber));
     259           0 :     result->setValue("lineContent", ValueConversions<String>::toValue(m_lineContent));
     260           0 :     return result;
     261             : }
     262             : 
     263           0 : std::unique_ptr<SearchMatch> SearchMatch::clone() const
     264             : {
     265           0 :     ErrorSupport errors;
     266           0 :     return fromValue(toValue().get(), &errors);
     267             : }
     268             : 
     269           0 : std::unique_ptr<StringBuffer> SearchMatch::toJSONString() const
     270             : {
     271           0 :     String json = toValue()->serialize();
     272           0 :     return StringBufferImpl::adopt(json);
     273             : }
     274             : 
     275             : // static
     276           0 : std::unique_ptr<API::SearchMatch> API::SearchMatch::fromJSONString(const StringView& json)
     277             : {
     278           0 :     ErrorSupport errors;
     279           0 :     std::unique_ptr<Value> value = StringUtil::parseJSON(json);
     280           0 :     if (!value)
     281             :         return nullptr;
     282           0 :     return protocol::Debugger::SearchMatch::fromValue(value.get(), &errors);
     283             : }
     284             : 
     285             : const char* BreakLocation::TypeEnum::DebuggerStatement = "debuggerStatement";
     286             : const char* BreakLocation::TypeEnum::Call = "call";
     287             : const char* BreakLocation::TypeEnum::Return = "return";
     288             : 
     289           0 : std::unique_ptr<BreakLocation> BreakLocation::fromValue(protocol::Value* value, ErrorSupport* errors)
     290             : {
     291           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     292           0 :         errors->addError("object expected");
     293             :         return nullptr;
     294             :     }
     295             : 
     296           0 :     std::unique_ptr<BreakLocation> result(new BreakLocation());
     297             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     298           0 :     errors->push();
     299           0 :     protocol::Value* scriptIdValue = object->get("scriptId");
     300           0 :     errors->setName("scriptId");
     301           0 :     result->m_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
     302           0 :     protocol::Value* lineNumberValue = object->get("lineNumber");
     303           0 :     errors->setName("lineNumber");
     304           0 :     result->m_lineNumber = ValueConversions<int>::fromValue(lineNumberValue, errors);
     305           0 :     protocol::Value* columnNumberValue = object->get("columnNumber");
     306           0 :     if (columnNumberValue) {
     307           0 :         errors->setName("columnNumber");
     308           0 :         result->m_columnNumber = ValueConversions<int>::fromValue(columnNumberValue, errors);
     309             :     }
     310           0 :     protocol::Value* typeValue = object->get("type");
     311           0 :     if (typeValue) {
     312           0 :         errors->setName("type");
     313           0 :         result->m_type = ValueConversions<String>::fromValue(typeValue, errors);
     314             :     }
     315           0 :     errors->pop();
     316           0 :     if (errors->hasErrors())
     317             :         return nullptr;
     318             :     return result;
     319             : }
     320             : 
     321        4230 : std::unique_ptr<protocol::DictionaryValue> BreakLocation::toValue() const
     322             : {
     323        4230 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     324       21150 :     result->setValue("scriptId", ValueConversions<String>::toValue(m_scriptId));
     325       21150 :     result->setValue("lineNumber", ValueConversions<int>::toValue(m_lineNumber));
     326        4230 :     if (m_columnNumber.isJust())
     327       16920 :         result->setValue("columnNumber", ValueConversions<int>::toValue(m_columnNumber.fromJust()));
     328        4230 :     if (m_type.isJust())
     329       12400 :         result->setValue("type", ValueConversions<String>::toValue(m_type.fromJust()));
     330        4230 :     return result;
     331             : }
     332             : 
     333           0 : std::unique_ptr<BreakLocation> BreakLocation::clone() const
     334             : {
     335           0 :     ErrorSupport errors;
     336           0 :     return fromValue(toValue().get(), &errors);
     337             : }
     338             : 
     339           0 : std::unique_ptr<BreakpointResolvedNotification> BreakpointResolvedNotification::fromValue(protocol::Value* value, ErrorSupport* errors)
     340             : {
     341           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     342           0 :         errors->addError("object expected");
     343             :         return nullptr;
     344             :     }
     345             : 
     346           0 :     std::unique_ptr<BreakpointResolvedNotification> result(new BreakpointResolvedNotification());
     347             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     348           0 :     errors->push();
     349           0 :     protocol::Value* breakpointIdValue = object->get("breakpointId");
     350           0 :     errors->setName("breakpointId");
     351           0 :     result->m_breakpointId = ValueConversions<String>::fromValue(breakpointIdValue, errors);
     352           0 :     protocol::Value* locationValue = object->get("location");
     353           0 :     errors->setName("location");
     354           0 :     result->m_location = ValueConversions<protocol::Debugger::Location>::fromValue(locationValue, errors);
     355           0 :     errors->pop();
     356           0 :     if (errors->hasErrors())
     357             :         return nullptr;
     358             :     return result;
     359             : }
     360             : 
     361          70 : std::unique_ptr<protocol::DictionaryValue> BreakpointResolvedNotification::toValue() const
     362             : {
     363          70 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     364         350 :     result->setValue("breakpointId", ValueConversions<String>::toValue(m_breakpointId));
     365         280 :     result->setValue("location", ValueConversions<protocol::Debugger::Location>::toValue(m_location.get()));
     366          70 :     return result;
     367             : }
     368             : 
     369           0 : std::unique_ptr<BreakpointResolvedNotification> BreakpointResolvedNotification::clone() const
     370             : {
     371           0 :     ErrorSupport errors;
     372           0 :     return fromValue(toValue().get(), &errors);
     373             : }
     374             : 
     375             : const char* PausedNotification::ReasonEnum::XHR = "XHR";
     376             : const char* PausedNotification::ReasonEnum::DOM = "DOM";
     377             : const char* PausedNotification::ReasonEnum::EventListener = "EventListener";
     378             : const char* PausedNotification::ReasonEnum::Exception = "exception";
     379             : const char* PausedNotification::ReasonEnum::Assert = "assert";
     380             : const char* PausedNotification::ReasonEnum::DebugCommand = "debugCommand";
     381             : const char* PausedNotification::ReasonEnum::PromiseRejection = "promiseRejection";
     382             : const char* PausedNotification::ReasonEnum::OOM = "OOM";
     383             : const char* PausedNotification::ReasonEnum::Other = "other";
     384             : const char* PausedNotification::ReasonEnum::Ambiguous = "ambiguous";
     385             : 
     386           0 : std::unique_ptr<PausedNotification> PausedNotification::fromValue(protocol::Value* value, ErrorSupport* errors)
     387             : {
     388           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     389           0 :         errors->addError("object expected");
     390             :         return nullptr;
     391             :     }
     392             : 
     393           0 :     std::unique_ptr<PausedNotification> result(new PausedNotification());
     394             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     395           0 :     errors->push();
     396           0 :     protocol::Value* callFramesValue = object->get("callFrames");
     397           0 :     errors->setName("callFrames");
     398           0 :     result->m_callFrames = ValueConversions<protocol::Array<protocol::Debugger::CallFrame>>::fromValue(callFramesValue, errors);
     399           0 :     protocol::Value* reasonValue = object->get("reason");
     400           0 :     errors->setName("reason");
     401           0 :     result->m_reason = ValueConversions<String>::fromValue(reasonValue, errors);
     402           0 :     protocol::Value* dataValue = object->get("data");
     403           0 :     if (dataValue) {
     404           0 :         errors->setName("data");
     405           0 :         result->m_data = ValueConversions<protocol::DictionaryValue>::fromValue(dataValue, errors);
     406             :     }
     407           0 :     protocol::Value* hitBreakpointsValue = object->get("hitBreakpoints");
     408           0 :     if (hitBreakpointsValue) {
     409           0 :         errors->setName("hitBreakpoints");
     410           0 :         result->m_hitBreakpoints = ValueConversions<protocol::Array<String>>::fromValue(hitBreakpointsValue, errors);
     411             :     }
     412           0 :     protocol::Value* asyncStackTraceValue = object->get("asyncStackTrace");
     413           0 :     if (asyncStackTraceValue) {
     414           0 :         errors->setName("asyncStackTrace");
     415           0 :         result->m_asyncStackTrace = ValueConversions<protocol::Runtime::StackTrace>::fromValue(asyncStackTraceValue, errors);
     416             :     }
     417           0 :     protocol::Value* asyncStackTraceIdValue = object->get("asyncStackTraceId");
     418           0 :     if (asyncStackTraceIdValue) {
     419           0 :         errors->setName("asyncStackTraceId");
     420           0 :         result->m_asyncStackTraceId = ValueConversions<protocol::Runtime::StackTraceId>::fromValue(asyncStackTraceIdValue, errors);
     421             :     }
     422           0 :     protocol::Value* asyncCallStackTraceIdValue = object->get("asyncCallStackTraceId");
     423           0 :     if (asyncCallStackTraceIdValue) {
     424           0 :         errors->setName("asyncCallStackTraceId");
     425           0 :         result->m_asyncCallStackTraceId = ValueConversions<protocol::Runtime::StackTraceId>::fromValue(asyncCallStackTraceIdValue, errors);
     426             :     }
     427           0 :     errors->pop();
     428           0 :     if (errors->hasErrors())
     429             :         return nullptr;
     430             :     return result;
     431             : }
     432             : 
     433       55554 : std::unique_ptr<protocol::DictionaryValue> PausedNotification::toValue() const
     434             : {
     435       55554 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     436      222216 :     result->setValue("callFrames", ValueConversions<protocol::Array<protocol::Debugger::CallFrame>>::toValue(m_callFrames.get()));
     437      277770 :     result->setValue("reason", ValueConversions<String>::toValue(m_reason));
     438       55554 :     if (m_data.isJust())
     439        7808 :         result->setValue("data", ValueConversions<protocol::DictionaryValue>::toValue(m_data.fromJust()));
     440       55554 :     if (m_hitBreakpoints.isJust())
     441      222216 :         result->setValue("hitBreakpoints", ValueConversions<protocol::Array<String>>::toValue(m_hitBreakpoints.fromJust()));
     442       55554 :     if (m_asyncStackTrace.isJust())
     443        2500 :         result->setValue("asyncStackTrace", ValueConversions<protocol::Runtime::StackTrace>::toValue(m_asyncStackTrace.fromJust()));
     444       55554 :     if (m_asyncStackTraceId.isJust())
     445         100 :         result->setValue("asyncStackTraceId", ValueConversions<protocol::Runtime::StackTraceId>::toValue(m_asyncStackTraceId.fromJust()));
     446       55554 :     if (m_asyncCallStackTraceId.isJust())
     447         380 :         result->setValue("asyncCallStackTraceId", ValueConversions<protocol::Runtime::StackTraceId>::toValue(m_asyncCallStackTraceId.fromJust()));
     448       55554 :     return result;
     449             : }
     450             : 
     451           0 : std::unique_ptr<PausedNotification> PausedNotification::clone() const
     452             : {
     453           0 :     ErrorSupport errors;
     454           0 :     return fromValue(toValue().get(), &errors);
     455             : }
     456             : 
     457           0 : std::unique_ptr<ScriptFailedToParseNotification> ScriptFailedToParseNotification::fromValue(protocol::Value* value, ErrorSupport* errors)
     458             : {
     459           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     460           0 :         errors->addError("object expected");
     461             :         return nullptr;
     462             :     }
     463             : 
     464           0 :     std::unique_ptr<ScriptFailedToParseNotification> result(new ScriptFailedToParseNotification());
     465             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     466           0 :     errors->push();
     467           0 :     protocol::Value* scriptIdValue = object->get("scriptId");
     468           0 :     errors->setName("scriptId");
     469           0 :     result->m_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
     470           0 :     protocol::Value* urlValue = object->get("url");
     471           0 :     errors->setName("url");
     472           0 :     result->m_url = ValueConversions<String>::fromValue(urlValue, errors);
     473           0 :     protocol::Value* startLineValue = object->get("startLine");
     474           0 :     errors->setName("startLine");
     475           0 :     result->m_startLine = ValueConversions<int>::fromValue(startLineValue, errors);
     476           0 :     protocol::Value* startColumnValue = object->get("startColumn");
     477           0 :     errors->setName("startColumn");
     478           0 :     result->m_startColumn = ValueConversions<int>::fromValue(startColumnValue, errors);
     479           0 :     protocol::Value* endLineValue = object->get("endLine");
     480           0 :     errors->setName("endLine");
     481           0 :     result->m_endLine = ValueConversions<int>::fromValue(endLineValue, errors);
     482           0 :     protocol::Value* endColumnValue = object->get("endColumn");
     483           0 :     errors->setName("endColumn");
     484           0 :     result->m_endColumn = ValueConversions<int>::fromValue(endColumnValue, errors);
     485           0 :     protocol::Value* executionContextIdValue = object->get("executionContextId");
     486           0 :     errors->setName("executionContextId");
     487           0 :     result->m_executionContextId = ValueConversions<int>::fromValue(executionContextIdValue, errors);
     488           0 :     protocol::Value* hashValue = object->get("hash");
     489           0 :     errors->setName("hash");
     490           0 :     result->m_hash = ValueConversions<String>::fromValue(hashValue, errors);
     491           0 :     protocol::Value* executionContextAuxDataValue = object->get("executionContextAuxData");
     492           0 :     if (executionContextAuxDataValue) {
     493           0 :         errors->setName("executionContextAuxData");
     494           0 :         result->m_executionContextAuxData = ValueConversions<protocol::DictionaryValue>::fromValue(executionContextAuxDataValue, errors);
     495             :     }
     496           0 :     protocol::Value* sourceMapURLValue = object->get("sourceMapURL");
     497           0 :     if (sourceMapURLValue) {
     498           0 :         errors->setName("sourceMapURL");
     499           0 :         result->m_sourceMapURL = ValueConversions<String>::fromValue(sourceMapURLValue, errors);
     500             :     }
     501           0 :     protocol::Value* hasSourceURLValue = object->get("hasSourceURL");
     502           0 :     if (hasSourceURLValue) {
     503           0 :         errors->setName("hasSourceURL");
     504           0 :         result->m_hasSourceURL = ValueConversions<bool>::fromValue(hasSourceURLValue, errors);
     505             :     }
     506           0 :     protocol::Value* isModuleValue = object->get("isModule");
     507           0 :     if (isModuleValue) {
     508           0 :         errors->setName("isModule");
     509           0 :         result->m_isModule = ValueConversions<bool>::fromValue(isModuleValue, errors);
     510             :     }
     511           0 :     protocol::Value* lengthValue = object->get("length");
     512           0 :     if (lengthValue) {
     513           0 :         errors->setName("length");
     514           0 :         result->m_length = ValueConversions<int>::fromValue(lengthValue, errors);
     515             :     }
     516           0 :     protocol::Value* stackTraceValue = object->get("stackTrace");
     517           0 :     if (stackTraceValue) {
     518           0 :         errors->setName("stackTrace");
     519           0 :         result->m_stackTrace = ValueConversions<protocol::Runtime::StackTrace>::fromValue(stackTraceValue, errors);
     520             :     }
     521           0 :     errors->pop();
     522           0 :     if (errors->hasErrors())
     523             :         return nullptr;
     524             :     return result;
     525             : }
     526             : 
     527        5201 : std::unique_ptr<protocol::DictionaryValue> ScriptFailedToParseNotification::toValue() const
     528             : {
     529        5201 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     530       26005 :     result->setValue("scriptId", ValueConversions<String>::toValue(m_scriptId));
     531       26005 :     result->setValue("url", ValueConversions<String>::toValue(m_url));
     532       26005 :     result->setValue("startLine", ValueConversions<int>::toValue(m_startLine));
     533       26005 :     result->setValue("startColumn", ValueConversions<int>::toValue(m_startColumn));
     534       26005 :     result->setValue("endLine", ValueConversions<int>::toValue(m_endLine));
     535       26005 :     result->setValue("endColumn", ValueConversions<int>::toValue(m_endColumn));
     536       26005 :     result->setValue("executionContextId", ValueConversions<int>::toValue(m_executionContextId));
     537       26005 :     result->setValue("hash", ValueConversions<String>::toValue(m_hash));
     538        5201 :     if (m_executionContextAuxData.isJust())
     539           0 :         result->setValue("executionContextAuxData", ValueConversions<protocol::DictionaryValue>::toValue(m_executionContextAuxData.fromJust()));
     540        5201 :     if (m_sourceMapURL.isJust())
     541       26005 :         result->setValue("sourceMapURL", ValueConversions<String>::toValue(m_sourceMapURL.fromJust()));
     542        5201 :     if (m_hasSourceURL.isJust())
     543       20804 :         result->setValue("hasSourceURL", ValueConversions<bool>::toValue(m_hasSourceURL.fromJust()));
     544        5201 :     if (m_isModule.isJust())
     545       20804 :         result->setValue("isModule", ValueConversions<bool>::toValue(m_isModule.fromJust()));
     546        5201 :     if (m_length.isJust())
     547       20804 :         result->setValue("length", ValueConversions<int>::toValue(m_length.fromJust()));
     548        5201 :     if (m_stackTrace.isJust())
     549       20484 :         result->setValue("stackTrace", ValueConversions<protocol::Runtime::StackTrace>::toValue(m_stackTrace.fromJust()));
     550        5201 :     return result;
     551             : }
     552             : 
     553           0 : std::unique_ptr<ScriptFailedToParseNotification> ScriptFailedToParseNotification::clone() const
     554             : {
     555           0 :     ErrorSupport errors;
     556           0 :     return fromValue(toValue().get(), &errors);
     557             : }
     558             : 
     559           0 : std::unique_ptr<ScriptParsedNotification> ScriptParsedNotification::fromValue(protocol::Value* value, ErrorSupport* errors)
     560             : {
     561           0 :     if (!value || value->type() != protocol::Value::TypeObject) {
     562           0 :         errors->addError("object expected");
     563             :         return nullptr;
     564             :     }
     565             : 
     566           0 :     std::unique_ptr<ScriptParsedNotification> result(new ScriptParsedNotification());
     567             :     protocol::DictionaryValue* object = DictionaryValue::cast(value);
     568           0 :     errors->push();
     569           0 :     protocol::Value* scriptIdValue = object->get("scriptId");
     570           0 :     errors->setName("scriptId");
     571           0 :     result->m_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
     572           0 :     protocol::Value* urlValue = object->get("url");
     573           0 :     errors->setName("url");
     574           0 :     result->m_url = ValueConversions<String>::fromValue(urlValue, errors);
     575           0 :     protocol::Value* startLineValue = object->get("startLine");
     576           0 :     errors->setName("startLine");
     577           0 :     result->m_startLine = ValueConversions<int>::fromValue(startLineValue, errors);
     578           0 :     protocol::Value* startColumnValue = object->get("startColumn");
     579           0 :     errors->setName("startColumn");
     580           0 :     result->m_startColumn = ValueConversions<int>::fromValue(startColumnValue, errors);
     581           0 :     protocol::Value* endLineValue = object->get("endLine");
     582           0 :     errors->setName("endLine");
     583           0 :     result->m_endLine = ValueConversions<int>::fromValue(endLineValue, errors);
     584           0 :     protocol::Value* endColumnValue = object->get("endColumn");
     585           0 :     errors->setName("endColumn");
     586           0 :     result->m_endColumn = ValueConversions<int>::fromValue(endColumnValue, errors);
     587           0 :     protocol::Value* executionContextIdValue = object->get("executionContextId");
     588           0 :     errors->setName("executionContextId");
     589           0 :     result->m_executionContextId = ValueConversions<int>::fromValue(executionContextIdValue, errors);
     590           0 :     protocol::Value* hashValue = object->get("hash");
     591           0 :     errors->setName("hash");
     592           0 :     result->m_hash = ValueConversions<String>::fromValue(hashValue, errors);
     593           0 :     protocol::Value* executionContextAuxDataValue = object->get("executionContextAuxData");
     594           0 :     if (executionContextAuxDataValue) {
     595           0 :         errors->setName("executionContextAuxData");
     596           0 :         result->m_executionContextAuxData = ValueConversions<protocol::DictionaryValue>::fromValue(executionContextAuxDataValue, errors);
     597             :     }
     598           0 :     protocol::Value* isLiveEditValue = object->get("isLiveEdit");
     599           0 :     if (isLiveEditValue) {
     600           0 :         errors->setName("isLiveEdit");
     601           0 :         result->m_isLiveEdit = ValueConversions<bool>::fromValue(isLiveEditValue, errors);
     602             :     }
     603           0 :     protocol::Value* sourceMapURLValue = object->get("sourceMapURL");
     604           0 :     if (sourceMapURLValue) {
     605           0 :         errors->setName("sourceMapURL");
     606           0 :         result->m_sourceMapURL = ValueConversions<String>::fromValue(sourceMapURLValue, errors);
     607             :     }
     608           0 :     protocol::Value* hasSourceURLValue = object->get("hasSourceURL");
     609           0 :     if (hasSourceURLValue) {
     610           0 :         errors->setName("hasSourceURL");
     611           0 :         result->m_hasSourceURL = ValueConversions<bool>::fromValue(hasSourceURLValue, errors);
     612             :     }
     613           0 :     protocol::Value* isModuleValue = object->get("isModule");
     614           0 :     if (isModuleValue) {
     615           0 :         errors->setName("isModule");
     616           0 :         result->m_isModule = ValueConversions<bool>::fromValue(isModuleValue, errors);
     617             :     }
     618           0 :     protocol::Value* lengthValue = object->get("length");
     619           0 :     if (lengthValue) {
     620           0 :         errors->setName("length");
     621           0 :         result->m_length = ValueConversions<int>::fromValue(lengthValue, errors);
     622             :     }
     623           0 :     protocol::Value* stackTraceValue = object->get("stackTrace");
     624           0 :     if (stackTraceValue) {
     625           0 :         errors->setName("stackTrace");
     626           0 :         result->m_stackTrace = ValueConversions<protocol::Runtime::StackTrace>::fromValue(stackTraceValue, errors);
     627             :     }
     628           0 :     errors->pop();
     629           0 :     if (errors->hasErrors())
     630             :         return nullptr;
     631             :     return result;
     632             : }
     633             : 
     634       55227 : std::unique_ptr<protocol::DictionaryValue> ScriptParsedNotification::toValue() const
     635             : {
     636       55227 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     637      276135 :     result->setValue("scriptId", ValueConversions<String>::toValue(m_scriptId));
     638      276135 :     result->setValue("url", ValueConversions<String>::toValue(m_url));
     639      276135 :     result->setValue("startLine", ValueConversions<int>::toValue(m_startLine));
     640      276135 :     result->setValue("startColumn", ValueConversions<int>::toValue(m_startColumn));
     641      276135 :     result->setValue("endLine", ValueConversions<int>::toValue(m_endLine));
     642      276135 :     result->setValue("endColumn", ValueConversions<int>::toValue(m_endColumn));
     643      276135 :     result->setValue("executionContextId", ValueConversions<int>::toValue(m_executionContextId));
     644      276135 :     result->setValue("hash", ValueConversions<String>::toValue(m_hash));
     645       55227 :     if (m_executionContextAuxData.isJust())
     646           0 :         result->setValue("executionContextAuxData", ValueConversions<protocol::DictionaryValue>::toValue(m_executionContextAuxData.fromJust()));
     647       55227 :     if (m_isLiveEdit.isJust())
     648      220908 :         result->setValue("isLiveEdit", ValueConversions<bool>::toValue(m_isLiveEdit.fromJust()));
     649       55227 :     if (m_sourceMapURL.isJust())
     650      276135 :         result->setValue("sourceMapURL", ValueConversions<String>::toValue(m_sourceMapURL.fromJust()));
     651       55227 :     if (m_hasSourceURL.isJust())
     652      220908 :         result->setValue("hasSourceURL", ValueConversions<bool>::toValue(m_hasSourceURL.fromJust()));
     653       55227 :     if (m_isModule.isJust())
     654      220908 :         result->setValue("isModule", ValueConversions<bool>::toValue(m_isModule.fromJust()));
     655       55227 :     if (m_length.isJust())
     656      220908 :         result->setValue("length", ValueConversions<int>::toValue(m_length.fromJust()));
     657       55227 :     if (m_stackTrace.isJust())
     658      192192 :         result->setValue("stackTrace", ValueConversions<protocol::Runtime::StackTrace>::toValue(m_stackTrace.fromJust()));
     659       55227 :     return result;
     660             : }
     661             : 
     662           0 : std::unique_ptr<ScriptParsedNotification> ScriptParsedNotification::clone() const
     663             : {
     664           0 :     ErrorSupport errors;
     665           0 :     return fromValue(toValue().get(), &errors);
     666             : }
     667             : 
     668             : // ------------- Enum values from params.
     669             : 
     670             : 
     671             : namespace ContinueToLocation {
     672             : namespace TargetCallFramesEnum {
     673             : const char* Any = "any";
     674             : const char* Current = "current";
     675             : } // namespace TargetCallFramesEnum
     676             : } // namespace ContinueToLocation
     677             : 
     678             : namespace SetPauseOnExceptions {
     679             : namespace StateEnum {
     680             : const char* None = "none";
     681             : const char* Uncaught = "uncaught";
     682             : const char* All = "all";
     683             : } // namespace StateEnum
     684             : } // namespace SetPauseOnExceptions
     685             : 
     686             : namespace Paused {
     687             : namespace ReasonEnum {
     688             : const char* XHR = "XHR";
     689             : const char* DOM = "DOM";
     690             : const char* EventListener = "EventListener";
     691             : const char* Exception = "exception";
     692             : const char* Assert = "assert";
     693             : const char* DebugCommand = "debugCommand";
     694             : const char* PromiseRejection = "promiseRejection";
     695             : const char* OOM = "OOM";
     696             : const char* Other = "other";
     697             : const char* Ambiguous = "ambiguous";
     698             : } // namespace ReasonEnum
     699             : } // namespace Paused
     700             : 
     701             : namespace API {
     702             : namespace Paused {
     703             : namespace ReasonEnum {
     704             : const char* XHR = "XHR";
     705             : const char* DOM = "DOM";
     706             : const char* EventListener = "EventListener";
     707             : const char* Exception = "exception";
     708             : const char* Assert = "assert";
     709             : const char* DebugCommand = "debugCommand";
     710             : const char* PromiseRejection = "promiseRejection";
     711             : const char* OOM = "OOM";
     712             : const char* Other = "other";
     713             : const char* Ambiguous = "ambiguous";
     714             : } // namespace ReasonEnum
     715             : } // namespace Paused
     716             : } // namespace API
     717             : 
     718             : // ------------- Frontend notifications.
     719             : 
     720          70 : void Frontend::breakpointResolved(const String& breakpointId, std::unique_ptr<protocol::Debugger::Location> location)
     721             : {
     722          70 :     if (!m_frontendChannel)
     723          70 :         return;
     724             :     std::unique_ptr<BreakpointResolvedNotification> messageData = BreakpointResolvedNotification::create()
     725          70 :         .setBreakpointId(breakpointId)
     726             :         .setLocation(std::move(location))
     727             :         .build();
     728         490 :     m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("Debugger.breakpointResolved", std::move(messageData)));
     729             : }
     730             : 
     731       55554 : void Frontend::paused(std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> callFrames, const String& reason, Maybe<protocol::DictionaryValue> data, Maybe<protocol::Array<String>> hitBreakpoints, Maybe<protocol::Runtime::StackTrace> asyncStackTrace, Maybe<protocol::Runtime::StackTraceId> asyncStackTraceId, Maybe<protocol::Runtime::StackTraceId> asyncCallStackTraceId)
     732             : {
     733       55554 :     if (!m_frontendChannel)
     734       55554 :         return;
     735             :     std::unique_ptr<PausedNotification> messageData = PausedNotification::create()
     736       55554 :         .setCallFrames(std::move(callFrames))
     737             :         .setReason(reason)
     738             :         .build();
     739       55554 :     if (data.isJust())
     740             :         messageData->setData(std::move(data).takeJust());
     741       55554 :     if (hitBreakpoints.isJust())
     742             :         messageData->setHitBreakpoints(std::move(hitBreakpoints).takeJust());
     743       55554 :     if (asyncStackTrace.isJust())
     744             :         messageData->setAsyncStackTrace(std::move(asyncStackTrace).takeJust());
     745       55554 :     if (asyncStackTraceId.isJust())
     746             :         messageData->setAsyncStackTraceId(std::move(asyncStackTraceId).takeJust());
     747       55554 :     if (asyncCallStackTraceId.isJust())
     748             :         messageData->setAsyncCallStackTraceId(std::move(asyncCallStackTraceId).takeJust());
     749      388878 :     m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("Debugger.paused", std::move(messageData)));
     750             : }
     751             : 
     752       55279 : void Frontend::resumed()
     753             : {
     754       55279 :     if (!m_frontendChannel)
     755       55279 :         return;
     756      386953 :     m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("Debugger.resumed"));
     757             : }
     758             : 
     759        5201 : void Frontend::scriptFailedToParse(const String& scriptId, const String& url, int startLine, int startColumn, int endLine, int endColumn, int executionContextId, const String& hash, Maybe<protocol::DictionaryValue> executionContextAuxData, Maybe<String> sourceMapURL, Maybe<bool> hasSourceURL, Maybe<bool> isModule, Maybe<int> length, Maybe<protocol::Runtime::StackTrace> stackTrace)
     760             : {
     761        5201 :     if (!m_frontendChannel)
     762        5201 :         return;
     763             :     std::unique_ptr<ScriptFailedToParseNotification> messageData = ScriptFailedToParseNotification::create()
     764        5201 :         .setScriptId(scriptId)
     765             :         .setUrl(url)
     766             :         .setStartLine(startLine)
     767             :         .setStartColumn(startColumn)
     768             :         .setEndLine(endLine)
     769             :         .setEndColumn(endColumn)
     770             :         .setExecutionContextId(executionContextId)
     771             :         .setHash(hash)
     772             :         .build();
     773        5201 :     if (executionContextAuxData.isJust())
     774             :         messageData->setExecutionContextAuxData(std::move(executionContextAuxData).takeJust());
     775        5201 :     if (sourceMapURL.isJust())
     776       10402 :         messageData->setSourceMapURL(std::move(sourceMapURL).takeJust());
     777        5201 :     if (hasSourceURL.isJust())
     778        5201 :         messageData->setHasSourceURL(std::move(hasSourceURL).takeJust());
     779        5201 :     if (isModule.isJust())
     780        5201 :         messageData->setIsModule(std::move(isModule).takeJust());
     781        5201 :     if (length.isJust())
     782        5201 :         messageData->setLength(std::move(length).takeJust());
     783        5201 :     if (stackTrace.isJust())
     784             :         messageData->setStackTrace(std::move(stackTrace).takeJust());
     785       36407 :     m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("Debugger.scriptFailedToParse", std::move(messageData)));
     786             : }
     787             : 
     788       55227 : void Frontend::scriptParsed(const String& scriptId, const String& url, int startLine, int startColumn, int endLine, int endColumn, int executionContextId, const String& hash, Maybe<protocol::DictionaryValue> executionContextAuxData, Maybe<bool> isLiveEdit, Maybe<String> sourceMapURL, Maybe<bool> hasSourceURL, Maybe<bool> isModule, Maybe<int> length, Maybe<protocol::Runtime::StackTrace> stackTrace)
     789             : {
     790       55227 :     if (!m_frontendChannel)
     791       55227 :         return;
     792             :     std::unique_ptr<ScriptParsedNotification> messageData = ScriptParsedNotification::create()
     793       55227 :         .setScriptId(scriptId)
     794             :         .setUrl(url)
     795             :         .setStartLine(startLine)
     796             :         .setStartColumn(startColumn)
     797             :         .setEndLine(endLine)
     798             :         .setEndColumn(endColumn)
     799             :         .setExecutionContextId(executionContextId)
     800             :         .setHash(hash)
     801             :         .build();
     802       55227 :     if (executionContextAuxData.isJust())
     803             :         messageData->setExecutionContextAuxData(std::move(executionContextAuxData).takeJust());
     804       55227 :     if (isLiveEdit.isJust())
     805       55227 :         messageData->setIsLiveEdit(std::move(isLiveEdit).takeJust());
     806       55227 :     if (sourceMapURL.isJust())
     807      110454 :         messageData->setSourceMapURL(std::move(sourceMapURL).takeJust());
     808       55227 :     if (hasSourceURL.isJust())
     809       55227 :         messageData->setHasSourceURL(std::move(hasSourceURL).takeJust());
     810       55227 :     if (isModule.isJust())
     811       55227 :         messageData->setIsModule(std::move(isModule).takeJust());
     812       55227 :     if (length.isJust())
     813       55227 :         messageData->setLength(std::move(length).takeJust());
     814       55227 :     if (stackTrace.isJust())
     815             :         messageData->setStackTrace(std::move(stackTrace).takeJust());
     816      386589 :     m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("Debugger.scriptParsed", std::move(messageData)));
     817             : }
     818             : 
     819           0 : void Frontend::flush()
     820             : {
     821           0 :     m_frontendChannel->flushProtocolNotifications();
     822           0 : }
     823             : 
     824           0 : void Frontend::sendRawNotification(const String& notification)
     825             : {
     826           0 :     m_frontendChannel->sendProtocolNotification(InternalRawNotification::create(notification));
     827           0 : }
     828             : 
     829             : // --------------------- Dispatcher.
     830             : 
     831             : class DispatcherImpl : public protocol::DispatcherBase {
     832             : public:
     833        3834 :     DispatcherImpl(FrontendChannel* frontendChannel, Backend* backend)
     834             :         : DispatcherBase(frontendChannel)
     835       11502 :         , m_backend(backend) {
     836       11502 :         m_dispatchMap["Debugger.continueToLocation"] = &DispatcherImpl::continueToLocation;
     837       11502 :         m_dispatchMap["Debugger.disable"] = &DispatcherImpl::disable;
     838       11502 :         m_dispatchMap["Debugger.enable"] = &DispatcherImpl::enable;
     839       11502 :         m_dispatchMap["Debugger.evaluateOnCallFrame"] = &DispatcherImpl::evaluateOnCallFrame;
     840       11502 :         m_dispatchMap["Debugger.getPossibleBreakpoints"] = &DispatcherImpl::getPossibleBreakpoints;
     841       11502 :         m_dispatchMap["Debugger.getScriptSource"] = &DispatcherImpl::getScriptSource;
     842       11502 :         m_dispatchMap["Debugger.getStackTrace"] = &DispatcherImpl::getStackTrace;
     843       11502 :         m_dispatchMap["Debugger.pause"] = &DispatcherImpl::pause;
     844       11502 :         m_dispatchMap["Debugger.pauseOnAsyncCall"] = &DispatcherImpl::pauseOnAsyncCall;
     845       11502 :         m_dispatchMap["Debugger.removeBreakpoint"] = &DispatcherImpl::removeBreakpoint;
     846       11502 :         m_dispatchMap["Debugger.restartFrame"] = &DispatcherImpl::restartFrame;
     847       11502 :         m_dispatchMap["Debugger.resume"] = &DispatcherImpl::resume;
     848       11502 :         m_dispatchMap["Debugger.searchInContent"] = &DispatcherImpl::searchInContent;
     849       11502 :         m_dispatchMap["Debugger.setAsyncCallStackDepth"] = &DispatcherImpl::setAsyncCallStackDepth;
     850       11502 :         m_dispatchMap["Debugger.setBlackboxPatterns"] = &DispatcherImpl::setBlackboxPatterns;
     851       11502 :         m_dispatchMap["Debugger.setBlackboxedRanges"] = &DispatcherImpl::setBlackboxedRanges;
     852       11502 :         m_dispatchMap["Debugger.setBreakpoint"] = &DispatcherImpl::setBreakpoint;
     853       11502 :         m_dispatchMap["Debugger.setBreakpointByUrl"] = &DispatcherImpl::setBreakpointByUrl;
     854       11502 :         m_dispatchMap["Debugger.setBreakpointOnFunctionCall"] = &DispatcherImpl::setBreakpointOnFunctionCall;
     855       11502 :         m_dispatchMap["Debugger.setBreakpointsActive"] = &DispatcherImpl::setBreakpointsActive;
     856       11502 :         m_dispatchMap["Debugger.setPauseOnExceptions"] = &DispatcherImpl::setPauseOnExceptions;
     857       11502 :         m_dispatchMap["Debugger.setReturnValue"] = &DispatcherImpl::setReturnValue;
     858       11502 :         m_dispatchMap["Debugger.setScriptSource"] = &DispatcherImpl::setScriptSource;
     859       11502 :         m_dispatchMap["Debugger.setSkipAllPauses"] = &DispatcherImpl::setSkipAllPauses;
     860       11502 :         m_dispatchMap["Debugger.setVariableValue"] = &DispatcherImpl::setVariableValue;
     861       11502 :         m_dispatchMap["Debugger.stepInto"] = &DispatcherImpl::stepInto;
     862       11502 :         m_dispatchMap["Debugger.stepOut"] = &DispatcherImpl::stepOut;
     863       11502 :         m_dispatchMap["Debugger.stepOver"] = &DispatcherImpl::stepOver;
     864        3834 :     }
     865       11502 :     ~DispatcherImpl() override { }
     866             :     bool canDispatch(const String& method) override;
     867             :     void dispatch(int callId, const String& method, const String& message, std::unique_ptr<protocol::DictionaryValue> messageObject) override;
     868             :     std::unordered_map<String, String>& redirects() { return m_redirects; }
     869             : 
     870             : protected:
     871             :     using CallHandler = void (DispatcherImpl::*)(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> messageObject, ErrorSupport* errors);
     872             :     using DispatchMap = std::unordered_map<String, CallHandler>;
     873             :     DispatchMap m_dispatchMap;
     874             :     std::unordered_map<String, String> m_redirects;
     875             : 
     876             :     void continueToLocation(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     877             :     void disable(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     878             :     void enable(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     879             :     void evaluateOnCallFrame(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     880             :     void getPossibleBreakpoints(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     881             :     void getScriptSource(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     882             :     void getStackTrace(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     883             :     void pause(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     884             :     void pauseOnAsyncCall(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     885             :     void removeBreakpoint(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     886             :     void restartFrame(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     887             :     void resume(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     888             :     void searchInContent(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     889             :     void setAsyncCallStackDepth(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     890             :     void setBlackboxPatterns(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     891             :     void setBlackboxedRanges(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     892             :     void setBreakpoint(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     893             :     void setBreakpointByUrl(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     894             :     void setBreakpointOnFunctionCall(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     895             :     void setBreakpointsActive(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     896             :     void setPauseOnExceptions(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     897             :     void setReturnValue(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     898             :     void setScriptSource(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     899             :     void setSkipAllPauses(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     900             :     void setVariableValue(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     901             :     void stepInto(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     902             :     void stepOut(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     903             :     void stepOver(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
     904             : 
     905             :     Backend* m_backend;
     906             : };
     907             : 
     908       88594 : bool DispatcherImpl::canDispatch(const String& method) {
     909       88594 :     return m_dispatchMap.find(method) != m_dispatchMap.end();
     910             : }
     911             : 
     912       88594 : void DispatcherImpl::dispatch(int callId, const String& method, const String& message, std::unique_ptr<protocol::DictionaryValue> messageObject)
     913             : {
     914             :     std::unordered_map<String, CallHandler>::iterator it = m_dispatchMap.find(method);
     915             :     DCHECK(it != m_dispatchMap.end());
     916       88594 :     protocol::ErrorSupport errors;
     917      265782 :     (this->*(it->second))(callId, method, message, std::move(messageObject), &errors);
     918       88594 : }
     919             : 
     920             : 
     921          60 : void DispatcherImpl::continueToLocation(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
     922             : {
     923             :     // Prepare input parameters.
     924         180 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
     925          60 :     errors->push();
     926         120 :     protocol::Value* locationValue = object ? object->get("location") : nullptr;
     927          60 :     errors->setName("location");
     928             :     std::unique_ptr<protocol::Debugger::Location> in_location = ValueConversions<protocol::Debugger::Location>::fromValue(locationValue, errors);
     929         120 :     protocol::Value* targetCallFramesValue = object ? object->get("targetCallFrames") : nullptr;
     930             :     Maybe<String> in_targetCallFrames;
     931          60 :     if (targetCallFramesValue) {
     932          30 :         errors->setName("targetCallFrames");
     933          60 :         in_targetCallFrames = ValueConversions<String>::fromValue(targetCallFramesValue, errors);
     934             :     }
     935          60 :     errors->pop();
     936          60 :     if (errors->hasErrors()) {
     937           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
     938           0 :         return;
     939             :     }
     940             : 
     941          60 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
     942         240 :     DispatchResponse response = m_backend->continueToLocation(std::move(in_location), std::move(in_targetCallFrames));
     943          60 :     if (response.status() == DispatchResponse::kFallThrough) {
     944           0 :         channel()->fallThrough(callId, method, message);
     945           0 :         return;
     946             :     }
     947          60 :     if (weak->get())
     948          60 :         weak->get()->sendResponse(callId, response);
     949             :     return;
     950             : }
     951             : 
     952        1545 : void DispatcherImpl::disable(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
     953             : {
     954             : 
     955        1545 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
     956        1545 :     DispatchResponse response = m_backend->disable();
     957        1545 :     if (response.status() == DispatchResponse::kFallThrough) {
     958           0 :         channel()->fallThrough(callId, method, message);
     959           0 :         return;
     960             :     }
     961        1545 :     if (weak->get())
     962        1545 :         weak->get()->sendResponse(callId, response);
     963             :     return;
     964             : }
     965             : 
     966        3475 : void DispatcherImpl::enable(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
     967             : {
     968             :     // Declare output parameters.
     969        3475 :     String out_debuggerId;
     970             : 
     971        3475 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
     972        3475 :     DispatchResponse response = m_backend->enable(&out_debuggerId);
     973        3475 :     if (response.status() == DispatchResponse::kFallThrough) {
     974           0 :         channel()->fallThrough(callId, method, message);
     975           0 :         return;
     976             :     }
     977        3475 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
     978        3475 :     if (response.status() == DispatchResponse::kSuccess) {
     979       13900 :         result->setValue("debuggerId", ValueConversions<String>::toValue(out_debuggerId));
     980             :     }
     981        3475 :     if (weak->get())
     982        6950 :         weak->get()->sendResponse(callId, response, std::move(result));
     983             :     return;
     984             : }
     985             : 
     986       11097 : void DispatcherImpl::evaluateOnCallFrame(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
     987             : {
     988             :     // Prepare input parameters.
     989       33291 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
     990       11097 :     errors->push();
     991       22194 :     protocol::Value* callFrameIdValue = object ? object->get("callFrameId") : nullptr;
     992       11097 :     errors->setName("callFrameId");
     993       11097 :     String in_callFrameId = ValueConversions<String>::fromValue(callFrameIdValue, errors);
     994       22194 :     protocol::Value* expressionValue = object ? object->get("expression") : nullptr;
     995       11097 :     errors->setName("expression");
     996       11097 :     String in_expression = ValueConversions<String>::fromValue(expressionValue, errors);
     997       22194 :     protocol::Value* objectGroupValue = object ? object->get("objectGroup") : nullptr;
     998             :     Maybe<String> in_objectGroup;
     999       11097 :     if (objectGroupValue) {
    1000           0 :         errors->setName("objectGroup");
    1001           0 :         in_objectGroup = ValueConversions<String>::fromValue(objectGroupValue, errors);
    1002             :     }
    1003       22194 :     protocol::Value* includeCommandLineAPIValue = object ? object->get("includeCommandLineAPI") : nullptr;
    1004             :     Maybe<bool> in_includeCommandLineAPI;
    1005       11097 :     if (includeCommandLineAPIValue) {
    1006           0 :         errors->setName("includeCommandLineAPI");
    1007           0 :         in_includeCommandLineAPI = ValueConversions<bool>::fromValue(includeCommandLineAPIValue, errors);
    1008             :     }
    1009       22194 :     protocol::Value* silentValue = object ? object->get("silent") : nullptr;
    1010             :     Maybe<bool> in_silent;
    1011       11097 :     if (silentValue) {
    1012           0 :         errors->setName("silent");
    1013           0 :         in_silent = ValueConversions<bool>::fromValue(silentValue, errors);
    1014             :     }
    1015       22194 :     protocol::Value* returnByValueValue = object ? object->get("returnByValue") : nullptr;
    1016             :     Maybe<bool> in_returnByValue;
    1017       11097 :     if (returnByValueValue) {
    1018           0 :         errors->setName("returnByValue");
    1019           0 :         in_returnByValue = ValueConversions<bool>::fromValue(returnByValueValue, errors);
    1020             :     }
    1021       22194 :     protocol::Value* generatePreviewValue = object ? object->get("generatePreview") : nullptr;
    1022             :     Maybe<bool> in_generatePreview;
    1023       11097 :     if (generatePreviewValue) {
    1024           0 :         errors->setName("generatePreview");
    1025           0 :         in_generatePreview = ValueConversions<bool>::fromValue(generatePreviewValue, errors);
    1026             :     }
    1027       22194 :     protocol::Value* throwOnSideEffectValue = object ? object->get("throwOnSideEffect") : nullptr;
    1028             :     Maybe<bool> in_throwOnSideEffect;
    1029       11097 :     if (throwOnSideEffectValue) {
    1030       10437 :         errors->setName("throwOnSideEffect");
    1031       10437 :         in_throwOnSideEffect = ValueConversions<bool>::fromValue(throwOnSideEffectValue, errors);
    1032             :     }
    1033       22194 :     protocol::Value* timeoutValue = object ? object->get("timeout") : nullptr;
    1034             :     Maybe<double> in_timeout;
    1035       11097 :     if (timeoutValue) {
    1036          15 :         errors->setName("timeout");
    1037          15 :         in_timeout = ValueConversions<double>::fromValue(timeoutValue, errors);
    1038             :     }
    1039       11097 :     errors->pop();
    1040       11097 :     if (errors->hasErrors()) {
    1041           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1042           0 :         return;
    1043             :     }
    1044             :     // Declare output parameters.
    1045       11097 :     std::unique_ptr<protocol::Runtime::RemoteObject> out_result;
    1046             :     Maybe<protocol::Runtime::ExceptionDetails> out_exceptionDetails;
    1047             : 
    1048       11097 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1049       33291 :     DispatchResponse response = m_backend->evaluateOnCallFrame(in_callFrameId, in_expression, std::move(in_objectGroup), std::move(in_includeCommandLineAPI), std::move(in_silent), std::move(in_returnByValue), std::move(in_generatePreview), std::move(in_throwOnSideEffect), std::move(in_timeout), &out_result, &out_exceptionDetails);
    1050       11097 :     if (response.status() == DispatchResponse::kFallThrough) {
    1051           0 :         channel()->fallThrough(callId, method, message);
    1052           0 :         return;
    1053             :     }
    1054       11097 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1055       11097 :     if (response.status() == DispatchResponse::kSuccess) {
    1056       44292 :         result->setValue("result", ValueConversions<protocol::Runtime::RemoteObject>::toValue(out_result.get()));
    1057       11073 :         if (out_exceptionDetails.isJust())
    1058        4712 :             result->setValue("exceptionDetails", ValueConversions<protocol::Runtime::ExceptionDetails>::toValue(out_exceptionDetails.fromJust()));
    1059             :     }
    1060       11097 :     if (weak->get())
    1061       22194 :         weak->get()->sendResponse(callId, response, std::move(result));
    1062             :     return;
    1063             : }
    1064             : 
    1065         265 : void DispatcherImpl::getPossibleBreakpoints(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1066             : {
    1067             :     // Prepare input parameters.
    1068         795 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1069         265 :     errors->push();
    1070         530 :     protocol::Value* startValue = object ? object->get("start") : nullptr;
    1071         265 :     errors->setName("start");
    1072             :     std::unique_ptr<protocol::Debugger::Location> in_start = ValueConversions<protocol::Debugger::Location>::fromValue(startValue, errors);
    1073         530 :     protocol::Value* endValue = object ? object->get("end") : nullptr;
    1074             :     Maybe<protocol::Debugger::Location> in_end;
    1075         265 :     if (endValue) {
    1076         110 :         errors->setName("end");
    1077         110 :         in_end = ValueConversions<protocol::Debugger::Location>::fromValue(endValue, errors);
    1078             :     }
    1079         530 :     protocol::Value* restrictToFunctionValue = object ? object->get("restrictToFunction") : nullptr;
    1080             :     Maybe<bool> in_restrictToFunction;
    1081         265 :     if (restrictToFunctionValue) {
    1082           0 :         errors->setName("restrictToFunction");
    1083           0 :         in_restrictToFunction = ValueConversions<bool>::fromValue(restrictToFunctionValue, errors);
    1084             :     }
    1085         265 :     errors->pop();
    1086         265 :     if (errors->hasErrors()) {
    1087           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1088           0 :         return;
    1089             :     }
    1090             :     // Declare output parameters.
    1091         265 :     std::unique_ptr<protocol::Array<protocol::Debugger::BreakLocation>> out_locations;
    1092             : 
    1093         265 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1094        1060 :     DispatchResponse response = m_backend->getPossibleBreakpoints(std::move(in_start), std::move(in_end), std::move(in_restrictToFunction), &out_locations);
    1095         265 :     if (response.status() == DispatchResponse::kFallThrough) {
    1096           0 :         channel()->fallThrough(callId, method, message);
    1097           0 :         return;
    1098             :     }
    1099         265 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1100         265 :     if (response.status() == DispatchResponse::kSuccess) {
    1101        1020 :         result->setValue("locations", ValueConversions<protocol::Array<protocol::Debugger::BreakLocation>>::toValue(out_locations.get()));
    1102             :     }
    1103         265 :     if (weak->get())
    1104         530 :         weak->get()->sendResponse(callId, response, std::move(result));
    1105             :     return;
    1106             : }
    1107             : 
    1108       16094 : void DispatcherImpl::getScriptSource(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1109             : {
    1110             :     // Prepare input parameters.
    1111       48282 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1112       16094 :     errors->push();
    1113       32188 :     protocol::Value* scriptIdValue = object ? object->get("scriptId") : nullptr;
    1114       16094 :     errors->setName("scriptId");
    1115       16094 :     String in_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
    1116       16094 :     errors->pop();
    1117       16094 :     if (errors->hasErrors()) {
    1118           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1119           0 :         return;
    1120             :     }
    1121             :     // Declare output parameters.
    1122       16094 :     String out_scriptSource;
    1123             : 
    1124       16094 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1125       16094 :     DispatchResponse response = m_backend->getScriptSource(in_scriptId, &out_scriptSource);
    1126       16094 :     if (response.status() == DispatchResponse::kFallThrough) {
    1127           0 :         channel()->fallThrough(callId, method, message);
    1128           0 :         return;
    1129             :     }
    1130       16094 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1131       16094 :     if (response.status() == DispatchResponse::kSuccess) {
    1132       62376 :         result->setValue("scriptSource", ValueConversions<String>::toValue(out_scriptSource));
    1133             :     }
    1134       16094 :     if (weak->get())
    1135       32188 :         weak->get()->sendResponse(callId, response, std::move(result));
    1136             :     return;
    1137             : }
    1138             : 
    1139          35 : void DispatcherImpl::getStackTrace(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1140             : {
    1141             :     // Prepare input parameters.
    1142         105 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1143          35 :     errors->push();
    1144          70 :     protocol::Value* stackTraceIdValue = object ? object->get("stackTraceId") : nullptr;
    1145          35 :     errors->setName("stackTraceId");
    1146             :     std::unique_ptr<protocol::Runtime::StackTraceId> in_stackTraceId = ValueConversions<protocol::Runtime::StackTraceId>::fromValue(stackTraceIdValue, errors);
    1147          35 :     errors->pop();
    1148          35 :     if (errors->hasErrors()) {
    1149           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1150           0 :         return;
    1151             :     }
    1152             :     // Declare output parameters.
    1153          35 :     std::unique_ptr<protocol::Runtime::StackTrace> out_stackTrace;
    1154             : 
    1155          35 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1156         105 :     DispatchResponse response = m_backend->getStackTrace(std::move(in_stackTraceId), &out_stackTrace);
    1157          35 :     if (response.status() == DispatchResponse::kFallThrough) {
    1158           0 :         channel()->fallThrough(callId, method, message);
    1159           0 :         return;
    1160             :     }
    1161          35 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1162          35 :     if (response.status() == DispatchResponse::kSuccess) {
    1163         140 :         result->setValue("stackTrace", ValueConversions<protocol::Runtime::StackTrace>::toValue(out_stackTrace.get()));
    1164             :     }
    1165          35 :     if (weak->get())
    1166          70 :         weak->get()->sendResponse(callId, response, std::move(result));
    1167             :     return;
    1168             : }
    1169             : 
    1170         265 : void DispatcherImpl::pause(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1171             : {
    1172             : 
    1173         265 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1174         265 :     DispatchResponse response = m_backend->pause();
    1175         265 :     if (response.status() == DispatchResponse::kFallThrough) {
    1176           0 :         channel()->fallThrough(callId, method, message);
    1177           0 :         return;
    1178             :     }
    1179         265 :     if (weak->get())
    1180         265 :         weak->get()->sendResponse(callId, response);
    1181             :     return;
    1182             : }
    1183             : 
    1184          95 : void DispatcherImpl::pauseOnAsyncCall(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1185             : {
    1186             :     // Prepare input parameters.
    1187         285 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1188          95 :     errors->push();
    1189         190 :     protocol::Value* parentStackTraceIdValue = object ? object->get("parentStackTraceId") : nullptr;
    1190          95 :     errors->setName("parentStackTraceId");
    1191             :     std::unique_ptr<protocol::Runtime::StackTraceId> in_parentStackTraceId = ValueConversions<protocol::Runtime::StackTraceId>::fromValue(parentStackTraceIdValue, errors);
    1192          95 :     errors->pop();
    1193          95 :     if (errors->hasErrors()) {
    1194           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1195           0 :         return;
    1196             :     }
    1197             : 
    1198          95 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1199         285 :     DispatchResponse response = m_backend->pauseOnAsyncCall(std::move(in_parentStackTraceId));
    1200          95 :     if (response.status() == DispatchResponse::kFallThrough) {
    1201           0 :         channel()->fallThrough(callId, method, message);
    1202           0 :         return;
    1203             :     }
    1204          95 :     if (weak->get())
    1205          95 :         weak->get()->sendResponse(callId, response);
    1206             :     return;
    1207             : }
    1208             : 
    1209         789 : void DispatcherImpl::removeBreakpoint(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1210             : {
    1211             :     // Prepare input parameters.
    1212        2367 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1213         789 :     errors->push();
    1214        1578 :     protocol::Value* breakpointIdValue = object ? object->get("breakpointId") : nullptr;
    1215         789 :     errors->setName("breakpointId");
    1216         789 :     String in_breakpointId = ValueConversions<String>::fromValue(breakpointIdValue, errors);
    1217         789 :     errors->pop();
    1218         789 :     if (errors->hasErrors()) {
    1219           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1220           0 :         return;
    1221             :     }
    1222             : 
    1223         789 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1224         789 :     DispatchResponse response = m_backend->removeBreakpoint(in_breakpointId);
    1225         789 :     if (response.status() == DispatchResponse::kFallThrough) {
    1226           0 :         channel()->fallThrough(callId, method, message);
    1227           0 :         return;
    1228             :     }
    1229         789 :     if (weak->get())
    1230         789 :         weak->get()->sendResponse(callId, response);
    1231             :     return;
    1232             : }
    1233             : 
    1234         104 : void DispatcherImpl::restartFrame(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1235             : {
    1236             :     // Prepare input parameters.
    1237         312 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1238         104 :     errors->push();
    1239         208 :     protocol::Value* callFrameIdValue = object ? object->get("callFrameId") : nullptr;
    1240         104 :     errors->setName("callFrameId");
    1241         104 :     String in_callFrameId = ValueConversions<String>::fromValue(callFrameIdValue, errors);
    1242         104 :     errors->pop();
    1243         104 :     if (errors->hasErrors()) {
    1244           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1245           0 :         return;
    1246             :     }
    1247             :     // Declare output parameters.
    1248         104 :     std::unique_ptr<protocol::Array<protocol::Debugger::CallFrame>> out_callFrames;
    1249             :     Maybe<protocol::Runtime::StackTrace> out_asyncStackTrace;
    1250             :     Maybe<protocol::Runtime::StackTraceId> out_asyncStackTraceId;
    1251             : 
    1252         104 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1253         104 :     DispatchResponse response = m_backend->restartFrame(in_callFrameId, &out_callFrames, &out_asyncStackTrace, &out_asyncStackTraceId);
    1254         104 :     if (response.status() == DispatchResponse::kFallThrough) {
    1255           0 :         channel()->fallThrough(callId, method, message);
    1256           0 :         return;
    1257             :     }
    1258         104 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1259         104 :     if (response.status() == DispatchResponse::kSuccess) {
    1260           0 :         result->setValue("callFrames", ValueConversions<protocol::Array<protocol::Debugger::CallFrame>>::toValue(out_callFrames.get()));
    1261           0 :         if (out_asyncStackTrace.isJust())
    1262           0 :             result->setValue("asyncStackTrace", ValueConversions<protocol::Runtime::StackTrace>::toValue(out_asyncStackTrace.fromJust()));
    1263           0 :         if (out_asyncStackTraceId.isJust())
    1264           0 :             result->setValue("asyncStackTraceId", ValueConversions<protocol::Runtime::StackTraceId>::toValue(out_asyncStackTraceId.fromJust()));
    1265             :     }
    1266         104 :     if (weak->get())
    1267         208 :         weak->get()->sendResponse(callId, response, std::move(result));
    1268             :     return;
    1269             : }
    1270             : 
    1271        2283 : void DispatcherImpl::resume(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1272             : {
    1273             : 
    1274        2283 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1275        2283 :     DispatchResponse response = m_backend->resume();
    1276        2283 :     if (response.status() == DispatchResponse::kFallThrough) {
    1277           0 :         channel()->fallThrough(callId, method, message);
    1278           0 :         return;
    1279             :     }
    1280        2283 :     if (weak->get())
    1281        2283 :         weak->get()->sendResponse(callId, response);
    1282             :     return;
    1283             : }
    1284             : 
    1285           0 : void DispatcherImpl::searchInContent(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1286             : {
    1287             :     // Prepare input parameters.
    1288           0 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1289           0 :     errors->push();
    1290           0 :     protocol::Value* scriptIdValue = object ? object->get("scriptId") : nullptr;
    1291           0 :     errors->setName("scriptId");
    1292           0 :     String in_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
    1293           0 :     protocol::Value* queryValue = object ? object->get("query") : nullptr;
    1294           0 :     errors->setName("query");
    1295           0 :     String in_query = ValueConversions<String>::fromValue(queryValue, errors);
    1296           0 :     protocol::Value* caseSensitiveValue = object ? object->get("caseSensitive") : nullptr;
    1297             :     Maybe<bool> in_caseSensitive;
    1298           0 :     if (caseSensitiveValue) {
    1299           0 :         errors->setName("caseSensitive");
    1300           0 :         in_caseSensitive = ValueConversions<bool>::fromValue(caseSensitiveValue, errors);
    1301             :     }
    1302           0 :     protocol::Value* isRegexValue = object ? object->get("isRegex") : nullptr;
    1303             :     Maybe<bool> in_isRegex;
    1304           0 :     if (isRegexValue) {
    1305           0 :         errors->setName("isRegex");
    1306           0 :         in_isRegex = ValueConversions<bool>::fromValue(isRegexValue, errors);
    1307             :     }
    1308           0 :     errors->pop();
    1309           0 :     if (errors->hasErrors()) {
    1310           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1311           0 :         return;
    1312             :     }
    1313             :     // Declare output parameters.
    1314           0 :     std::unique_ptr<protocol::Array<protocol::Debugger::SearchMatch>> out_result;
    1315             : 
    1316           0 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1317           0 :     DispatchResponse response = m_backend->searchInContent(in_scriptId, in_query, std::move(in_caseSensitive), std::move(in_isRegex), &out_result);
    1318           0 :     if (response.status() == DispatchResponse::kFallThrough) {
    1319           0 :         channel()->fallThrough(callId, method, message);
    1320           0 :         return;
    1321             :     }
    1322           0 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1323           0 :     if (response.status() == DispatchResponse::kSuccess) {
    1324           0 :         result->setValue("result", ValueConversions<protocol::Array<protocol::Debugger::SearchMatch>>::toValue(out_result.get()));
    1325             :     }
    1326           0 :     if (weak->get())
    1327           0 :         weak->get()->sendResponse(callId, response, std::move(result));
    1328             :     return;
    1329             : }
    1330             : 
    1331         350 : void DispatcherImpl::setAsyncCallStackDepth(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1332             : {
    1333             :     // Prepare input parameters.
    1334        1050 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1335         350 :     errors->push();
    1336         700 :     protocol::Value* maxDepthValue = object ? object->get("maxDepth") : nullptr;
    1337         350 :     errors->setName("maxDepth");
    1338         350 :     int in_maxDepth = ValueConversions<int>::fromValue(maxDepthValue, errors);
    1339         350 :     errors->pop();
    1340         350 :     if (errors->hasErrors()) {
    1341           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1342           0 :         return;
    1343             :     }
    1344             : 
    1345         350 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1346         350 :     DispatchResponse response = m_backend->setAsyncCallStackDepth(in_maxDepth);
    1347         350 :     if (response.status() == DispatchResponse::kFallThrough) {
    1348           0 :         channel()->fallThrough(callId, method, message);
    1349           0 :         return;
    1350             :     }
    1351         350 :     if (weak->get())
    1352         350 :         weak->get()->sendResponse(callId, response);
    1353             :     return;
    1354             : }
    1355             : 
    1356         105 : void DispatcherImpl::setBlackboxPatterns(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1357             : {
    1358             :     // Prepare input parameters.
    1359         315 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1360         105 :     errors->push();
    1361         210 :     protocol::Value* patternsValue = object ? object->get("patterns") : nullptr;
    1362         105 :     errors->setName("patterns");
    1363             :     std::unique_ptr<protocol::Array<String>> in_patterns = ValueConversions<protocol::Array<String>>::fromValue(patternsValue, errors);
    1364         105 :     errors->pop();
    1365         105 :     if (errors->hasErrors()) {
    1366           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1367           0 :         return;
    1368             :     }
    1369             : 
    1370         105 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1371         315 :     DispatchResponse response = m_backend->setBlackboxPatterns(std::move(in_patterns));
    1372         105 :     if (response.status() == DispatchResponse::kFallThrough) {
    1373           0 :         channel()->fallThrough(callId, method, message);
    1374           0 :         return;
    1375             :     }
    1376         105 :     if (weak->get())
    1377         105 :         weak->get()->sendResponse(callId, response);
    1378             :     return;
    1379             : }
    1380             : 
    1381          55 : void DispatcherImpl::setBlackboxedRanges(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1382             : {
    1383             :     // Prepare input parameters.
    1384         165 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1385          55 :     errors->push();
    1386         110 :     protocol::Value* scriptIdValue = object ? object->get("scriptId") : nullptr;
    1387          55 :     errors->setName("scriptId");
    1388          55 :     String in_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
    1389         110 :     protocol::Value* positionsValue = object ? object->get("positions") : nullptr;
    1390          55 :     errors->setName("positions");
    1391             :     std::unique_ptr<protocol::Array<protocol::Debugger::ScriptPosition>> in_positions = ValueConversions<protocol::Array<protocol::Debugger::ScriptPosition>>::fromValue(positionsValue, errors);
    1392          55 :     errors->pop();
    1393          55 :     if (errors->hasErrors()) {
    1394           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1395           0 :         return;
    1396             :     }
    1397             : 
    1398          55 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1399         165 :     DispatchResponse response = m_backend->setBlackboxedRanges(in_scriptId, std::move(in_positions));
    1400          55 :     if (response.status() == DispatchResponse::kFallThrough) {
    1401           0 :         channel()->fallThrough(callId, method, message);
    1402           0 :         return;
    1403             :     }
    1404          55 :     if (weak->get())
    1405          55 :         weak->get()->sendResponse(callId, response);
    1406             :     return;
    1407             : }
    1408             : 
    1409        1954 : void DispatcherImpl::setBreakpoint(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1410             : {
    1411             :     // Prepare input parameters.
    1412        5862 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1413        1954 :     errors->push();
    1414        3908 :     protocol::Value* locationValue = object ? object->get("location") : nullptr;
    1415        1954 :     errors->setName("location");
    1416             :     std::unique_ptr<protocol::Debugger::Location> in_location = ValueConversions<protocol::Debugger::Location>::fromValue(locationValue, errors);
    1417        3908 :     protocol::Value* conditionValue = object ? object->get("condition") : nullptr;
    1418             :     Maybe<String> in_condition;
    1419        1954 :     if (conditionValue) {
    1420         180 :         errors->setName("condition");
    1421         360 :         in_condition = ValueConversions<String>::fromValue(conditionValue, errors);
    1422             :     }
    1423        1954 :     errors->pop();
    1424        1954 :     if (errors->hasErrors()) {
    1425          10 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1426           5 :         return;
    1427             :     }
    1428             :     // Declare output parameters.
    1429        1949 :     String out_breakpointId;
    1430        1949 :     std::unique_ptr<protocol::Debugger::Location> out_actualLocation;
    1431             : 
    1432        1949 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1433        7796 :     DispatchResponse response = m_backend->setBreakpoint(std::move(in_location), std::move(in_condition), &out_breakpointId, &out_actualLocation);
    1434        1949 :     if (response.status() == DispatchResponse::kFallThrough) {
    1435           0 :         channel()->fallThrough(callId, method, message);
    1436           0 :         return;
    1437             :     }
    1438        1949 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1439        1949 :     if (response.status() == DispatchResponse::kSuccess) {
    1440        7220 :         result->setValue("breakpointId", ValueConversions<String>::toValue(out_breakpointId));
    1441        7220 :         result->setValue("actualLocation", ValueConversions<protocol::Debugger::Location>::toValue(out_actualLocation.get()));
    1442             :     }
    1443        1949 :     if (weak->get())
    1444        3898 :         weak->get()->sendResponse(callId, response, std::move(result));
    1445             :     return;
    1446             : }
    1447             : 
    1448         230 : void DispatcherImpl::setBreakpointByUrl(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1449             : {
    1450             :     // Prepare input parameters.
    1451         690 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1452         230 :     errors->push();
    1453         460 :     protocol::Value* lineNumberValue = object ? object->get("lineNumber") : nullptr;
    1454         230 :     errors->setName("lineNumber");
    1455         230 :     int in_lineNumber = ValueConversions<int>::fromValue(lineNumberValue, errors);
    1456         460 :     protocol::Value* urlValue = object ? object->get("url") : nullptr;
    1457             :     Maybe<String> in_url;
    1458         230 :     if (urlValue) {
    1459         215 :         errors->setName("url");
    1460         430 :         in_url = ValueConversions<String>::fromValue(urlValue, errors);
    1461             :     }
    1462         460 :     protocol::Value* urlRegexValue = object ? object->get("urlRegex") : nullptr;
    1463             :     Maybe<String> in_urlRegex;
    1464         230 :     if (urlRegexValue) {
    1465           5 :         errors->setName("urlRegex");
    1466          10 :         in_urlRegex = ValueConversions<String>::fromValue(urlRegexValue, errors);
    1467             :     }
    1468         460 :     protocol::Value* scriptHashValue = object ? object->get("scriptHash") : nullptr;
    1469             :     Maybe<String> in_scriptHash;
    1470         230 :     if (scriptHashValue) {
    1471          10 :         errors->setName("scriptHash");
    1472          20 :         in_scriptHash = ValueConversions<String>::fromValue(scriptHashValue, errors);
    1473             :     }
    1474         460 :     protocol::Value* columnNumberValue = object ? object->get("columnNumber") : nullptr;
    1475             :     Maybe<int> in_columnNumber;
    1476         230 :     if (columnNumberValue) {
    1477          85 :         errors->setName("columnNumber");
    1478          85 :         in_columnNumber = ValueConversions<int>::fromValue(columnNumberValue, errors);
    1479             :     }
    1480         460 :     protocol::Value* conditionValue = object ? object->get("condition") : nullptr;
    1481             :     Maybe<String> in_condition;
    1482         230 :     if (conditionValue) {
    1483          10 :         errors->setName("condition");
    1484          20 :         in_condition = ValueConversions<String>::fromValue(conditionValue, errors);
    1485             :     }
    1486         230 :     errors->pop();
    1487         230 :     if (errors->hasErrors()) {
    1488           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1489           0 :         return;
    1490             :     }
    1491             :     // Declare output parameters.
    1492         230 :     String out_breakpointId;
    1493         230 :     std::unique_ptr<protocol::Array<protocol::Debugger::Location>> out_locations;
    1494             : 
    1495         230 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1496        1380 :     DispatchResponse response = m_backend->setBreakpointByUrl(in_lineNumber, std::move(in_url), std::move(in_urlRegex), std::move(in_scriptHash), std::move(in_columnNumber), std::move(in_condition), &out_breakpointId, &out_locations);
    1497         230 :     if (response.status() == DispatchResponse::kFallThrough) {
    1498           0 :         channel()->fallThrough(callId, method, message);
    1499           0 :         return;
    1500             :     }
    1501         230 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1502         230 :     if (response.status() == DispatchResponse::kSuccess) {
    1503         920 :         result->setValue("breakpointId", ValueConversions<String>::toValue(out_breakpointId));
    1504         920 :         result->setValue("locations", ValueConversions<protocol::Array<protocol::Debugger::Location>>::toValue(out_locations.get()));
    1505             :     }
    1506         230 :     if (weak->get())
    1507         460 :         weak->get()->sendResponse(callId, response, std::move(result));
    1508             :     return;
    1509             : }
    1510             : 
    1511          20 : void DispatcherImpl::setBreakpointOnFunctionCall(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1512             : {
    1513             :     // Prepare input parameters.
    1514          60 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1515          20 :     errors->push();
    1516          40 :     protocol::Value* objectIdValue = object ? object->get("objectId") : nullptr;
    1517          20 :     errors->setName("objectId");
    1518          20 :     String in_objectId = ValueConversions<String>::fromValue(objectIdValue, errors);
    1519          40 :     protocol::Value* conditionValue = object ? object->get("condition") : nullptr;
    1520             :     Maybe<String> in_condition;
    1521          20 :     if (conditionValue) {
    1522           5 :         errors->setName("condition");
    1523          10 :         in_condition = ValueConversions<String>::fromValue(conditionValue, errors);
    1524             :     }
    1525          20 :     errors->pop();
    1526          20 :     if (errors->hasErrors()) {
    1527           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1528           0 :         return;
    1529             :     }
    1530             :     // Declare output parameters.
    1531          20 :     String out_breakpointId;
    1532             : 
    1533          20 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1534          60 :     DispatchResponse response = m_backend->setBreakpointOnFunctionCall(in_objectId, std::move(in_condition), &out_breakpointId);
    1535          20 :     if (response.status() == DispatchResponse::kFallThrough) {
    1536           0 :         channel()->fallThrough(callId, method, message);
    1537           0 :         return;
    1538             :     }
    1539          20 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1540          20 :     if (response.status() == DispatchResponse::kSuccess) {
    1541          60 :         result->setValue("breakpointId", ValueConversions<String>::toValue(out_breakpointId));
    1542             :     }
    1543          20 :     if (weak->get())
    1544          40 :         weak->get()->sendResponse(callId, response, std::move(result));
    1545             :     return;
    1546             : }
    1547             : 
    1548         138 : void DispatcherImpl::setBreakpointsActive(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1549             : {
    1550             :     // Prepare input parameters.
    1551         414 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1552         138 :     errors->push();
    1553         276 :     protocol::Value* activeValue = object ? object->get("active") : nullptr;
    1554         138 :     errors->setName("active");
    1555         138 :     bool in_active = ValueConversions<bool>::fromValue(activeValue, errors);
    1556         138 :     errors->pop();
    1557         138 :     if (errors->hasErrors()) {
    1558           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1559           0 :         return;
    1560             :     }
    1561             : 
    1562         138 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1563         138 :     DispatchResponse response = m_backend->setBreakpointsActive(in_active);
    1564         138 :     if (response.status() == DispatchResponse::kFallThrough) {
    1565           0 :         channel()->fallThrough(callId, method, message);
    1566           0 :         return;
    1567             :     }
    1568         138 :     if (weak->get())
    1569         138 :         weak->get()->sendResponse(callId, response);
    1570             :     return;
    1571             : }
    1572             : 
    1573        4746 : void DispatcherImpl::setPauseOnExceptions(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1574             : {
    1575             :     // Prepare input parameters.
    1576       14238 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1577        4746 :     errors->push();
    1578        9492 :     protocol::Value* stateValue = object ? object->get("state") : nullptr;
    1579        4746 :     errors->setName("state");
    1580        4746 :     String in_state = ValueConversions<String>::fromValue(stateValue, errors);
    1581        4746 :     errors->pop();
    1582        4746 :     if (errors->hasErrors()) {
    1583           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1584           0 :         return;
    1585             :     }
    1586             : 
    1587        4746 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1588        4746 :     DispatchResponse response = m_backend->setPauseOnExceptions(in_state);
    1589        4746 :     if (response.status() == DispatchResponse::kFallThrough) {
    1590           0 :         channel()->fallThrough(callId, method, message);
    1591           0 :         return;
    1592             :     }
    1593        4746 :     if (weak->get())
    1594        4746 :         weak->get()->sendResponse(callId, response);
    1595             :     return;
    1596             : }
    1597             : 
    1598          15 : void DispatcherImpl::setReturnValue(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1599             : {
    1600             :     // Prepare input parameters.
    1601          45 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1602          15 :     errors->push();
    1603          30 :     protocol::Value* newValueValue = object ? object->get("newValue") : nullptr;
    1604          15 :     errors->setName("newValue");
    1605             :     std::unique_ptr<protocol::Runtime::CallArgument> in_newValue = ValueConversions<protocol::Runtime::CallArgument>::fromValue(newValueValue, errors);
    1606          15 :     errors->pop();
    1607          15 :     if (errors->hasErrors()) {
    1608           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1609           0 :         return;
    1610             :     }
    1611             : 
    1612          15 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1613          45 :     DispatchResponse response = m_backend->setReturnValue(std::move(in_newValue));
    1614          15 :     if (response.status() == DispatchResponse::kFallThrough) {
    1615           0 :         channel()->fallThrough(callId, method, message);
    1616           0 :         return;
    1617             :     }
    1618          15 :     if (weak->get())
    1619          15 :         weak->get()->sendResponse(callId, response);
    1620             :     return;
    1621             : }
    1622             : 
    1623          64 : void DispatcherImpl::setScriptSource(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1624             : {
    1625             :     // Prepare input parameters.
    1626         192 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1627          64 :     errors->push();
    1628         128 :     protocol::Value* scriptIdValue = object ? object->get("scriptId") : nullptr;
    1629          64 :     errors->setName("scriptId");
    1630          64 :     String in_scriptId = ValueConversions<String>::fromValue(scriptIdValue, errors);
    1631         128 :     protocol::Value* scriptSourceValue = object ? object->get("scriptSource") : nullptr;
    1632          64 :     errors->setName("scriptSource");
    1633          64 :     String in_scriptSource = ValueConversions<String>::fromValue(scriptSourceValue, errors);
    1634         128 :     protocol::Value* dryRunValue = object ? object->get("dryRun") : nullptr;
    1635             :     Maybe<bool> in_dryRun;
    1636          64 :     if (dryRunValue) {
    1637           0 :         errors->setName("dryRun");
    1638           0 :         in_dryRun = ValueConversions<bool>::fromValue(dryRunValue, errors);
    1639             :     }
    1640          64 :     errors->pop();
    1641          64 :     if (errors->hasErrors()) {
    1642          18 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1643           9 :         return;
    1644             :     }
    1645             :     // Declare output parameters.
    1646             :     Maybe<protocol::Array<protocol::Debugger::CallFrame>> out_callFrames;
    1647             :     Maybe<bool> out_stackChanged;
    1648             :     Maybe<protocol::Runtime::StackTrace> out_asyncStackTrace;
    1649             :     Maybe<protocol::Runtime::StackTraceId> out_asyncStackTraceId;
    1650             :     Maybe<protocol::Runtime::ExceptionDetails> out_exceptionDetails;
    1651             : 
    1652          55 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1653         110 :     DispatchResponse response = m_backend->setScriptSource(in_scriptId, in_scriptSource, std::move(in_dryRun), &out_callFrames, &out_stackChanged, &out_asyncStackTrace, &out_asyncStackTraceId, &out_exceptionDetails);
    1654          55 :     if (response.status() == DispatchResponse::kFallThrough) {
    1655           0 :         channel()->fallThrough(callId, method, message);
    1656           0 :         return;
    1657             :     }
    1658          55 :     std::unique_ptr<protocol::DictionaryValue> result = DictionaryValue::create();
    1659          55 :     if (response.status() == DispatchResponse::kSuccess) {
    1660          50 :         if (out_callFrames.isJust())
    1661         160 :             result->setValue("callFrames", ValueConversions<protocol::Array<protocol::Debugger::CallFrame>>::toValue(out_callFrames.fromJust()));
    1662          50 :         if (out_stackChanged.isJust())
    1663         200 :             result->setValue("stackChanged", ValueConversions<bool>::toValue(out_stackChanged.fromJust()));
    1664          50 :         if (out_asyncStackTrace.isJust())
    1665           0 :             result->setValue("asyncStackTrace", ValueConversions<protocol::Runtime::StackTrace>::toValue(out_asyncStackTrace.fromJust()));
    1666          50 :         if (out_asyncStackTraceId.isJust())
    1667           0 :             result->setValue("asyncStackTraceId", ValueConversions<protocol::Runtime::StackTraceId>::toValue(out_asyncStackTraceId.fromJust()));
    1668          50 :         if (out_exceptionDetails.isJust())
    1669          40 :             result->setValue("exceptionDetails", ValueConversions<protocol::Runtime::ExceptionDetails>::toValue(out_exceptionDetails.fromJust()));
    1670             :     }
    1671          55 :     if (weak->get())
    1672         110 :         weak->get()->sendResponse(callId, response, std::move(result));
    1673             :     return;
    1674             : }
    1675             : 
    1676          35 : void DispatcherImpl::setSkipAllPauses(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1677             : {
    1678             :     // Prepare input parameters.
    1679         105 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1680          35 :     errors->push();
    1681          70 :     protocol::Value* skipValue = object ? object->get("skip") : nullptr;
    1682          35 :     errors->setName("skip");
    1683          35 :     bool in_skip = ValueConversions<bool>::fromValue(skipValue, errors);
    1684          35 :     errors->pop();
    1685          35 :     if (errors->hasErrors()) {
    1686           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1687           0 :         return;
    1688             :     }
    1689             : 
    1690          35 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1691          35 :     DispatchResponse response = m_backend->setSkipAllPauses(in_skip);
    1692          35 :     if (response.status() == DispatchResponse::kFallThrough) {
    1693           0 :         channel()->fallThrough(callId, method, message);
    1694           0 :         return;
    1695             :     }
    1696          35 :     if (weak->get())
    1697          35 :         weak->get()->sendResponse(callId, response);
    1698             :     return;
    1699             : }
    1700             : 
    1701         221 : void DispatcherImpl::setVariableValue(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1702             : {
    1703             :     // Prepare input parameters.
    1704         663 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1705         221 :     errors->push();
    1706         442 :     protocol::Value* scopeNumberValue = object ? object->get("scopeNumber") : nullptr;
    1707         221 :     errors->setName("scopeNumber");
    1708         221 :     int in_scopeNumber = ValueConversions<int>::fromValue(scopeNumberValue, errors);
    1709         442 :     protocol::Value* variableNameValue = object ? object->get("variableName") : nullptr;
    1710         221 :     errors->setName("variableName");
    1711         221 :     String in_variableName = ValueConversions<String>::fromValue(variableNameValue, errors);
    1712         442 :     protocol::Value* newValueValue = object ? object->get("newValue") : nullptr;
    1713         221 :     errors->setName("newValue");
    1714             :     std::unique_ptr<protocol::Runtime::CallArgument> in_newValue = ValueConversions<protocol::Runtime::CallArgument>::fromValue(newValueValue, errors);
    1715         442 :     protocol::Value* callFrameIdValue = object ? object->get("callFrameId") : nullptr;
    1716         221 :     errors->setName("callFrameId");
    1717         221 :     String in_callFrameId = ValueConversions<String>::fromValue(callFrameIdValue, errors);
    1718         221 :     errors->pop();
    1719         221 :     if (errors->hasErrors()) {
    1720           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1721           0 :         return;
    1722             :     }
    1723             : 
    1724         221 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1725         663 :     DispatchResponse response = m_backend->setVariableValue(in_scopeNumber, in_variableName, std::move(in_newValue), in_callFrameId);
    1726         221 :     if (response.status() == DispatchResponse::kFallThrough) {
    1727           0 :         channel()->fallThrough(callId, method, message);
    1728           0 :         return;
    1729             :     }
    1730         221 :     if (weak->get())
    1731         221 :         weak->get()->sendResponse(callId, response);
    1732             :     return;
    1733             : }
    1734             : 
    1735       36408 : void DispatcherImpl::stepInto(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1736             : {
    1737             :     // Prepare input parameters.
    1738      109224 :     protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params"));
    1739       36408 :     errors->push();
    1740       39868 :     protocol::Value* breakOnAsyncCallValue = object ? object->get("breakOnAsyncCall") : nullptr;
    1741             :     Maybe<bool> in_breakOnAsyncCall;
    1742       36408 :     if (breakOnAsyncCallValue) {
    1743         120 :         errors->setName("breakOnAsyncCall");
    1744         120 :         in_breakOnAsyncCall = ValueConversions<bool>::fromValue(breakOnAsyncCallValue, errors);
    1745             :     }
    1746       36408 :     errors->pop();
    1747       36408 :     if (errors->hasErrors()) {
    1748           0 :         reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors);
    1749           0 :         return;
    1750             :     }
    1751             : 
    1752       36408 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1753       72816 :     DispatchResponse response = m_backend->stepInto(std::move(in_breakOnAsyncCall));
    1754       36408 :     if (response.status() == DispatchResponse::kFallThrough) {
    1755           0 :         channel()->fallThrough(callId, method, message);
    1756           0 :         return;
    1757             :     }
    1758       36408 :     if (weak->get())
    1759       36408 :         weak->get()->sendResponse(callId, response);
    1760             :     return;
    1761             : }
    1762             : 
    1763         539 : void DispatcherImpl::stepOut(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1764             : {
    1765             : 
    1766         539 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1767         539 :     DispatchResponse response = m_backend->stepOut();
    1768         539 :     if (response.status() == DispatchResponse::kFallThrough) {
    1769           0 :         channel()->fallThrough(callId, method, message);
    1770           0 :         return;
    1771             :     }
    1772         539 :     if (weak->get())
    1773         539 :         weak->get()->sendResponse(callId, response);
    1774             :     return;
    1775             : }
    1776             : 
    1777        7607 : void DispatcherImpl::stepOver(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
    1778             : {
    1779             : 
    1780        7607 :     std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
    1781        7607 :     DispatchResponse response = m_backend->stepOver();
    1782        7607 :     if (response.status() == DispatchResponse::kFallThrough) {
    1783           0 :         channel()->fallThrough(callId, method, message);
    1784           0 :         return;
    1785             :     }
    1786        7607 :     if (weak->get())
    1787        7607 :         weak->get()->sendResponse(callId, response);
    1788             :     return;
    1789             : }
    1790             : 
    1791             : // static
    1792        3834 : void Dispatcher::wire(UberDispatcher* uber, Backend* backend)
    1793             : {
    1794        3834 :     std::unique_ptr<DispatcherImpl> dispatcher(new DispatcherImpl(uber->channel(), backend));
    1795        3834 :     uber->setupRedirects(dispatcher->redirects());
    1796       11502 :     uber->registerBackend("Debugger", std::move(dispatcher));
    1797        3834 : }
    1798             : 
    1799             : } // Debugger
    1800             : } // namespace v8_inspector
    1801             : } // namespace protocol

Generated by: LCOV version 1.10