%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
// This file is generated by TypeBuilder_cpp.template. // Copyright (c) 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "src/node/inspector/protocol/NodeRuntime.h" #include "src/node/inspector/protocol/Protocol.h" namespace node { namespace inspector { namespace protocol { namespace NodeRuntime { // ------------- Enum values from types. const char Metainfo::domainName[] = "NodeRuntime"; const char Metainfo::commandPrefix[] = "NodeRuntime."; const char Metainfo::version[] = "1.0"; // ------------- Enum values from params. // ------------- Frontend notifications. void Frontend::waitingForDisconnect() { if (!m_frontendChannel) return; m_frontendChannel->sendProtocolNotification(InternalResponse::createNotification("NodeRuntime.waitingForDisconnect")); } void Frontend::flush() { m_frontendChannel->flushProtocolNotifications(); } void Frontend::sendRawJSONNotification(String notification) { m_frontendChannel->sendProtocolNotification(InternalRawNotification::fromJSON(std::move(notification))); } void Frontend::sendRawCBORNotification(std::vector<uint8_t> notification) { m_frontendChannel->sendProtocolNotification(InternalRawNotification::fromBinary(std::move(notification))); } // --------------------- Dispatcher. class DispatcherImpl : public protocol::DispatcherBase { public: DispatcherImpl(FrontendChannel* frontendChannel, Backend* backend) : DispatcherBase(frontendChannel) , m_backend(backend) { m_dispatchMap["NodeRuntime.notifyWhenWaitingForDisconnect"] = &DispatcherImpl::notifyWhenWaitingForDisconnect; } ~DispatcherImpl() override { } bool canDispatch(const String& method) override; void dispatch(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<protocol::DictionaryValue> messageObject) override; std::unordered_map<String, String>& redirects() { return m_redirects; } protected: using CallHandler = void (DispatcherImpl::*)(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<DictionaryValue> messageObject, ErrorSupport* errors); using DispatchMap = std::unordered_map<String, CallHandler>; DispatchMap m_dispatchMap; std::unordered_map<String, String> m_redirects; void notifyWhenWaitingForDisconnect(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*); Backend* m_backend; }; bool DispatcherImpl::canDispatch(const String& method) { return m_dispatchMap.find(method) != m_dispatchMap.end(); } void DispatcherImpl::dispatch(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<protocol::DictionaryValue> messageObject) { std::unordered_map<String, CallHandler>::iterator it = m_dispatchMap.find(method); DCHECK(it != m_dispatchMap.end()); protocol::ErrorSupport errors; (this->*(it->second))(callId, method, message, std::move(messageObject), &errors); } void DispatcherImpl::notifyWhenWaitingForDisconnect(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors) { // Prepare input parameters. protocol::DictionaryValue* object = DictionaryValue::cast(requestMessageObject->get("params")); errors->push(); protocol::Value* enabledValue = object ? object->get("enabled") : nullptr; errors->setName("enabled"); bool in_enabled = ValueConversions<bool>::fromValue(enabledValue, errors); errors->pop(); if (errors->hasErrors()) { reportProtocolError(callId, DispatchResponse::kInvalidParams, kInvalidParamsString, errors); return; } std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr(); DispatchResponse response = m_backend->notifyWhenWaitingForDisconnect(in_enabled); if (response.status() == DispatchResponse::kFallThrough) { channel()->fallThrough(callId, method, message); return; } if (weak->get()) weak->get()->sendResponse(callId, response); return; } // static void Dispatcher::wire(UberDispatcher* uber, Backend* backend) { std::unique_ptr<DispatcherImpl> dispatcher(new DispatcherImpl(uber->channel(), backend)); uber->setupRedirects(dispatcher->redirects()); uber->registerBackend("NodeRuntime", std::move(dispatcher)); } } // NodeRuntime } // namespace node } // namespace inspector } // namespace protocol