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

Side by Side Diff: components/view_manager/gles2/mojo_buffer_backing.cc

Issue 1150093003: Move GLES2, GPU & Surfaces into the ViewManager directory. This does not merge the applications, th… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 7 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 "components/gles2/mojo_buffer_backing.h" 5 #include "components/view_manager/gles2/mojo_buffer_backing.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace gles2 { 9 namespace gles2 {
10 10
11 MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferHandle handle, 11 MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferHandle handle,
12 void* memory, 12 void* memory,
13 size_t size) 13 size_t size)
14 : handle_(handle.Pass()), memory_(memory), size_(size) {} 14 : handle_(handle.Pass()), memory_(memory), size_(size) {}
15 15
16 MojoBufferBacking::~MojoBufferBacking() { mojo::UnmapBuffer(memory_); } 16 MojoBufferBacking::~MojoBufferBacking() { mojo::UnmapBuffer(memory_); }
17 17
18 // static 18 // static
19 scoped_ptr<gpu::BufferBacking> MojoBufferBacking::Create( 19 scoped_ptr<gpu::BufferBacking> MojoBufferBacking::Create(
20 mojo::ScopedSharedBufferHandle handle, 20 mojo::ScopedSharedBufferHandle handle,
21 size_t size) { 21 size_t size) {
22 void* memory = NULL; 22 void* memory = NULL;
23 MojoResult result = mojo::MapBuffer( 23 MojoResult result = mojo::MapBuffer(
24 handle.get(), 0, size, &memory, MOJO_MAP_BUFFER_FLAG_NONE); 24 handle.get(), 0, size, &memory, MOJO_MAP_BUFFER_FLAG_NONE);
25 if (result != MOJO_RESULT_OK) 25 if (result != MOJO_RESULT_OK)
26 return scoped_ptr<BufferBacking>(); 26 return scoped_ptr<BufferBacking>();
27 DCHECK(memory); 27 DCHECK(memory);
28 return scoped_ptr<BufferBacking>( 28 return scoped_ptr<BufferBacking>(
29 new MojoBufferBacking(handle.Pass(), memory, size)); 29 new MojoBufferBacking(handle.Pass(), memory, size));
30 } 30 }
31 void* MojoBufferBacking::GetMemory() const { return memory_; } 31 void* MojoBufferBacking::GetMemory() const { return memory_; }
32 size_t MojoBufferBacking::GetSize() const { return size_; } 32 size_t MojoBufferBacking::GetSize() const { return size_; }
33 33
34 } // namespace gles2 34 } // namespace gles2
OLDNEW
« no previous file with comments | « components/view_manager/gles2/mojo_buffer_backing.h ('k') | components/view_manager/native_viewport/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698