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

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

Issue 1024113003: Add multi-planar functions to GpuMemoryBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment fix. Created 5 years, 9 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 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 {
(...skipping 23 matching lines...) Expand all
34 public: 34 public:
35 GpuMemoryBufferImpl(const gfx::Size& size, 35 GpuMemoryBufferImpl(const gfx::Size& size,
36 Format format, 36 Format format,
37 scoped_ptr<base::SharedMemory> shared_memory) 37 scoped_ptr<base::SharedMemory> shared_memory)
38 : size_(size), 38 : size_(size),
39 format_(format), 39 format_(format),
40 shared_memory_(shared_memory.Pass()), 40 shared_memory_(shared_memory.Pass()),
41 mapped_(false) {} 41 mapped_(false) {}
42 42
43 // Overridden from gfx::GpuMemoryBuffer: 43 // Overridden from gfx::GpuMemoryBuffer:
44 void* Map() override { 44 bool Map(void** data) override {
45 DCHECK(!mapped_); 45 DCHECK(!mapped_);
46 if (!shared_memory_->Map(StrideInBytes(size_.width(), format_) * 46 if (!shared_memory_->Map(StrideInBytes(size_.width(), format_) *
47 size_.height())) 47 size_.height()))
48 return NULL; 48 return false;
49 mapped_ = true; 49 mapped_ = true;
50 return shared_memory_->memory(); 50 *data = shared_memory_->memory();
51 return true;
51 } 52 }
52 void Unmap() override { 53 void Unmap() override {
53 DCHECK(mapped_); 54 DCHECK(mapped_);
54 shared_memory_->Unmap(); 55 shared_memory_->Unmap();
55 mapped_ = false; 56 mapped_ = false;
56 } 57 }
57 bool IsMapped() const override { return mapped_; } 58 bool IsMapped() const override { return mapped_; }
58 Format GetFormat() const override { return format_; } 59 Format GetFormat() const override { return format_; }
59 uint32 GetStride() const override { 60 void GetStride(uint32* stride) const override {
60 return StrideInBytes(size_.width(), format_); 61 *stride = StrideInBytes(size_.width(), format_);
61 } 62 }
62 gfx::GpuMemoryBufferHandle GetHandle() const override { 63 gfx::GpuMemoryBufferHandle GetHandle() const override {
63 gfx::GpuMemoryBufferHandle handle; 64 gfx::GpuMemoryBufferHandle handle;
64 handle.type = gfx::SHARED_MEMORY_BUFFER; 65 handle.type = gfx::SHARED_MEMORY_BUFFER;
65 handle.handle = shared_memory_->handle(); 66 handle.handle = shared_memory_->handle();
66 return handle; 67 return handle;
67 } 68 }
68 ClientBuffer AsClientBuffer() override { 69 ClientBuffer AsClientBuffer() override {
69 return reinterpret_cast<ClientBuffer>(this); 70 return reinterpret_cast<ClientBuffer>(this);
70 } 71 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ClientBuffer buffer) { 103 ClientBuffer buffer) {
103 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer); 104 return reinterpret_cast<gfx::GpuMemoryBuffer*>(buffer);
104 } 105 }
105 106
106 void TestGpuMemoryBufferManager::SetDestructionSyncPoint( 107 void TestGpuMemoryBufferManager::SetDestructionSyncPoint(
107 gfx::GpuMemoryBuffer* buffer, 108 gfx::GpuMemoryBuffer* buffer,
108 uint32 sync_point) { 109 uint32 sync_point) {
109 } 110 }
110 111
111 } // namespace cc 112 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/zero_copy_tile_task_worker_pool.cc ('k') | content/browser/compositor/buffer_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698