[sql] Remove _HAS_EXCEPTIONS=0 from build info.
[chromium-blink-merge.git] / gpu / command_buffer / common / mailbox.h
blob67b023e9936da7e8367831ff8e7ea8ca62373e7e
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_
8 #include <stdint.h>
9 #include <string.h>
11 #include "gpu/gpu_export.h"
13 // From gl2/gl2ext.h.
14 #ifndef GL_MAILBOX_SIZE_CHROMIUM
15 #define GL_MAILBOX_SIZE_CHROMIUM 64
16 #endif
18 namespace gpu {
20 struct GPU_EXPORT Mailbox {
21 using Name = int8_t[GL_MAILBOX_SIZE_CHROMIUM];
23 Mailbox();
24 bool IsZero() const;
25 void SetZero();
26 void SetName(const int8_t* name);
28 // Generate a unique unguessable mailbox name.
29 static Mailbox Generate();
31 // Verify that the mailbox was created through Mailbox::Generate. This only
32 // works in Debug (always returns true in Release). This is not a secure
33 // check, only to catch bugs where clients forgot to call Mailbox::Generate.
34 bool Verify() const;
36 Name name;
38 bool operator<(const Mailbox& other) const {
39 return memcmp(this, &other, sizeof other) < 0;
41 bool operator==(const Mailbox& other) const {
42 return memcmp(this, &other, sizeof other) == 0;
44 bool operator!=(const Mailbox& other) const {
45 return !operator==(other);
49 } // namespace gpu
51 #endif // GPU_COMMAND_BUFFER_MAILBOX_H_