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

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

Issue 458313002: Browser side OZONE_NATIVE_BUFFER allocation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
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 "ui/gfx/gpu_memory_buffer.h" 10 #include "ui/gfx/gpu_memory_buffer.h"
11 #include "ui/gfx/size.h" 11 #include "ui/gfx/size.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // Provides common implementation of a GPU memory buffer. 15 // Provides common implementation of a GPU memory buffer.
16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { 16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
17 public: 17 public:
18 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> 18 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
19 AllocationCallback; 19 AllocationCallback;
20 20
21 virtual ~GpuMemoryBufferImpl(); 21 virtual ~GpuMemoryBufferImpl();
22 22
23 // Creates a GPU memory buffer instance with |size| and |internalformat| for 23 // Creates a GPU memory buffer instance with |size| and |internalformat| for
24 // |usage|. 24 // |usage|.
25 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size, 25 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size,
26 unsigned internalformat, 26 unsigned internalformat,
27 unsigned usage); 27 unsigned usage);
28 28
29 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| 29 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage|
30 // by |child_process|. The |handle| returned can be used by the 30 // by |child_process| identified by |child_id|. The |handle| returned can be
31 // |child_process| to create an instance of this class. 31 // used by the |child_process| to create an instance of this class.
32 static void AllocateForChildProcess(const gfx::Size& size, 32 static void AllocateForChildProcess(const gfx::Size& size,
33 unsigned internalformat, 33 unsigned internalformat,
34 unsigned usage, 34 unsigned usage,
35 base::ProcessHandle child_process, 35 base::ProcessHandle child_process,
36 int child_id,
36 const AllocationCallback& callback); 37 const AllocationCallback& callback);
37 38
38 // Notify that GPU memory buffer has been deleted by |child_process|. 39 // Notify that GPU memory buffer has been deleted by |child_process|.
39 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type, 40 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type,
40 const gfx::GpuMemoryBufferId& id, 41 const gfx::GpuMemoryBufferId& id,
41 base::ProcessHandle child_process); 42 base::ProcessHandle child_process);
42 43
43 // Creates an instance from the given |handle|. |size| and |internalformat| 44 // Creates an instance from the given |handle|. |size| and |internalformat|
44 // should match what was used to allocate the |handle|. 45 // should match what was used to allocate the |handle|.
45 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( 46 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
(...skipping 20 matching lines...) Expand all
66 const gfx::Size size_; 67 const gfx::Size size_;
67 const unsigned internalformat_; 68 const unsigned internalformat_;
68 bool mapped_; 69 bool mapped_;
69 70
70 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 71 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
71 }; 72 };
72 73
73 } // namespace content 74 } // namespace content
74 75
75 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 76 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698