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

Side by Side Diff: components/exo/buffer.h

Issue 1412093006: components: Add Exosphere component. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove some ifdefs Created 5 years, 1 month 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
« no previous file with comments | « components/exo/README ('k') | components/exo/buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_EXO_BUFFER_H_
6 #define COMPONENTS_EXO_BUFFER_H_
7
8 #include "base/callback.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "gpu/command_buffer/common/mailbox.h"
13 #include "gpu/command_buffer/common/sync_token.h"
14 #include "ui/gfx/buffer_types.h"
15 #include "ui/gfx/geometry/size.h"
16
17 namespace base {
18 namespace trace_event {
19 class TracedValue;
20 }
21 }
22
23 namespace cc {
24 class SingleReleaseCallback;
25 class TextureMailbox;
26 }
27
28 namespace gfx {
29 class GpuMemoryBuffer;
30 }
31
32 namespace exo {
33
34 // This class provides the content for a Surface. The mechanism by which a
35 // client provides and updates the contents is the responsibility of the client
36 // and not defined as part of this class.
37 class Buffer : public base::SupportsWeakPtr<Buffer> {
38 public:
39 Buffer(scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer,
40 unsigned texture_target);
41 ~Buffer();
42
43 // Set the callback to run when the buffer is no longer used by the
44 // compositor. The client is free to re-use or destroy this buffer and
45 // its backing storage after this has been called.
46 void set_release_callback(const base::Closure& release_callback) {
47 release_callback_ = release_callback;
48 }
49
50 // This function can be used to acquire a texture mailbox that is bound to
51 // the buffer. Returns a release callback on success. The release callback
52 // must be called before a new texture mailbox can be acquired.
53 scoped_ptr<cc::SingleReleaseCallback> AcquireTextureMailbox(
54 cc::TextureMailbox* mailbox);
55
56 // Returns the size of the buffer.
57 gfx::Size GetSize() const;
58
59 // Returns a trace value representing the state of the buffer.
60 scoped_refptr<base::trace_event::TracedValue> AsTracedValue() const;
61
62 private:
63 static void Release(base::WeakPtr<Buffer> buffer,
64 unsigned texture_target,
65 unsigned texture_id,
66 unsigned image_id,
67 const gpu::SyncToken& sync_token,
68 bool is_lost);
69
70 scoped_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_;
71 const unsigned texture_target_;
72 unsigned texture_id_;
73 unsigned image_id_;
74 gpu::Mailbox mailbox_;
75 base::Closure release_callback_;
76
77 DISALLOW_COPY_AND_ASSIGN(Buffer);
78 };
79
80 } // namespace exo
81
82 #endif // COMPONENTS_EXO_BUFFER_H_
OLDNEW
« no previous file with comments | « components/exo/README ('k') | components/exo/buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698