summaryrefslogtreecommitdiff
path: root/deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template')
-rw-r--r--deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template41
1 files changed, 31 insertions, 10 deletions
diff --git a/deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template b/deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template
index f99ce5f0d9..4ef60a6ea2 100644
--- a/deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template
+++ b/deps/v8/third_party/inspector_protocol/templates/TypeBuilder_cpp.template
@@ -1,4 +1,4 @@
-// This file is generated
+// 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
@@ -101,10 +101,15 @@ std::unique_ptr<{{type.id}}> {{type.id}}::clone() const
{{config.exported.string_out}} {{type.id}}::toJSONString() const
{
- String json = toValue()->serialize();
+ String json = toValue()->serializeToJSON();
return {{config.exported.to_string_out % "json"}};
}
+void {{type.id}}::writeBinary(std::vector<uint8_t>* out) const
+{
+ toValue()->writeBinary(out);
+}
+
// static
std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromJSONString(const {{config.exported.string_in}}& json)
{
@@ -114,6 +119,17 @@ std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromJSONString(const {{confi
return nullptr;
return protocol::{{domain.domain}}::{{type.id}}::fromValue(value.get(), &errors);
}
+
+// static
+std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromBinary(const uint8_t* data, size_t length)
+{
+ ErrorSupport errors;
+ std::unique_ptr<Value> value = Value::parseBinary(data, length);
+ if (!value)
+ return nullptr;
+ return protocol::{{domain.domain}}::{{type.id}}::fromValue(value.get(), &errors);
+}
+
{% endif %}
{% endfor %}
@@ -187,9 +203,14 @@ void Frontend::flush()
m_frontendChannel->flushProtocolNotifications();
}
-void Frontend::sendRawNotification(const String& notification)
+void Frontend::sendRawNotification(String notification)
+{
+ m_frontendChannel->sendProtocolNotification(InternalRawNotification::fromJSON(std::move(notification)));
+}
+
+void Frontend::sendRawNotification(std::vector<uint8_t> notification)
{
- m_frontendChannel->sendProtocolNotification(InternalRawNotification::create(notification));
+ m_frontendChannel->sendProtocolNotification(InternalRawNotification::fromBinary(std::move(notification)));
}
// --------------------- Dispatcher.
@@ -210,11 +231,11 @@ public:
}
~DispatcherImpl() override { }
bool canDispatch(const String& method) override;
- void dispatch(int callId, const String& method, const String& message, std::unique_ptr<protocol::DictionaryValue> messageObject) 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 String& message, std::unique_ptr<DictionaryValue> messageObject, ErrorSupport* errors);
+ 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;
@@ -222,7 +243,7 @@ protected:
{% for command in domain.commands %}
{% if "redirect" in command %}{% continue %}{% endif %}
{% if not protocol.generate_command(domain.domain, command.name) %}{% continue %}{% endif %}
- void {{command.name}}(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
+ void {{command.name}}(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport*);
{% endfor %}
Backend* m_backend;
@@ -232,7 +253,7 @@ bool DispatcherImpl::canDispatch(const String& method) {
return m_dispatchMap.find(method) != m_dispatchMap.end();
}
-void DispatcherImpl::dispatch(int callId, const String& method, const String& message, std::unique_ptr<protocol::DictionaryValue> messageObject)
+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());
@@ -248,7 +269,7 @@ void DispatcherImpl::dispatch(int callId, const String& method, const String& me
class {{command_name_title}}CallbackImpl : public Backend::{{command_name_title}}Callback, public DispatcherBase::Callback {
public:
- {{command_name_title}}CallbackImpl(std::unique_ptr<DispatcherBase::WeakPtr> backendImpl, int callId, const String& method, const String& message)
+ {{command_name_title}}CallbackImpl(std::unique_ptr<DispatcherBase::WeakPtr> backendImpl, int callId, const String& method, const ProtocolMessage& message)
: DispatcherBase::Callback(std::move(backendImpl), callId, method, message) { }
void sendSuccess(
@@ -286,7 +307,7 @@ public:
};
{% endif %}
-void DispatcherImpl::{{command.name}}(int callId, const String& method, const String& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
+void DispatcherImpl::{{command.name}}(int callId, const String& method, const ProtocolMessage& message, std::unique_ptr<DictionaryValue> requestMessageObject, ErrorSupport* errors)
{
{% if "parameters" in command %}
// Prepare input parameters.