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

Side by Side 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: Removed SharedMemory::DuplicateHandle. Created 7 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 | Annotate | Revision Log
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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
11 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/shared_memory.h"
12 #include "cc/base/cc_export.h" 12 #include "cc/base/cc_export.h"
13 #include "gpu/command_buffer/common/mailbox.h" 13 #include "gpu/command_buffer/common/mailbox.h"
14 #include "ui/gfx/size.h"
14 15
15 namespace cc { 16 namespace cc {
16 17
18 // TODO(skaslev, danakj) Rename this class more apropriately since now it
19 // can hold a shared memory resource as well as a texture mailbox.
17 class CC_EXPORT TextureMailbox { 20 class CC_EXPORT TextureMailbox {
18 public: 21 public:
19 typedef base::Callback<void(unsigned sync_point, 22 typedef base::Callback<void(unsigned sync_point,
20 bool lost_resource)> ReleaseCallback; 23 bool lost_resource)> ReleaseCallback;
21 TextureMailbox(); 24 TextureMailbox();
22 TextureMailbox(const std::string& mailbox_name, 25 TextureMailbox(const std::string& mailbox_name,
23 const ReleaseCallback& callback); 26 const ReleaseCallback& callback);
24 TextureMailbox(const gpu::Mailbox& mailbox_name, 27 TextureMailbox(const gpu::Mailbox& mailbox_name,
25 const ReleaseCallback& callback); 28 const ReleaseCallback& callback);
26 TextureMailbox(const gpu::Mailbox& mailbox_name, 29 TextureMailbox(const gpu::Mailbox& mailbox_name,
27 const ReleaseCallback& callback, 30 const ReleaseCallback& callback,
28 unsigned sync_point); 31 unsigned sync_point);
29 TextureMailbox(const gpu::Mailbox& mailbox_name, 32 TextureMailbox(const gpu::Mailbox& mailbox_name,
30 const ReleaseCallback& callback, 33 const ReleaseCallback& callback,
31 unsigned texture_target, 34 unsigned texture_target,
32 unsigned sync_point); 35 unsigned sync_point);
36 TextureMailbox(base::SharedMemory* shared_memory,
37 gfx::Size size,
danakj 2013/06/07 14:56:42 I feel like including the size inside the TextureM
slavi 2013/06/07 21:49:21 We talked this over offline.
38 const ReleaseCallback& callback);
33 39
34 ~TextureMailbox(); 40 ~TextureMailbox();
35 41
42 bool IsValid() const { return IsTexture() || IsSharedMemory(); }
43 bool IsTexture() const { return !name_.IsZero(); }
44 bool IsSharedMemory() const { return shared_memory_ != NULL; }
45
46 bool Equals(const TextureMailbox&) const;
47 bool ContainsMailbox(const gpu::Mailbox&) const;
48 bool ContainsHandle(base::SharedMemoryHandle handle) const;
49
36 const ReleaseCallback& callback() const { return callback_; } 50 const ReleaseCallback& callback() const { return callback_; }
37 const int8* data() const { return name_.name; } 51 const int8* data() const { return name_.name; }
38 bool Equals(const gpu::Mailbox&) const;
39 bool Equals(const TextureMailbox&) const;
40 bool IsEmpty() const;
41 const gpu::Mailbox& name() const { return name_; } 52 const gpu::Mailbox& name() const { return name_; }
42 void ResetSyncPoint() { sync_point_ = 0; } 53 void ResetSyncPoint() { sync_point_ = 0; }
43 void RunReleaseCallback(unsigned sync_point, bool lost_resource) const; 54 void RunReleaseCallback(unsigned sync_point, bool lost_resource) const;
44 void SetName(const gpu::Mailbox&); 55 void SetName(const gpu::Mailbox&);
45 unsigned target() const { return target_; } 56 unsigned target() const { return target_; }
46 unsigned sync_point() const { return sync_point_; } 57 unsigned sync_point() const { return sync_point_; }
47 58
59 base::SharedMemory* shared_memory() const { return shared_memory_; }
60 gfx::Size shared_memory_size() const { return shared_memory_size_; }
61 size_t shared_memory_size_in_bytes() const;
62
63 TextureMailbox CopyWithNewCallback(const ReleaseCallback& callback) const;
64
48 private: 65 private:
49 gpu::Mailbox name_; 66 gpu::Mailbox name_;
50 ReleaseCallback callback_; 67 ReleaseCallback callback_;
51 unsigned target_; 68 unsigned target_;
52 unsigned sync_point_; 69 unsigned sync_point_;
70 base::SharedMemory* shared_memory_;
71 gfx::Size shared_memory_size_;
53 }; 72 };
54 73
55 } // namespace cc 74 } // namespace cc
56 75
57 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ 76 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698