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

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

Issue 458313002: Browser side OZONE_NATIVE_BUFFER allocation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more ifdefs 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
reveman 2014/08/11 19:43:06 2014
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_SHARED_MEMORY_H_ 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_H_
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_H_
7 7
8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
9 9
10 namespace content { 10 namespace content {
11 11
12 // Implementation of GPU memory buffer based on shared memory. 12 // Implementation of GPU memory buffer based on shared memory.
reveman 2014/08/11 19:43:06 comment is incorrect.
achaulk 2014/08/12 19:03:57 Done.
13 class GpuMemoryBufferImplSharedMemory : public GpuMemoryBufferImpl { 13 class GpuMemoryBufferImplOzone : public GpuMemoryBufferImpl {
reveman 2014/08/11 19:43:06 I don't think this is the correct name for this cl
achaulk 2014/08/12 19:03:57 Done.
14 public: 14 public:
15 GpuMemoryBufferImplSharedMemory(const gfx::Size& size, 15 GpuMemoryBufferImplOzone(const gfx::Size& size,
16 unsigned internalformat); 16 unsigned internalformat,
17 virtual ~GpuMemoryBufferImplSharedMemory(); 17 int32 client_id);
reveman 2014/08/11 19:43:06 client_id? I think you should init this from Initi
achaulk 2014/08/12 19:03:57 Done.
18 virtual ~GpuMemoryBufferImplOzone();
18 19
19 // Allocates a shared memory backed GPU memory buffer with |size| and 20 // Allocates a shared memory backed GPU memory buffer with |size| and
20 // |internalformat| for use by |child_process|. 21 // |internalformat| for use by |child_process|.
21 static void AllocateSharedMemoryForChildProcess( 22 static void AllocateSharedMemoryForChildProcess(
22 const gfx::Size& size, 23 const gfx::Size& size,
23 unsigned internalformat, 24 unsigned internalformat,
24 base::ProcessHandle child_process, 25 base::ProcessHandle child_process,
26 int client_id,
27 GpuMemoryBufferFactoryHost* gpu_factory_host,
25 const AllocationCallback& callback); 28 const AllocationCallback& callback);
26 29
27 static bool IsLayoutSupported(const gfx::Size& size, unsigned internalformat); 30 static bool IsLayoutSupported(const gfx::Size& size, unsigned internalformat);
28 static bool IsUsageSupported(unsigned usage); 31 static bool IsUsageSupported(unsigned usage);
29 static bool IsConfigurationSupported(const gfx::Size& size, 32 static bool IsConfigurationSupported(const gfx::Size& size,
30 unsigned internalformat, 33 unsigned internalformat,
31 unsigned usage); 34 unsigned usage);
32 35
33 bool Initialize(); 36 bool Initialize();
34 bool InitializeFromHandle(const gfx::GpuMemoryBufferHandle& handle); 37 bool InitializeFromHandle(const gfx::GpuMemoryBufferHandle& handle);
35 38
36 // Overridden from gfx::GpuMemoryBuffer: 39 // Overridden from gfx::GpuMemoryBuffer:
37 virtual void* Map() OVERRIDE; 40 virtual void* Map() OVERRIDE;
38 virtual void Unmap() OVERRIDE; 41 virtual void Unmap() OVERRIDE;
39 virtual uint32 GetStride() const OVERRIDE; 42 virtual uint32 GetStride() const OVERRIDE;
40 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; 43 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE;
41 44
42 private: 45 private:
43 scoped_ptr<base::SharedMemory> shared_memory_; 46 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplOzone);
44 47
45 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSharedMemory); 48 static uint32_t GetNextBufferId();
reveman 2014/08/11 19:43:06 can you move this and next_buffer_id_ to anonymous
achaulk 2014/08/12 19:03:57 Done.
49
50 gfx::GpuMemoryBufferHandle handle_;
reveman 2014/08/11 19:43:06 I think gfx::GpuMemoryBufferId is more appropriate
achaulk 2014/08/12 19:03:57 Done.
51 static uint32_t next_buffer_id_;
46 }; 52 };
47 53
48 } // namespace content 54 } // namespace content
49 55
50 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SHARED_MEMORY_H_ 56 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_OZONE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698