Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / cc / resources / texture_mailbox.cc
blob9bf242e1d7c897e44b4c0f904d0ec54b29cf87cc
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 #include "cc/resources/texture_mailbox.h"
7 #include "base/logging.h"
8 #include "cc/resources/shared_bitmap.h"
10 namespace cc {
12 TextureMailbox::TextureMailbox() : shared_bitmap_(NULL) {
15 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder)
16 : mailbox_holder_(mailbox_holder),
17 shared_bitmap_(NULL),
18 allow_overlay_(false),
19 nearest_neighbor_(false) {
22 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
23 uint32 target,
24 uint32 sync_point)
25 : mailbox_holder_(mailbox, target, sync_point),
26 shared_bitmap_(NULL),
27 allow_overlay_(false),
28 nearest_neighbor_(false) {
31 TextureMailbox::TextureMailbox(SharedBitmap* shared_bitmap,
32 const gfx::Size& size)
33 : shared_bitmap_(shared_bitmap),
34 shared_memory_size_(size),
35 allow_overlay_(false),
36 nearest_neighbor_(false) {
37 // If an embedder of cc gives an invalid TextureMailbox, we should crash
38 // here to identify the offender.
39 CHECK(SharedBitmap::VerifySizeInBytes(shared_memory_size_));
42 TextureMailbox::~TextureMailbox() {}
44 bool TextureMailbox::Equals(const TextureMailbox& other) const {
45 if (other.IsTexture()) {
46 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name,
47 other.mailbox_holder_.mailbox.name,
48 sizeof(mailbox_holder_.mailbox.name));
49 } else if (other.IsSharedMemory()) {
50 return IsSharedMemory() && (shared_bitmap_ == other.shared_bitmap_);
53 DCHECK(!other.IsValid());
54 return !IsValid();
57 size_t TextureMailbox::SharedMemorySizeInBytes() const {
58 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the
59 // constructor and the field is immutable.
60 return SharedBitmap::UncheckedSizeInBytes(shared_memory_size_);
63 } // namespace cc