chromium/gpu/command_buffer/common/mailbox.h

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#ifndef GPU_COMMAND_BUFFER_COMMON_MAILBOX_H_
#define GPU_COMMAND_BUFFER_COMMON_MAILBOX_H_

#include <stdint.h>
#include <string.h>

#include <string>

#include "base/component_export.h"

// From gl2/gl2ext.h.
#ifndef GL_MAILBOX_SIZE_CHROMIUM
#define GL_MAILBOX_SIZE_CHROMIUM
#endif

namespace gpu {

// Importance to use in tracing. Higher values get the memory cost attributed,
// and equal values share the cost. We want the client to "win" over the
// service, since the service is acting on its behalf.
enum class TracingImportance : int {};

// A mailbox is an unguessable name that references a SharedImage.
// This name can be passed across processes permitting one process to share
// a SharedImage with another. The mailbox name consists of a random
// set of bytes, optionally with a checksum (in debug mode) to verify the
// name is valid.
struct COMPONENT_EXPORT(GPU_MAILBOX) Mailbox {};

}  // namespace gpu

template <>
struct std::hash<gpu::Mailbox> {};

#endif  // GPU_COMMAND_BUFFER_COMMON_MAILBOX_H_