| 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 "cc/resources/shared_bitmap.h" | 8 #include "cc/resources/shared_bitmap.h" |
| 9 #include "third_party/khronos/GLES2/gl2.h" | 9 #include "third_party/khronos/GLES2/gl2.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 TextureMailbox::TextureMailbox() : shared_memory_(NULL) {} | 13 TextureMailbox::TextureMailbox() : shared_memory_(nullptr) { |
| 14 } |
| 14 | 15 |
| 15 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) | 16 TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) |
| 16 : mailbox_holder_(mailbox_holder), | 17 : mailbox_holder_(mailbox_holder), |
| 17 shared_memory_(NULL), | 18 shared_memory_(nullptr), |
| 18 allow_overlay_(false) {} | 19 allow_overlay_(false) { |
| 20 } |
| 19 | 21 |
| 20 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, | 22 TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, |
| 21 uint32 target, | 23 uint32 target, |
| 22 uint32 sync_point) | 24 uint32 sync_point) |
| 23 : mailbox_holder_(mailbox, target, sync_point), | 25 : mailbox_holder_(mailbox, target, sync_point), |
| 24 shared_memory_(NULL), | 26 shared_memory_(nullptr), |
| 25 allow_overlay_(false) {} | 27 allow_overlay_(false) { |
| 28 } |
| 26 | 29 |
| 27 TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory, | 30 TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory, |
| 28 const gfx::Size& size) | 31 const gfx::Size& size) |
| 29 : shared_memory_(shared_memory), | 32 : shared_memory_(shared_memory), |
| 30 shared_memory_size_(size), | 33 shared_memory_size_(size), |
| 31 allow_overlay_(false) { | 34 allow_overlay_(false) { |
| 32 // If an embedder of cc gives an invalid TextureMailbox, we should crash | 35 // If an embedder of cc gives an invalid TextureMailbox, we should crash |
| 33 // here to identify the offender. | 36 // here to identify the offender. |
| 34 CHECK(SharedBitmap::VerifySizeInBytes(shared_memory_size_)); | 37 CHECK(SharedBitmap::VerifySizeInBytes(shared_memory_size_)); |
| 35 } | 38 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 50 return !IsValid(); | 53 return !IsValid(); |
| 51 } | 54 } |
| 52 | 55 |
| 53 size_t TextureMailbox::SharedMemorySizeInBytes() const { | 56 size_t TextureMailbox::SharedMemorySizeInBytes() const { |
| 54 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the | 57 // UncheckedSizeInBytes is okay because we VerifySizeInBytes in the |
| 55 // constructor and the field is immutable. | 58 // constructor and the field is immutable. |
| 56 return SharedBitmap::UncheckedSizeInBytes(shared_memory_size_); | 59 return SharedBitmap::UncheckedSizeInBytes(shared_memory_size_); |
| 57 } | 60 } |
| 58 | 61 |
| 59 } // namespace cc | 62 } // namespace cc |
| OLD | NEW |