mailbox.cc revision 868fa2fe829687343ffae624259930155e16dbd8
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. 4 5#include "gpu/command_buffer/common/mailbox.h" 6 7#include <string.h> 8 9#include "gpu/command_buffer/common/logging.h" 10 11namespace gpu { 12 13Mailbox::Mailbox() { 14 memset(name, 0, sizeof(name)); 15} 16 17bool Mailbox::IsZero() const { 18 for (size_t i = 0; i < arraysize(name); ++i) { 19 if (name[i]) 20 return false; 21 } 22 return true; 23} 24 25void Mailbox::SetZero() { 26 memset(name, 0, sizeof(name)); 27} 28 29void Mailbox::SetName(const int8* n) { 30 GPU_DCHECK(IsZero() || !memcmp(name, n, sizeof(name))); 31 memcpy(name, n, sizeof(name)); 32} 33 34} // namespace gpu 35