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

Side by Side Diff: mojo/services/gles2/mojo_buffer_backing.cc

Issue 221453007: mojo/gpu: use SharedBuffer instead of base::SharedMemory with hacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/services/gles2/mojo_buffer_backing.h"
6
7 namespace mojo {
8 namespace gles2 {
9
10 MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferHandle handle,
11 void* memory,
12 size_t size)
13 : handle_(handle.Pass()), memory_(memory), size_(size) {}
14
15 MojoBufferBacking::~MojoBufferBacking() { mojo::UnmapBuffer(memory_); }
16
17 // static
18 scoped_ptr<gpu::BufferBacking> MojoBufferBacking::Create(
19 mojo::ScopedSharedBufferHandle handle,
20 size_t size) {
21 void* memory = NULL;
22 MojoResult result = mojo::MapBuffer(
23 handle.get(), 0, size, &memory, MOJO_MAP_BUFFER_FLAG_NONE);
24 if (result != MOJO_RESULT_OK)
25 return scoped_ptr<BufferBacking>();
26 DCHECK(memory);
27 return scoped_ptr<BufferBacking>(
28 new MojoBufferBacking(handle.Pass(), memory, size));
29 }
30 void* MojoBufferBacking::GetMemory() const { return memory_; }
31 size_t MojoBufferBacking::GetSize() const { return size_; }
32
33 } // namespace gles2
34 } // namespace mojo
OLDNEW
« mojo/gles2/command_buffer_client_impl.cc ('K') | « mojo/services/gles2/mojo_buffer_backing.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698