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 <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <string> | 11 #include <string> |
9 | 12 |
10 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
11 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
12 #include "gpu/command_buffer/common/mailbox_holder.h" | 15 #include "gpu/command_buffer/common/mailbox_holder.h" |
13 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
14 | 17 |
15 namespace cc { | 18 namespace cc { |
16 class SharedBitmap; | 19 class SharedBitmap; |
17 | 20 |
18 // TODO(skaslev, danakj) Rename this class more apropriately since now it | 21 // TODO(skaslev, danakj) Rename this class more apropriately since now it |
19 // can hold a shared memory resource as well as a texture mailbox. | 22 // can hold a shared memory resource as well as a texture mailbox. |
20 class CC_EXPORT TextureMailbox { | 23 class CC_EXPORT TextureMailbox { |
21 public: | 24 public: |
22 TextureMailbox(); | 25 TextureMailbox(); |
23 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder); | 26 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder); |
24 TextureMailbox(const gpu::Mailbox& mailbox, | 27 TextureMailbox(const gpu::Mailbox& mailbox, |
25 const gpu::SyncToken& sync_token, | 28 const gpu::SyncToken& sync_token, |
26 uint32 target); | 29 uint32_t target); |
27 TextureMailbox(const gpu::Mailbox& mailbox, | 30 TextureMailbox(const gpu::Mailbox& mailbox, |
28 const gpu::SyncToken& sync_token, | 31 const gpu::SyncToken& sync_token, |
29 uint32 target, | 32 uint32_t target, |
30 const gfx::Size& size_in_pixels, | 33 const gfx::Size& size_in_pixels, |
31 bool is_overlay_candidate); | 34 bool is_overlay_candidate); |
32 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels); | 35 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels); |
33 | 36 |
34 ~TextureMailbox(); | 37 ~TextureMailbox(); |
35 | 38 |
36 bool IsValid() const { return IsTexture() || IsSharedMemory(); } | 39 bool IsValid() const { return IsTexture() || IsSharedMemory(); } |
37 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); } | 40 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); } |
38 bool IsSharedMemory() const { return shared_bitmap_ != NULL; } | 41 bool IsSharedMemory() const { return shared_bitmap_ != NULL; } |
39 | 42 |
40 bool Equals(const TextureMailbox&) const; | 43 bool Equals(const TextureMailbox&) const; |
41 | 44 |
42 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } | 45 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } |
43 const int8* name() const { return mailbox().name; } | 46 const int8_t* name() const { return mailbox().name; } |
44 uint32 target() const { return mailbox_holder_.texture_target; } | 47 uint32_t target() const { return mailbox_holder_.texture_target; } |
45 const gpu::SyncToken& sync_token() const { | 48 const gpu::SyncToken& sync_token() const { |
46 return mailbox_holder_.sync_token; | 49 return mailbox_holder_.sync_token; |
47 } | 50 } |
48 void set_sync_token(const gpu::SyncToken& sync_token) { | 51 void set_sync_token(const gpu::SyncToken& sync_token) { |
49 mailbox_holder_.sync_token = sync_token; | 52 mailbox_holder_.sync_token = sync_token; |
50 } | 53 } |
51 | 54 |
52 bool is_overlay_candidate() const { return is_overlay_candidate_; } | 55 bool is_overlay_candidate() const { return is_overlay_candidate_; } |
53 bool nearest_neighbor() const { return nearest_neighbor_; } | 56 bool nearest_neighbor() const { return nearest_neighbor_; } |
54 void set_nearest_neighbor(bool nearest_neighbor) { | 57 void set_nearest_neighbor(bool nearest_neighbor) { |
(...skipping 10 matching lines...) Expand all Loading... |
65 gpu::MailboxHolder mailbox_holder_; | 68 gpu::MailboxHolder mailbox_holder_; |
66 SharedBitmap* shared_bitmap_; | 69 SharedBitmap* shared_bitmap_; |
67 gfx::Size size_in_pixels_; | 70 gfx::Size size_in_pixels_; |
68 bool is_overlay_candidate_; | 71 bool is_overlay_candidate_; |
69 bool nearest_neighbor_; | 72 bool nearest_neighbor_; |
70 }; | 73 }; |
71 | 74 |
72 } // namespace cc | 75 } // namespace cc |
73 | 76 |
74 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ | 77 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ |
OLD | NEW |