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

Unified Diff: cc/resources/texture_mailbox.cc

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: c301e01d Rebase. Created 6 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: cc/resources/texture_mailbox.cc
diff --git a/cc/resources/texture_mailbox.cc b/cc/resources/texture_mailbox.cc
index 149d56c8d1ac12031cf85f1646fa7d8fe952a406..34d8a29dff4612f3a958734cd7cf0c8b42f31056 100644
--- a/cc/resources/texture_mailbox.cc
+++ b/cc/resources/texture_mailbox.cc
@@ -9,76 +9,38 @@
namespace cc {
-TextureMailbox::TextureMailbox()
- : target_(GL_TEXTURE_2D),
- sync_point_(0),
- shared_memory_(NULL) {
-}
+TextureMailbox::TextureMailbox() : shared_memory_(NULL) {}
-TextureMailbox::TextureMailbox(const std::string& mailbox_name)
- : target_(GL_TEXTURE_2D),
- sync_point_(0),
- shared_memory_(NULL) {
- if (!mailbox_name.empty()) {
- CHECK(mailbox_name.size() == sizeof(name_.name));
- name_.SetName(reinterpret_cast<const int8*>(mailbox_name.data()));
- }
-}
+TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder)
+ : mailbox_holder_(mailbox_holder), shared_memory_(NULL) {}
-TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox_name)
- : target_(GL_TEXTURE_2D),
- sync_point_(0),
- shared_memory_(NULL) {
- name_.SetName(mailbox_name.name);
-}
-
-TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox_name,
- unsigned sync_point)
- : target_(GL_TEXTURE_2D),
- sync_point_(sync_point),
- shared_memory_(NULL) {
- name_.SetName(mailbox_name.name);
-}
-
-TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox_name,
- unsigned texture_target,
- unsigned sync_point)
- : target_(texture_target),
- sync_point_(sync_point),
- shared_memory_(NULL) {
- name_.SetName(mailbox_name.name);
-}
+TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox,
+ uint32 target,
+ uint32 sync_point)
+ : mailbox_holder_(mailbox, target, sync_point), shared_memory_(NULL) {}
TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory,
gfx::Size size)
- : target_(GL_TEXTURE_2D),
- sync_point_(0),
- shared_memory_(shared_memory),
- shared_memory_size_(size) {}
+ : shared_memory_(shared_memory), shared_memory_size_(size) {}
TextureMailbox::~TextureMailbox() {}
bool TextureMailbox::Equals(const TextureMailbox& other) const {
- if (other.IsTexture())
- return ContainsMailbox(other.name());
- else if (other.IsSharedMemory())
- return ContainsHandle(other.shared_memory_->handle());
+ if (other.IsTexture()) {
+ return IsTexture() && !memcmp(mailbox_holder_.mailbox.name,
+ other.mailbox_holder_.mailbox.name,
+ sizeof(mailbox_holder_.mailbox.name));
+ } else if (other.IsSharedMemory()) {
+ return IsSharedMemory() &&
+ shared_memory_->handle() == other.shared_memory_->handle();
+ }
DCHECK(!other.IsValid());
return !IsValid();
}
-bool TextureMailbox::ContainsMailbox(const gpu::Mailbox& other) const {
- return IsTexture() && !memcmp(data(), other.name, sizeof(name_.name));
-}
-
-bool TextureMailbox::ContainsHandle(base::SharedMemoryHandle handle) const {
- return shared_memory_ && shared_memory_->handle() == handle;
-}
-
-void TextureMailbox::SetName(const gpu::Mailbox& name) {
- DCHECK(shared_memory_ == NULL);
- name_ = name;
+void TextureMailbox::set_sync_point(uint32 sync_point) {
+ mailbox_holder_.sync_point = sync_point;
}
size_t TextureMailbox::shared_memory_size_in_bytes() const {

Powered by Google App Engine
This is Rietveld 408576698