a16b2c7eef
New revision: f5a3199a3f37c7e48a9ffdbee04aa5c8f38d2889 Use crdtp::span<uint8_t> instead of const ProtocolMessage&. (V8) Also includes a PR which moves Serializable into the crdtp library and adds a simple test. Hadn't rolled this yet. Upstream review: https://chromium-review.googlesource.com/c/deps/inspector_protocol/+/1952196 Change-Id: If78bc8f11be8fb248dd66babc0190870312f7ec4 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1952158 Commit-Queue: Johannes Henkel <johannes@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Commit-Position: refs/heads/master@{#65356}
31 lines
984 B
C++
31 lines
984 B
C++
// Copyright 2019 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.
|
|
|
|
#ifndef V8_CRDTP_SERIALIZABLE_H_
|
|
#define V8_CRDTP_SERIALIZABLE_H_
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
#include "export.h"
|
|
|
|
namespace v8_crdtp {
|
|
// =============================================================================
|
|
// Serializable - An object to be emitted as a sequence of bytes.
|
|
// =============================================================================
|
|
|
|
class Serializable {
|
|
public:
|
|
// The default implementation invokes AppendSerialized with an empty vector
|
|
// and returns it; some subclasses may override and move out internal state
|
|
// instead to avoid copying.
|
|
virtual std::vector<uint8_t> TakeSerialized() &&;
|
|
|
|
virtual void AppendSerialized(std::vector<uint8_t>* out) const = 0;
|
|
|
|
virtual ~Serializable() = default;
|
|
};
|
|
} // namespace v8_crdtp
|
|
|
|
#endif // V8_CRDTP_SERIALIZABLE_H_
|