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

Side by Side Diff: gpu/command_buffer/common/mailbox.h

Issue 105743004: Add gpu::MailboxHolder to hold state for a gpu::Mailbox (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cc2a95fe Android fixes. Created 7 years 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 GPU_COMMAND_BUFFER_MAILBOX_H_ 5 #ifndef GPU_COMMAND_BUFFER_MAILBOX_H_
6 #define GPU_COMMAND_BUFFER_MAILBOX_H_ 6 #define GPU_COMMAND_BUFFER_MAILBOX_H_
7 7
8 #include <string.h> 8 #include <string.h>
9 9
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
10 #include "gpu/command_buffer/common/types.h" 12 #include "gpu/command_buffer/common/types.h"
11 #include "gpu/gpu_export.h" 13 #include "gpu/gpu_export.h"
12 14
13 namespace gpu { 15 namespace gpu {
14 16
15 struct GPU_EXPORT Mailbox { 17 struct GPU_EXPORT Mailbox {
16 Mailbox(); 18 Mailbox();
17 bool IsZero() const; 19 bool IsZero() const;
18 void SetZero(); 20 void SetZero();
19 void SetName(const int8* name); 21 void SetName(const int8* name);
20 int8 name[64]; 22 int8 name[64];
21 bool operator<(const Mailbox& other) const { 23 bool operator<(const Mailbox& other) const {
22 return memcmp(this, &other, sizeof other) < 0; 24 return memcmp(this, &other, sizeof other) < 0;
23 } 25 }
24 }; 26 };
25 27
28 class GPU_EXPORT MailboxHolder {
piman 2013/12/06 23:29:42 Should this be a struct? It's a value type, copyab
sheu 2013/12/07 01:03:50 Sure.
29 public:
30 typedef base::Callback<void(scoped_ptr<MailboxHolder>)> ReleaseCallback;
danakj 2013/12/06 22:37:03 At least in cc, we also include a "is_lost" boolea
sheu 2013/12/06 22:54:12 That's cc::ReleaseCallback (and cc::SingleReleaseC
piman 2013/12/06 23:29:42 I'm pretty meh about defining this here. Among all
sheu 2013/12/07 01:03:50 I'm getting more users of the callback soon. Righ
piman 2013/12/07 01:32:34 Right, but like I said, this doesn't fit all use c
sheu 2013/12/07 01:44:15 This isn't really inherent to the gpu::MailboxHold
31
32 MailboxHolder();
33 MailboxHolder(const gpu::Mailbox& mailbox, uint32 target, uint32 sync_point);
34
35 const gpu::Mailbox& mailbox() const { return mailbox_; }
36 uint32 target() const { return target_; }
37 uint32 sync_point() const { return sync_point_; }
38 void set_sync_point(uint32 sync_point) { sync_point_ = sync_point; }
danakj 2013/12/06 22:37:03 Can you do the set only if the |sync_point| != 0?
sheu 2013/12/06 22:54:12 We use this also to replace cc::TextureMailbox::Re
39
40 private:
41 gpu::Mailbox mailbox_;
42 uint32 target_;
43 uint32 sync_point_;
44 };
45
26 } // namespace gpu 46 } // namespace gpu
27 47
28 #endif // GPU_COMMAND_BUFFER_MAILBOX_H_ 48 #endif // GPU_COMMAND_BUFFER_MAILBOX_H_
29 49
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698