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

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

Issue 557353002: Remove the assumption about client_id from gpu memory buffer allocation on the browser side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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(scoped_ptr<GpuMemoryBufferImpl> buffer)> 18 typedef base::Callback<void(scoped_ptr<GpuMemoryBufferImpl> buffer)>
19 CreationCallback; 19 CreationCallback;
20 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)> 20 typedef base::Callback<void(const gfx::GpuMemoryBufferHandle& handle)>
21 AllocationCallback; 21 AllocationCallback;
22 22
23 virtual ~GpuMemoryBufferImpl(); 23 virtual ~GpuMemoryBufferImpl();
24 24
25 // Creates a GPU memory buffer instance with |size| and |internalformat| for 25 // Creates a GPU memory buffer instance with |size| and |internalformat| for
26 // |usage|. 26 // |usage| by the current process and |client_id|.
27 static void Create(const gfx::Size& size, 27 static void Create(const gfx::Size& size,
28 unsigned internalformat, 28 unsigned internalformat,
29 unsigned usage, 29 unsigned usage,
30 int client_id,
30 const CreationCallback& callback); 31 const CreationCallback& callback);
31 32
32 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage| 33 // Allocates a GPU memory buffer with |size| and |internalformat| for |usage|
33 // by |child_process| identified by |child_id|. The |handle| returned can be 34 // by |child_process| and |child_client_id|. The |handle| returned can be
34 // used by the |child_process| to create an instance of this class. 35 // used by the |child_process| to create an instance of this class.
35 static void AllocateForChildProcess(const gfx::Size& size, 36 static void AllocateForChildProcess(const gfx::Size& size,
36 unsigned internalformat, 37 unsigned internalformat,
37 unsigned usage, 38 unsigned usage,
38 base::ProcessHandle child_process, 39 base::ProcessHandle child_process,
39 int child_id, 40 int child_client_id,
40 const AllocationCallback& callback); 41 const AllocationCallback& callback);
41 42
42 // Notify that GPU memory buffer has been deleted by |child_process|. 43 // Notify that GPU memory buffer has been deleted by |child_process|.
43 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type, 44 static void DeletedByChildProcess(gfx::GpuMemoryBufferType type,
44 const gfx::GpuMemoryBufferId& id, 45 const gfx::GpuMemoryBufferId& id,
45 base::ProcessHandle child_process); 46 base::ProcessHandle child_process);
46 47
47 // Creates an instance from the given |handle|. |size| and |internalformat| 48 // Creates an instance from the given |handle|. |size| and |internalformat|
48 // should match what was used to allocate the |handle|. 49 // should match what was used to allocate the |handle|.
49 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle( 50 static scoped_ptr<GpuMemoryBufferImpl> CreateFromHandle(
(...skipping 20 matching lines...) Expand all
70 const gfx::Size size_; 71 const gfx::Size size_;
71 const unsigned internalformat_; 72 const unsigned internalformat_;
72 bool mapped_; 73 bool mapped_;
73 74
74 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); 75 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
75 }; 76 };
76 77
77 } // namespace content 78 } // namespace content
78 79
79 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ 80 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_channel_host_factory.cc ('k') | content/common/gpu/client/gpu_memory_buffer_impl_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698