1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef GPU_COMMAND_BUFFER_MAILBOX_H_
6 #define GPU_COMMAND_BUFFER_MAILBOX_H_
11 #include "gpu/gpu_export.h"
14 #ifndef GL_MAILBOX_SIZE_CHROMIUM
15 #define GL_MAILBOX_SIZE_CHROMIUM 64
20 struct GPU_EXPORT Mailbox
{
24 void SetName(const int8_t* name
);
26 // Generate a unique unguessable mailbox name.
27 static Mailbox
Generate();
29 // Verify that the mailbox was created through Mailbox::Generate. This only
30 // works in Debug (always returns true in Release). This is not a secure
31 // check, only to catch bugs where clients forgot to call Mailbox::Generate.
34 int8_t name
[GL_MAILBOX_SIZE_CHROMIUM
];
35 bool operator<(const Mailbox
& other
) const {
36 return memcmp(this, &other
, sizeof other
) < 0;
38 bool operator==(const Mailbox
& other
) const {
39 return memcmp(this, &other
, sizeof other
) == 0;
41 bool operator!=(const Mailbox
& other
) const {
42 return !operator==(other
);
48 #endif // GPU_COMMAND_BUFFER_MAILBOX_H_