diff options
Diffstat (limited to 'chromium/gpu/command_buffer/common/mailbox.cc')
-rw-r--r-- | chromium/gpu/command_buffer/common/mailbox.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/chromium/gpu/command_buffer/common/mailbox.cc b/chromium/gpu/command_buffer/common/mailbox.cc new file mode 100644 index 00000000000..be2bebf9653 --- /dev/null +++ b/chromium/gpu/command_buffer/common/mailbox.cc @@ -0,0 +1,34 @@ +// 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. + +#include "gpu/command_buffer/common/mailbox.h" + +#include <string.h> + +#include "gpu/command_buffer/common/logging.h" + +namespace gpu { + +Mailbox::Mailbox() { + memset(name, 0, sizeof(name)); +} + +bool Mailbox::IsZero() const { + for (size_t i = 0; i < arraysize(name); ++i) { + if (name[i]) + return false; + } + return true; +} + +void Mailbox::SetZero() { + memset(name, 0, sizeof(name)); +} + +void Mailbox::SetName(const int8* n) { + GPU_DCHECK(IsZero() || !memcmp(name, n, sizeof(name))); + memcpy(name, n, sizeof(name)); +} + +} // namespace gpu |