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

Side by Side Diff: content/common/gpu/client/gpu_memory_buffer_impl.h

Issue 1429213002: Converted video frame and image callbacks to use new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed typo 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
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 CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "content/common/content_export.h" 10 #include "content/common/content_export.h"
11 #include "gpu/command_buffer/common/sync_token.h"
11 #include "ui/gfx/geometry/size.h" 12 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/gpu_memory_buffer.h" 13 #include "ui/gfx/gpu_memory_buffer.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 // Provides common implementation of a GPU memory buffer. 17 // Provides common implementation of a GPU memory buffer.
17 class CONTENT_EXPORT GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { 18 class CONTENT_EXPORT GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
18 public: 19 public:
19 typedef base::Callback<void(uint32 sync_point)> DestructionCallback; 20 typedef base::Callback<void(const gpu::SyncToken& sync)> DestructionCallback;
20 21
21 ~GpuMemoryBufferImpl() override; 22 ~GpuMemoryBufferImpl() override;
22 23
23 // Creates an instance from the given |handle|. |size| and |internalformat| 24 // Creates an instance from the given |handle|. |size| and |internalformat|
24 // should match what was used to allocate the |handle|. |callback| is 25 // should match what was used to allocate the |handle|. |callback| is
25 // called when instance is deleted, which is not necessarily on the same 26 // called when instance is deleted, which is not necessarily on the same
26 // thread as this function was called on and instance was created on. 27 // thread as this function was called on and instance was created on.
27 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( 28 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
28 const gfx::GpuMemoryBufferHandle& handle, 29 const gfx::GpuMemoryBufferHandle& handle,
29 const gfx::Size& size, 30 const gfx::Size& size,
30 gfx::BufferFormat format, 31 gfx::BufferFormat format,
31 gfx::BufferUsage usage, 32 gfx::BufferUsage usage,
32 const DestructionCallback& callback); 33 const DestructionCallback& callback);
33 34
34 // Type-checking upcast routine. Returns an NULL on failure. 35 // Type-checking upcast routine. Returns an NULL on failure.
35 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); 36 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
36 37
37 // Overridden from gfx::GpuMemoryBuffer: 38 // Overridden from gfx::GpuMemoryBuffer:
38 gfx::Size GetSize() const override; 39 gfx::Size GetSize() const override;
39 gfx::BufferFormat GetFormat() const override; 40 gfx::BufferFormat GetFormat() const override;
40 gfx::GpuMemoryBufferId GetId() const override; 41 gfx::GpuMemoryBufferId GetId() const override;
41 ClientBuffer AsClientBuffer() override; 42 ClientBuffer AsClientBuffer() override;
42 43
43 void set_destruction_sync_point(uint32 sync_point) { 44 void set_destruction_sync_token(const gpu::SyncToken& sync_token) {
44 destruction_sync_point_ = sync_point; 45 destruction_sync_token_ = sync_token;
45 } 46 }
46 47
47 protected: 48 protected:
48 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, 49 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
49 const gfx::Size& size, 50 const gfx::Size& size,
50 gfx::BufferFormat format, 51 gfx::BufferFormat format,
51 const DestructionCallback& callback); 52 const DestructionCallback& callback);
52 53
53 const gfx::GpuMemoryBufferId id_; 54 const gfx::GpuMemoryBufferId id_;
54 const gfx::Size size_; 55 const gfx::Size size_;
55 const gfx::BufferFormat format_; 56 const gfx::BufferFormat format_;
56 const DestructionCallback callback_; 57 const DestructionCallback callback_;
57 bool mapped_; 58 bool mapped_;
58 uint32 destruction_sync_point_; 59 gpu::SyncToken destruction_sync_token_;
59 60
60 private: 61 private:
61 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 62 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
62 }; 63 };
63 64
64 } // namespace content 65 } // namespace content
65 66
66 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 67 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_channel_host.cc ('k') | content/common/gpu/client/gpu_memory_buffer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698