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

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory_x11.cc

Issue 686523002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/common/gpu/gpu_memory_buffer_factory.h" 5 #include "content/common/gpu/gpu_memory_buffer_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h" 8 #include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h"
9 #include "gpu/command_buffer/service/image_factory.h" 9 #include "gpu/command_buffer/service/image_factory.h"
10 #include "ui/gl/gl_image.h" 10 #include "ui/gl/gl_image.h"
11 #include "ui/gl/gl_image_shared_memory.h" 11 #include "ui/gl/gl_image_shared_memory.h"
12 12
13 namespace content { 13 namespace content {
14 namespace { 14 namespace {
15 15
16 class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory, 16 class GpuMemoryBufferFactoryImpl : public GpuMemoryBufferFactory,
17 public gpu::ImageFactory { 17 public gpu::ImageFactory {
18 public: 18 public:
19 // Overridden from GpuMemoryBufferFactory: 19 // Overridden from GpuMemoryBufferFactory:
20 virtual gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer( 20 gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
21 const gfx::GpuMemoryBufferHandle& handle, 21 const gfx::GpuMemoryBufferHandle& handle,
22 const gfx::Size& size, 22 const gfx::Size& size,
23 gfx::GpuMemoryBuffer::Format format, 23 gfx::GpuMemoryBuffer::Format format,
24 gfx::GpuMemoryBuffer::Usage usage) override { 24 gfx::GpuMemoryBuffer::Usage usage) override {
25 switch (handle.type) { 25 switch (handle.type) {
26 case gfx::X11_PIXMAP_BUFFER: 26 case gfx::X11_PIXMAP_BUFFER:
27 x11_pixmap_factory_.CreateGpuMemoryBuffer(handle.global_id, 27 x11_pixmap_factory_.CreateGpuMemoryBuffer(handle.global_id,
28 handle.pixmap); 28 handle.pixmap);
29 return handle; 29 return handle;
30 default: 30 default:
31 NOTREACHED(); 31 NOTREACHED();
32 return gfx::GpuMemoryBufferHandle(); 32 return gfx::GpuMemoryBufferHandle();
33 } 33 }
34 } 34 }
35 virtual void DestroyGpuMemoryBuffer( 35 void DestroyGpuMemoryBuffer(
36 const gfx::GpuMemoryBufferHandle& handle) override { 36 const gfx::GpuMemoryBufferHandle& handle) override {
37 switch (handle.type) { 37 switch (handle.type) {
38 case gfx::X11_PIXMAP_BUFFER: 38 case gfx::X11_PIXMAP_BUFFER:
39 x11_pixmap_factory_.DestroyGpuMemoryBuffer(handle.global_id); 39 x11_pixmap_factory_.DestroyGpuMemoryBuffer(handle.global_id);
40 break; 40 break;
41 default: 41 default:
42 NOTREACHED(); 42 NOTREACHED();
43 break; 43 break;
44 } 44 }
45 } 45 }
46 virtual gpu::ImageFactory* AsImageFactory() override { return this; } 46 gpu::ImageFactory* AsImageFactory() override { return this; }
47 47
48 // Overridden from gpu::GpuMemoryBufferFactory: 48 // Overridden from gpu::GpuMemoryBufferFactory:
49 virtual scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( 49 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
50 const gfx::GpuMemoryBufferHandle& handle, 50 const gfx::GpuMemoryBufferHandle& handle,
51 const gfx::Size& size, 51 const gfx::Size& size,
52 gfx::GpuMemoryBuffer::Format format, 52 gfx::GpuMemoryBuffer::Format format,
53 unsigned internalformat, 53 unsigned internalformat,
54 int client_id) override { 54 int client_id) override {
55 switch (handle.type) { 55 switch (handle.type) {
56 case gfx::SHARED_MEMORY_BUFFER: { 56 case gfx::SHARED_MEMORY_BUFFER: {
57 scoped_refptr<gfx::GLImageSharedMemory> image( 57 scoped_refptr<gfx::GLImageSharedMemory> image(
58 new gfx::GLImageSharedMemory(size, internalformat)); 58 new gfx::GLImageSharedMemory(size, internalformat));
59 if (!image->Initialize(handle, format)) 59 if (!image->Initialize(handle, format))
(...skipping 20 matching lines...) Expand all
80 80
81 } // namespace 81 } // namespace
82 82
83 // static 83 // static
84 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() { 84 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create() {
85 return make_scoped_ptr<GpuMemoryBufferFactory>( 85 return make_scoped_ptr<GpuMemoryBufferFactory>(
86 new GpuMemoryBufferFactoryImpl); 86 new GpuMemoryBufferFactoryImpl);
87 } 87 }
88 88
89 } // namespace content 89 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/client/gpu_in_process_context_tests.cc ('k') | content/common/gpu/gpu_memory_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698