| 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 #ifndef CC_RESOURCES_TEXTURE_MAILBOX_H_ | 5 #ifndef CC_RESOURCES_TEXTURE_MAILBOX_H_ |
| 6 #define CC_RESOURCES_TEXTURE_MAILBOX_H_ | 6 #define CC_RESOURCES_TEXTURE_MAILBOX_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/shared_memory.h" | 11 #include "base/memory/shared_memory.h" |
| 12 #include "base/numerics/safe_math.h" |
| 12 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 13 #include "gpu/command_buffer/common/mailbox_holder.h" | 14 #include "gpu/command_buffer/common/mailbox_holder.h" |
| 14 #include "ui/gfx/size.h" | 15 #include "ui/gfx/size.h" |
| 15 | 16 |
| 16 namespace cc { | 17 namespace cc { |
| 17 | 18 |
| 18 // TODO(skaslev, danakj) Rename this class more apropriately since now it | 19 // TODO(skaslev, danakj) Rename this class more apropriately since now it |
| 19 // can hold a shared memory resource as well as a texture mailbox. | 20 // can hold a shared memory resource as well as a texture mailbox. |
| 20 class CC_EXPORT TextureMailbox { | 21 class CC_EXPORT TextureMailbox { |
| 21 public: | 22 public: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 uint32 sync_point() const { return mailbox_holder_.sync_point; } | 39 uint32 sync_point() const { return mailbox_holder_.sync_point; } |
| 39 void set_sync_point(int32 sync_point) { | 40 void set_sync_point(int32 sync_point) { |
| 40 mailbox_holder_.sync_point = sync_point; | 41 mailbox_holder_.sync_point = sync_point; |
| 41 } | 42 } |
| 42 | 43 |
| 43 bool allow_overlay() const { return allow_overlay_; } | 44 bool allow_overlay() const { return allow_overlay_; } |
| 44 void set_allow_overlay(bool allow_overlay) { allow_overlay_ = allow_overlay; } | 45 void set_allow_overlay(bool allow_overlay) { allow_overlay_ = allow_overlay; } |
| 45 | 46 |
| 46 base::SharedMemory* shared_memory() const { return shared_memory_; } | 47 base::SharedMemory* shared_memory() const { return shared_memory_; } |
| 47 gfx::Size shared_memory_size() const { return shared_memory_size_; } | 48 gfx::Size shared_memory_size() const { return shared_memory_size_; } |
| 48 size_t shared_memory_size_in_bytes() const; | 49 |
| 50 size_t SharedMemorySizeInBytes() const; |
| 51 base::CheckedNumeric<size_t> CheckedSharedMemorySizeInBytes() const; |
| 49 | 52 |
| 50 private: | 53 private: |
| 51 gpu::MailboxHolder mailbox_holder_; | 54 gpu::MailboxHolder mailbox_holder_; |
| 52 base::SharedMemory* shared_memory_; | 55 base::SharedMemory* shared_memory_; |
| 53 gfx::Size shared_memory_size_; | 56 gfx::Size shared_memory_size_; |
| 54 bool allow_overlay_; | 57 bool allow_overlay_; |
| 55 }; | 58 }; |
| 56 | 59 |
| 57 } // namespace cc | 60 } // namespace cc |
| 58 | 61 |
| 59 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ | 62 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ |
| OLD | NEW |