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

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 class GpuMemoryBufferFactoryHost;
14 15
15 // Provides common implementation of a GPU memory buffer. 16 // Provides common implementation of a GPU memory buffer.
16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { 17 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
17 public: 18 public:
18 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> 19 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
19 AllocationCallback; 20 AllocationCallback;
20 21
21 virtual ~GpuMemoryBufferImpl(); 22 virtual ~GpuMemoryBufferImpl();
22 23
23 // Creates a GPU memory buffer instance with |size| and |internalformat| for 24 // Creates a GPU memory buffer instance with |size| and |internalformat| for
24 // |usage|. 25 // |usage|.
25 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size, 26 static scoped_ptr<GpuMemoryBufferImpl> Create(const gfx::Size& size,
26 unsigned internalformat, 27 unsigned internalformat,
27 unsigned usage); 28 unsigned usage);
28 29
29 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| 30 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage|
30 // by |child_process|. The |handle| returned can be used by the 31 // by |child_process|. The |handle| returned can be used by the
31 // |child_process| to create an instance of this class. 32 // |child_process| to create an instance of this class.
33 // The buffer is being allocated for |child_id| and |factory_host| can
34 // be used to talk to the allocator.
reveman 2014/08/13 08:03:11 Can you merge the mention of |child_id| with the t
achaulk 2014/08/13 15:53:19 Done.
32 static void AllocateForChildProcess(const gfx::Size& size, 35 static void AllocateForChildProcess(const gfx::Size& size,
33 unsigned internalformat, 36 unsigned internalformat,
34 unsigned usage, 37 unsigned usage,
35 base::ProcessHandle child_process, 38 base::ProcessHandle child_process,
39 int child_id,
40 GpuMemoryBufferFactoryHost* factory_host,
reveman 2014/08/13 08:03:11 It's weird that we pass a factory to this function
achaulk 2014/08/13 15:53:19 Sure, I can do that. The only implementation is a
36 const AllocationCallback& callback); 41 const AllocationCallback& callback);
37 42
38 // Notify that GPU memory buffer has been deleted by |child_process|. 43 // Notify that GPU memory buffer has been deleted by |child_process|.
39 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type, 44 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type,
40 const gfx::GpuMemoryBufferId& id, 45 const gfx::GpuMemoryBufferId& id,
41 base::ProcessHandle child_process); 46 base::ProcessHandle child_process);
42 47
43 // Creates an instance from the given |handle|. |size| and |internalformat| 48 // Creates an instance from the given |handle|. |size| and |internalformat|
44 // should match what was used to allocate the |handle|. 49 // should match what was used to allocate the |handle|.
45 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( 50 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
(...skipping 20 matching lines...) Expand all
66 const gfx::Size size_; 71 const gfx::Size size_;
67 const unsigned internalformat_; 72 const unsigned internalformat_;
68 bool mapped_; 73 bool mapped_;
69 74
70 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 75 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
71 }; 76 };
72 77
73 } // namespace content 78 } // namespace content
74 79
75 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 80 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698