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

Side by Side Diff: blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.cc

Issue 2266863003: blimp: Move BlimpCompositor to use delegated rendering. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make gn happy Created 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h" 5 #include <blimp/client/feature/compositor/blimp_gpu_memory_buffer_manager.h>
6
7 #include <GLES2/gl2.h> 6 #include <GLES2/gl2.h>
8 #include <stddef.h> 7 #include <stddef.h>
9 #include <stdint.h> 8 #include <stdint.h>
10 9
11 #include <memory> 10 #include <memory>
12 11
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
15 #include "base/numerics/safe_conversions.h" 14 #include "base/numerics/safe_conversions.h"
16 #include "ui/gfx/buffer_format_util.h" 15 #include "ui/gfx/buffer_format_util.h"
(...skipping 14 matching lines...) Expand all
31 : size_(size), 30 : size_(size),
32 format_(format), 31 format_(format),
33 shared_memory_(std::move(shared_memory)), 32 shared_memory_(std::move(shared_memory)),
34 offset_(offset), 33 offset_(offset),
35 stride_(stride), 34 stride_(stride),
36 mapped_(false) {} 35 mapped_(false) {}
37 36
38 // Overridden from gfx::GpuMemoryBuffer: 37 // Overridden from gfx::GpuMemoryBuffer:
39 bool Map() override { 38 bool Map() override {
40 DCHECK(!mapped_); 39 DCHECK(!mapped_);
41 DCHECK_EQ(stride_, gfx::RowSizeForBufferFormat(size_.width(), 40 DCHECK_EQ(stride_, gfx::RowSizeForBufferFormat(size_.width(), format_, 0));
42 format_, 0));
43 if (!shared_memory_->Map(offset_ + 41 if (!shared_memory_->Map(offset_ +
44 gfx::BufferSizeForBufferFormat(size_, format_))) 42 gfx::BufferSizeForBufferFormat(size_, format_)))
45 return false; 43 return false;
46 mapped_ = true; 44 mapped_ = true;
47 return true; 45 return true;
48 } 46 }
49 47
50 void* memory(size_t plane) override { 48 void* memory(size_t plane) override {
51 DCHECK(mapped_); 49 DCHECK(mapped_);
52 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_)); 50 DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
53 return reinterpret_cast<uint8_t*>(shared_memory_->memory()) + offset_ + 51 return reinterpret_cast<uint8_t*>(shared_memory_->memory()) + offset_ +
54 gfx::BufferOffsetForBufferFormat(size_, format_, plane); 52 gfx::BufferOffsetForBufferFormat(size_, format_, plane);
55 } 53 }
56 54
57 void Unmap() override { 55 void Unmap() override {
58 DCHECK(mapped_); 56 DCHECK(mapped_);
59 shared_memory_->Unmap(); 57 shared_memory_->Unmap();
60 mapped_ = false; 58 mapped_ = false;
61 } 59 }
62 60
63 gfx::Size GetSize() const override { return size_; } 61 gfx::Size GetSize() const override { return size_; }
64 62
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 156 }
159 157
160 void BlimpGpuMemoryBufferManager::SetDestructionSyncToken( 158 void BlimpGpuMemoryBufferManager::SetDestructionSyncToken(
161 gfx::GpuMemoryBuffer* buffer, 159 gfx::GpuMemoryBuffer* buffer,
162 const gpu::SyncToken& sync_token) { 160 const gpu::SyncToken& sync_token) {
163 NOTIMPLEMENTED(); 161 NOTIMPLEMENTED();
164 } 162 }
165 163
166 } // namespace client 164 } // namespace client
167 } // namespace blimp 165 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698