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

Side by Side Diff: cc/test/test_gpu_memory_buffer_manager.cc

Issue 645853008: Standardize usage of virtual/override/final in cc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted Created 6 years, 2 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
« no previous file with comments | « cc/test/test_gpu_memory_buffer_manager.h ('k') | cc/test/test_in_process_context_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "cc/test/test_gpu_memory_buffer_manager.h" 5 #include "cc/test/test_gpu_memory_buffer_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/gfx/gpu_memory_buffer.h" 8 #include "ui/gfx/gpu_memory_buffer.h"
9 9
10 namespace cc { 10 namespace cc {
11 namespace { 11 namespace {
12 12
13 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { 13 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
14 public: 14 public:
15 GpuMemoryBufferImpl(const gfx::Size& size, Format format) 15 GpuMemoryBufferImpl(const gfx::Size& size, Format format)
16 : size_(size), 16 : size_(size),
17 format_(format), 17 format_(format),
18 pixels_(new uint8[size.GetArea() * BytesPerPixel(format)]), 18 pixels_(new uint8[size.GetArea() * BytesPerPixel(format)]),
19 mapped_(false) {} 19 mapped_(false) {}
20 20
21 // Overridden from gfx::GpuMemoryBuffer: 21 // Overridden from gfx::GpuMemoryBuffer:
22 virtual void* Map() override { 22 void* Map() override {
23 DCHECK(!mapped_); 23 DCHECK(!mapped_);
24 mapped_ = true; 24 mapped_ = true;
25 return pixels_.get(); 25 return pixels_.get();
26 } 26 }
27 virtual void Unmap() override { 27 void Unmap() override {
28 DCHECK(mapped_); 28 DCHECK(mapped_);
29 mapped_ = false; 29 mapped_ = false;
30 } 30 }
31 virtual bool IsMapped() const override { return mapped_; } 31 bool IsMapped() const override { return mapped_; }
32 virtual Format GetFormat() const override { return format_; } 32 Format GetFormat() const override { return format_; }
33 virtual uint32 GetStride() const override { 33 uint32 GetStride() const override {
34 return size_.width() * BytesPerPixel(format_); 34 return size_.width() * BytesPerPixel(format_);
35 } 35 }
36 virtual gfx::GpuMemoryBufferHandle GetHandle() const override { 36 gfx::GpuMemoryBufferHandle GetHandle() const override {
37 NOTREACHED(); 37 NOTREACHED();
38 return gfx::GpuMemoryBufferHandle(); 38 return gfx::GpuMemoryBufferHandle();
39 } 39 }
40 virtual ClientBuffer AsClientBuffer() override { 40 ClientBuffer AsClientBuffer() override {
41 return reinterpret_cast<ClientBuffer>(this); 41 return reinterpret_cast<ClientBuffer>(this);
42 } 42 }
43 43
44 private: 44 private:
45 static size_t BytesPerPixel(Format format) { 45 static size_t BytesPerPixel(Format format) {
46 switch (format) { 46 switch (format) {
47 case RGBA_8888: 47 case RGBA_8888:
48 case RGBX_8888: 48 case RGBX_8888:
49 case BGRA_8888: 49 case BGRA_8888:
50 return 4; 50 return 4;
(...skipping 26 matching lines...) Expand all
77 new GpuMemoryBufferImpl(size, format)); 77 new GpuMemoryBufferImpl(size, format));
78 } 78 }
79 79
80 gfx::GpuMemoryBuffer* 80 gfx::GpuMemoryBuffer*
81 TestGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer( 81 TestGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
82 ClientBuffer buffer) { 82 ClientBuffer buffer) {
83 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); 83 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer);
84 } 84 }
85 85
86 } // namespace cc 86 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_gpu_memory_buffer_manager.h ('k') | cc/test/test_in_process_context_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698