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

Unified Diff: cc/resources/texture_mailbox.h

Issue 15001027: [Aura] Added Support for rendering software compositor frames as cc::TextureLayers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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.h
diff --git a/cc/resources/texture_mailbox.h b/cc/resources/texture_mailbox.h
index ff8c1842ced48d559c84197f1e2b914722273bf1..5d4a25bb74442a517483ac06e7d7d30d4acaade7 100644
--- a/cc/resources/texture_mailbox.h
+++ b/cc/resources/texture_mailbox.h
@@ -7,13 +7,16 @@
#include <string>
-#include "base/basictypes.h"
#include "base/callback.h"
+#include "base/memory/shared_memory.h"
#include "cc/base/cc_export.h"
#include "gpu/command_buffer/common/mailbox.h"
+#include "ui/gfx/size.h"
namespace cc {
+// TODO(skaslev, danakj) Rename this class more apropriately since now it
+// can hold a shared memory resource as well as a texture mailbox.
class CC_EXPORT TextureMailbox {
public:
typedef base::Callback<void(unsigned sync_point,
@@ -30,14 +33,24 @@ class CC_EXPORT TextureMailbox {
const ReleaseCallback& callback,
unsigned texture_target,
unsigned sync_point);
+ TextureMailbox(base::SharedMemoryHandle handle,
+ gfx::Size size,
+ const ReleaseCallback& callback);
~TextureMailbox();
+ bool IsValid() const { return IsTexture() || IsSharedMemory(); }
+ bool IsTexture() const { return !name_.IsZero(); }
+ bool IsSharedMemory() const {
+ return base::SharedMemory::IsHandleValid(handle_);
+ }
+
+ bool Equals(const TextureMailbox&) const;
+ bool Contains(const gpu::Mailbox&) const;
+ bool Contains(base::SharedMemoryHandle handle) const;
piman 2013/05/28 20:58:57 nit: no overloading.
slavi 2013/05/29 18:31:48 Done.
+
const ReleaseCallback& callback() const { return callback_; }
const int8* data() const { return name_.name; }
- bool Equals(const gpu::Mailbox&) const;
- bool Equals(const TextureMailbox&) const;
- bool IsEmpty() const;
const gpu::Mailbox& name() const { return name_; }
void ResetSyncPoint() { sync_point_ = 0; }
void RunReleaseCallback(unsigned sync_point, bool lost_resource) const;
@@ -45,11 +58,17 @@ class CC_EXPORT TextureMailbox {
unsigned target() const { return target_; }
unsigned sync_point() const { return sync_point_; }
+ void SetHandle(base::SharedMemoryHandle handle, gfx::Size size);
+ base::SharedMemoryHandle handle() const { return handle_; }
+ gfx::Size size() const { return size_; }
piman 2013/05/28 20:58:57 Maybe name this software_size, or shared_memory_si
slavi 2013/05/29 18:31:48 Done.
+
private:
gpu::Mailbox name_;
ReleaseCallback callback_;
unsigned target_;
unsigned sync_point_;
+ base::SharedMemoryHandle handle_;
+ gfx::Size size_;
};
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698