#ifndef blink_protocol_Runtime_imported_h
#define blink_protocol_Runtime_imported_h
#include "third_party/blink/renderer/core/inspector/protocol/protocol.h"
#include <v8-inspector-protocol.h>
#ifndef blink_protocol_imported_imported_h
namespace crdtp {
template <typename T>
struct ProtocolTypeTraits<
std::unique_ptr<T>,
typename std::enable_if<
std::is_base_of<v8_inspector::protocol::Exported, T>::value>::type> {
static bool Deserialize(DeserializerState* state, std::unique_ptr<T>* value) {
if (state->tokenizer()->TokenTag() != cbor::CBORTokenTag::ENVELOPE) {
state->RegisterError(Error::CBOR_INVALID_ENVELOPE);
return false;
}
span<uint8_t> env = state->tokenizer()->GetEnvelope();
auto res = T::fromBinary(env.data(), env.size());
if (!res) {
state->RegisterError(Error::MESSAGE_MUST_BE_AN_OBJECT);
return false;
}
*value = std::move(res);
return true;
}
static void Serialize(const std::unique_ptr<T>& value, std::vector<uint8_t>* bytes) {
value->AppendSerialized(bytes);
}
};
template <typename T>
struct ProtocolTypeTraits<
T,
typename std::enable_if<
std::is_base_of<v8_inspector::protocol::Exported, T>::value>::type> {
static void Serialize(const T& value, std::vector<uint8_t>* bytes) {
value.AppendSerialized(bytes);
}
};
}
#endif
namespace blink {
namespace protocol {
Exported;
#ifndef blink_protocol_imported_imported_h
#define blink_protocol_imported_imported_h
class CORE_EXPORT ImportedValue : public Value {
public:
static std::unique_ptr<ImportedValue> fromExported(const Exported* value) {
return std::unique_ptr<ImportedValue>(new ImportedValue(value));
}
void AppendSerialized(std::vector<uint8_t>* output) const override {
m_exported->AppendSerialized(output);
}
std::unique_ptr<Value> clone() const override {
return std::unique_ptr<Value>(new ImportedValue(m_exported));
}
private:
explicit ImportedValue(const Exported* exported) : Value(TypeImported), m_exported(exported) { }
const Exported* m_exported;
};
#endif
template<>
struct ValueConversions<v8_inspector::protocol::Runtime::API::RemoteObject> { … };
template<>
struct ValueConversions<v8_inspector::protocol::Runtime::API::StackTrace> { … };
}
}
#endif