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

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: Fixed DuplicateHandle on Windows. 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 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
17 class CC_EXPORT TextureMailbox { 18 class CC_EXPORT TextureMailbox {
danakj 2013/05/23 15:34:33 Add a TODO here to rename this class please.
slavi 2013/05/28 18:55:13 Done.
18 public: 19 public:
19 typedef base::Callback<void(unsigned sync_point, 20 typedef base::Callback<void(unsigned sync_point,
danakj 2013/05/23 15:34:33 The values on this callback don't really make sens
20 bool lost_resource)> ReleaseCallback; 21 bool lost_resource)> ReleaseCallback;
21 TextureMailbox(); 22 TextureMailbox();
22 TextureMailbox(const std::string& mailbox_name, 23 TextureMailbox(const std::string& mailbox_name,
23 const ReleaseCallback& callback); 24 const ReleaseCallback& callback);
24 TextureMailbox(const gpu::Mailbox& mailbox_name, 25 TextureMailbox(const gpu::Mailbox& mailbox_name,
25 const ReleaseCallback& callback); 26 const ReleaseCallback& callback);
26 TextureMailbox(const gpu::Mailbox& mailbox_name, 27 TextureMailbox(const gpu::Mailbox& mailbox_name,
27 const ReleaseCallback& callback, 28 const ReleaseCallback& callback,
28 unsigned sync_point); 29 unsigned sync_point);
29 TextureMailbox(const gpu::Mailbox& mailbox_name, 30 TextureMailbox(const gpu::Mailbox& mailbox_name,
30 const ReleaseCallback& callback, 31 const ReleaseCallback& callback,
31 unsigned texture_target, 32 unsigned texture_target,
32 unsigned sync_point); 33 unsigned sync_point);
34 TextureMailbox(base::SharedMemoryHandle handle,
35 gfx::Size size,
danakj 2013/05/23 15:34:33 For textures we always pass along the size outside
36 const ReleaseCallback& callback);
33 37
34 ~TextureMailbox(); 38 ~TextureMailbox();
35 39
40 bool IsValid() const { return IsTexture() || IsSharedMemory(); }
41 bool IsTexture() const { return !name_.IsZero(); }
42 bool IsSharedMemory() const {
43 return base::SharedMemory::IsHandleValid(handle_);
44 }
45
46 bool Equals(const gpu::Mailbox&) const;
danakj 2013/05/23 15:34:33 This is the wrong name for this method now. How ab
slavi 2013/05/28 18:55:13 Done.
47 bool Equals(base::SharedMemoryHandle handle) const;
danakj 2013/05/23 15:34:33 Same here
slavi 2013/05/28 18:55:13 Done.
48 bool Equals(const TextureMailbox&) 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_; }
danakj 2013/05/23 15:34:33 I think I'd like to see all the gpu::Mailbox relat
slavi 2013/05/28 18:55:13 Let's do that on a second pass when this guy gets
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 void SetHandle(base::SharedMemoryHandle handle, gfx::Size size);
60 base::SharedMemoryHandle handle() const { return handle_; }
61 gfx::Size size() const { return size_; }
62
48 private: 63 private:
49 gpu::Mailbox name_; 64 gpu::Mailbox name_;
50 ReleaseCallback callback_; 65 ReleaseCallback callback_;
51 unsigned target_; 66 unsigned target_;
52 unsigned sync_point_; 67 unsigned sync_point_;
68 base::SharedMemoryHandle handle_;
69 gfx::Size size_;
53 }; 70 };
54 71
55 } // namespace cc 72 } // namespace cc
56 73
57 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_ 74 #endif // CC_RESOURCES_TEXTURE_MAILBOX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698