Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: cc/resources/texture_mailbox.h

Issue 2087673002: Remove CreateGpuMemoryBufferFromClientId and plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/texture_mailbox.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "cc/base/cc_export.h" 14 #include "cc/base/cc_export.h"
15 #include "gpu/command_buffer/common/mailbox_holder.h" 15 #include "gpu/command_buffer/common/mailbox_holder.h"
16 #include "ui/gfx/geometry/size.h" 16 #include "ui/gfx/geometry/size.h"
17 #include "ui/gfx/gpu_memory_buffer.h"
18 17
19 namespace cc { 18 namespace cc {
20 class SharedBitmap; 19 class SharedBitmap;
21 20
22 // TODO(skaslev, danakj) Rename this class more apropriately since now it 21 // TODO(skaslev, danakj) Rename this class more apropriately since now it
23 // 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.
24 class CC_EXPORT TextureMailbox { 23 class CC_EXPORT TextureMailbox {
25 public: 24 public:
26 TextureMailbox(); 25 TextureMailbox();
27 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder); 26 explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder);
28 TextureMailbox(const gpu::Mailbox& mailbox, 27 TextureMailbox(const gpu::Mailbox& mailbox,
29 const gpu::SyncToken& sync_token, 28 const gpu::SyncToken& sync_token,
30 uint32_t target); 29 uint32_t target);
31 TextureMailbox(const gpu::Mailbox& mailbox, 30 TextureMailbox(const gpu::Mailbox& mailbox,
32 const gpu::SyncToken& sync_token, 31 const gpu::SyncToken& sync_token,
33 uint32_t target, 32 uint32_t target,
34 const gfx::Size& size_in_pixels, 33 const gfx::Size& size_in_pixels,
35 const gfx::GpuMemoryBufferId& gpu_memory_buffer_id,
36 bool is_overlay_candidate, 34 bool is_overlay_candidate,
37 bool secure_output_only); 35 bool secure_output_only);
38 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels); 36 TextureMailbox(SharedBitmap* shared_bitmap, const gfx::Size& size_in_pixels);
39 37
40 ~TextureMailbox(); 38 ~TextureMailbox();
41 39
42 bool IsValid() const { return IsTexture() || IsSharedMemory(); } 40 bool IsValid() const { return IsTexture() || IsSharedMemory(); }
43 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); } 41 bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); }
44 bool IsSharedMemory() const { return shared_bitmap_ != NULL; } 42 bool IsSharedMemory() const { return shared_bitmap_ != NULL; }
45 bool HasSyncToken() const { return mailbox_holder_.sync_token.HasData(); } 43 bool HasSyncToken() const { return mailbox_holder_.sync_token.HasData(); }
46 44
47 int8_t* GetSyncTokenData() { return mailbox_holder_.sync_token.GetData(); } 45 int8_t* GetSyncTokenData() { return mailbox_holder_.sync_token.GetData(); }
48 46
49 bool Equals(const TextureMailbox&) const; 47 bool Equals(const TextureMailbox&) const;
50 48
51 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } 49 const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; }
52 const int8_t* name() const { return mailbox().name; } 50 const int8_t* name() const { return mailbox().name; }
53 uint32_t target() const { return mailbox_holder_.texture_target; } 51 uint32_t target() const { return mailbox_holder_.texture_target; }
54 const gpu::SyncToken& sync_token() const { 52 const gpu::SyncToken& sync_token() const {
55 return mailbox_holder_.sync_token; 53 return mailbox_holder_.sync_token;
56 } 54 }
57 void set_sync_token(const gpu::SyncToken& sync_token) { 55 void set_sync_token(const gpu::SyncToken& sync_token) {
58 mailbox_holder_.sync_token = sync_token; 56 mailbox_holder_.sync_token = sync_token;
59 } 57 }
60 58
61 gfx::GpuMemoryBufferId gpu_memory_buffer_id() const {
62 return gpu_memory_buffer_id_;
63 }
64 bool is_overlay_candidate() const { return is_overlay_candidate_; } 59 bool is_overlay_candidate() const { return is_overlay_candidate_; }
65 bool secure_output_only() const { return secure_output_only_; } 60 bool secure_output_only() const { return secure_output_only_; }
66 bool nearest_neighbor() const { return nearest_neighbor_; } 61 bool nearest_neighbor() const { return nearest_neighbor_; }
67 void set_nearest_neighbor(bool nearest_neighbor) { 62 void set_nearest_neighbor(bool nearest_neighbor) {
68 nearest_neighbor_ = nearest_neighbor; 63 nearest_neighbor_ = nearest_neighbor;
69 } 64 }
70 65
71 // This is valid if allow_overlau() or IsSharedMemory() is true. 66 // This is valid if allow_overlau() or IsSharedMemory() is true.
72 gfx::Size size_in_pixels() const { return size_in_pixels_; } 67 gfx::Size size_in_pixels() const { return size_in_pixels_; }
73 68
74 SharedBitmap* shared_bitmap() const { return shared_bitmap_; } 69 SharedBitmap* shared_bitmap() const { return shared_bitmap_; }
75 size_t SharedMemorySizeInBytes() const; 70 size_t SharedMemorySizeInBytes() const;
76 71
77 private: 72 private:
78 gpu::MailboxHolder mailbox_holder_; 73 gpu::MailboxHolder mailbox_holder_;
79 SharedBitmap* shared_bitmap_; 74 SharedBitmap* shared_bitmap_;
80 gfx::Size size_in_pixels_; 75 gfx::Size size_in_pixels_;
81 gfx::GpuMemoryBufferId gpu_memory_buffer_id_;
82 bool is_overlay_candidate_; 76 bool is_overlay_candidate_;
83 bool secure_output_only_; 77 bool secure_output_only_;
84 bool nearest_neighbor_; 78 bool nearest_neighbor_;
85 }; 79 };
86 80
87 } // namespace cc 81 } // namespace cc
88 82
89 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ 83 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/resources/texture_mailbox.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698