OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resources/texture_mailbox.h" | 5 #include "cc/resources/texture_mailbox.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/khronos/GLES2/gl2.h" | 8 #include "third_party/khronos/GLES2/gl2.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
11 | 11 |
12 TextureMailbox::TextureMailbox() : shared_memory_(NULL) {} | 12 TextureMailbox::TextureMailbox() : shared_memory_(NULL) {} |
13 | 13 |
14 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) | 14 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) |
15 : mailbox_holder_(mailbox_holder), shared_memory_(NULL) {} | 15 : mailbox_holder_(mailbox_holder), |
| 16 shared_memory_(NULL), |
| 17 allow_overlay_(false) {} |
16 | 18 |
17 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, | 19 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, |
18 uint32 target, | 20 uint32 target, |
19 uint32 sync_point) | 21 uint32 sync_point) |
20 : mailbox_holder_(mailbox, target, sync_point), shared_memory_(NULL) {} | 22 : mailbox_holder_(mailbox, target, sync_point), |
| 23 shared_memory_(NULL), |
| 24 allow_overlay_(false) {} |
21 | 25 |
22 TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory, | 26 TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory, |
23 const gfx::Size& size) | 27 const gfx::Size& size) |
24 : shared_memory_(shared_memory), shared_memory_size_(size) {} | 28 : shared_memory_(shared_memory), |
| 29 shared_memory_size_(size), |
| 30 allow_overlay_(false) {} |
25 | 31 |
26 TextureMailbox::~TextureMailbox() {} | 32 TextureMailbox::~TextureMailbox() {} |
27 | 33 |
28 bool TextureMailbox::Equals(const TextureMailbox& other) const { | 34 bool TextureMailbox::Equals(const TextureMailbox& other) const { |
29 if (other.IsTexture()) { | 35 if (other.IsTexture()) { |
30 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name, | 36 return IsTexture() && !memcmp(mailbox_holder_.mailbox.name, |
31 other.mailbox_holder_.mailbox.name, | 37 other.mailbox_holder_.mailbox.name, |
32 sizeof(mailbox_holder_.mailbox.name)); | 38 sizeof(mailbox_holder_.mailbox.name)); |
33 } else if (other.IsSharedMemory()) { | 39 } else if (other.IsSharedMemory()) { |
34 return IsSharedMemory() && | 40 return IsSharedMemory() && |
35 shared_memory_->handle() == other.shared_memory_->handle(); | 41 shared_memory_->handle() == other.shared_memory_->handle(); |
36 } | 42 } |
37 | 43 |
38 DCHECK(!other.IsValid()); | 44 DCHECK(!other.IsValid()); |
39 return !IsValid(); | 45 return !IsValid(); |
40 } | 46 } |
41 | 47 |
42 size_t TextureMailbox::shared_memory_size_in_bytes() const { | 48 size_t TextureMailbox::shared_memory_size_in_bytes() const { |
43 return 4 * shared_memory_size_.GetArea(); | 49 return 4 * shared_memory_size_.GetArea(); |
44 } | 50 } |
45 | 51 |
46 } // namespace cc | 52 } // namespace cc |
OLD | NEW |