blob: 8a09ff699a2dca99a397625dbc784702742659e4 [file] [log] [blame]
// Copyright 2013 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 SERVICES_VIZ_PUBLIC_INTERFACES_COMPOSITING_RESOURCE_SETTINGS_MOJOM_BLINK_H_
#define SERVICES_VIZ_PUBLIC_INTERFACES_COMPOSITING_RESOURCE_SETTINGS_MOJOM_BLINK_H_
#include <stdint.h>
#include <limits>
#include <type_traits>
#include <utility>
#include "base/callback.h"
#include "base/macros.h"
#include "base/optional.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#if BUILDFLAG(MOJO_TRACE_ENABLED)
#include "base/trace_event/trace_event.h"
#endif
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "services/viz/public/interfaces/compositing/resource_settings.mojom-shared.h"
#include "services/viz/public/interfaces/compositing/resource_settings.mojom-blink-forward.h"
#include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h"
#include "mojo/public/cpp/bindings/lib/wtf_hash_util.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr.h"
#include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
#include "mojo/public/cpp/bindings/associated_interface_request.h"
#include "mojo/public/cpp/bindings/interface_ptr.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/public/cpp/bindings/lib/control_message_handler.h"
#include "mojo/public/cpp/bindings/raw_ptr_impl_ref_traits.h"
#include "mojo/public/cpp/bindings/thread_safe_interface_ptr.h"
#include "mojo/public/cpp/bindings/lib/native_enum_serialization.h"
#include "mojo/public/cpp/bindings/lib/native_struct_serialization.h"
#ifdef KYTHE_IS_RUNNING
#pragma kythe_inline_metadata "Metadata comment"
#endif
namespace viz {
namespace mojom {
namespace blink {
// @generated_from: viz.mojom.ResourceSettings
class ResourceSettings {
public:
template <typename T>
using EnableIfSame = std::enable_if_t<std::is_same<ResourceSettings, T>::value>;
using DataView = ResourceSettingsDataView;
using Data_ = internal::ResourceSettings_Data;
template <typename... Args>
static ResourceSettingsPtr New(Args&&... args) {
return ResourceSettingsPtr(
base::in_place, std::forward<Args>(args)...);
}
template <typename U>
static ResourceSettingsPtr From(const U& u) {
return mojo::TypeConverter<ResourceSettingsPtr, U>::Convert(u);
}
template <typename U>
U To() const {
return mojo::TypeConverter<U, ResourceSettings>::Convert(*this);
}
ResourceSettings();
explicit ResourceSettings(
bool use_gpu_memory_buffer_resources);
~ResourceSettings();
// Clone() is a template so it is only instantiated if it is used. Thus, the
// bindings generator does not need to know whether Clone() or copy
// constructor/assignment are available for members.
template <typename StructPtrType = ResourceSettingsPtr>
ResourceSettingsPtr Clone() const;
// Equals() is a template so it is only instantiated if it is used. Thus, the
// bindings generator does not need to know whether Equals() or == operator
// are available for members.
template <typename T, ResourceSettings::EnableIfSame<T>* = nullptr>
bool Equals(const T& other) const;
size_t Hash(size_t seed) const;
template <typename UserType>
static WTF::Vector<uint8_t> Serialize(UserType* input) {
return mojo::internal::SerializeImpl<
ResourceSettings::DataView, WTF::Vector<uint8_t>>(input);
}
template <typename UserType>
static mojo::Message SerializeAsMessage(UserType* input) {
return mojo::internal::SerializeAsMessageImpl<
ResourceSettings::DataView>(input);
}
// The returned Message is serialized only if the message is moved
// cross-process or cross-language. Otherwise if the message is Deserialized
// as the same UserType |input| will just be moved to |output| in
// DeserializeFromMessage.
template <typename UserType>
static mojo::Message WrapAsMessage(UserType input) {
return mojo::Message(std::make_unique<
internal::ResourceSettings_UnserializedMessageContext<
UserType, ResourceSettings::DataView>>(0, 0, std::move(input)));
}
template <typename UserType>
static bool Deserialize(const void* data,
size_t data_num_bytes,
UserType* output) {
return mojo::internal::DeserializeImpl<ResourceSettings::DataView>(
data, data_num_bytes, std::vector<mojo::ScopedHandle>(), output, Validate);
}
template <typename UserType>
static bool Deserialize(const WTF::Vector<uint8_t>& input,
UserType* output) {
return ResourceSettings::Deserialize(
input.size() == 0 ? nullptr : &input.front(), input.size(), output);
}
template <typename UserType>
static bool DeserializeFromMessage(mojo::Message input,
UserType* output) {
auto context = input.TakeUnserializedContext<
internal::ResourceSettings_UnserializedMessageContext<
UserType, ResourceSettings::DataView>>();
if (context) {
*output = std::move(context->TakeData());
return true;
}
input.SerializeIfNecessary();
return mojo::internal::DeserializeImpl<ResourceSettings::DataView>(
input.payload(), input.payload_num_bytes(),
std::move(*input.mutable_handles()), output, Validate);
}
// @generated_from: viz.mojom.ResourceSettings.use_gpu_memory_buffer_resources
bool use_gpu_memory_buffer_resources;
private:
static bool Validate(const void* data,
mojo::internal::ValidationContext* validation_context);
};
// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, ResourceSettings::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);
template <typename T, ResourceSettings::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
return !(rhs < lhs);
}
template <typename T, ResourceSettings::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
return rhs < lhs;
}
template <typename T, ResourceSettings::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
return !(lhs < rhs);
}
template <typename StructPtrType>
ResourceSettingsPtr ResourceSettings::Clone() const {
return New(
mojo::Clone(use_gpu_memory_buffer_resources)
);
}
template <typename T, ResourceSettings::EnableIfSame<T>*>
bool ResourceSettings::Equals(const T& other_struct) const {
if (!mojo::Equals(this->use_gpu_memory_buffer_resources, other_struct.use_gpu_memory_buffer_resources))
return false;
return true;
}
template <typename T, ResourceSettings::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
if (lhs.use_gpu_memory_buffer_resources < rhs.use_gpu_memory_buffer_resources)
return true;
if (rhs.use_gpu_memory_buffer_resources < lhs.use_gpu_memory_buffer_resources)
return false;
return false;
}
} // namespace blink
} // namespace mojom
} // namespace viz
namespace mojo {
template <>
struct StructTraits<::viz::mojom::blink::ResourceSettings::DataView,
::viz::mojom::blink::ResourceSettingsPtr> {
static bool IsNull(const ::viz::mojom::blink::ResourceSettingsPtr& input) { return !input; }
static void SetToNull(::viz::mojom::blink::ResourceSettingsPtr* output) { output->reset(); }
static decltype(::viz::mojom::blink::ResourceSettings::use_gpu_memory_buffer_resources) use_gpu_memory_buffer_resources(
const ::viz::mojom::blink::ResourceSettingsPtr& input) {
return input->use_gpu_memory_buffer_resources;
}
static bool Read(::viz::mojom::blink::ResourceSettings::DataView input, ::viz::mojom::blink::ResourceSettingsPtr* output);
};
} // namespace mojo
#endif // SERVICES_VIZ_PUBLIC_INTERFACES_COMPOSITING_RESOURCE_SETTINGS_MOJOM_BLINK_H_
/* Metadata comment
eyJtZXRhIjogW3siZW5kIjogMjIzMywgImJlZ2luIjogMjIxNywgImVkZ2UiOiAiJS9reXRoZS9l
ZGdlL2dlbmVyYXRlcyIsICJ0eXBlIjogImFuY2hvcl9kZWZpbmVzIiwgInZuYW1lIjogeyJjb3Jw
dXMiOiAiY2hyb21pdW0uZ29vZ2xlc291cmNlLmNvbS9jaHJvbWl1bS9zcmMiLCAibGFuZ3VhZ2Ui
OiAibW9qb20iLCAic2lnbmF0dXJlIjogInZpei5tb2pvbS5SZXNvdXJjZVNldHRpbmdzIn19LCB7
ImVuZCI6IDU4OTMsICJiZWdpbiI6IDU4NjIsICJlZGdlIjogIiUva3l0aGUvZWRnZS9nZW5lcmF0
ZXMiLCAidHlwZSI6ICJhbmNob3JfZGVmaW5lcyIsICJ2bmFtZSI6IHsiY29ycHVzIjogImNocm9t
aXVtLmdvb2dsZXNvdXJjZS5jb20vY2hyb21pdW0vc3JjIiwgImxhbmd1YWdlIjogIm1vam9tIiwg
InNpZ25hdHVyZSI6ICJ2aXoubW9qb20uUmVzb3VyY2VTZXR0aW5ncy51c2VfZ3B1X21lbW9yeV9i
dWZmZXJfcmVzb3VyY2VzIn19XSwgInR5cGUiOiAia3l0aGUwIn0=
*/