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

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: Fix missing include 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
« no previous file with comments | « mojo/services/gles2/mojo_buffer_backing.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/logging.h"
8
9 namespace mojo {
10 namespace gles2 {
11
12 MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferHandle handle,
13 void* memory,
14 size_t size)
15 : handle_(handle.Pass()), memory_(memory), size_(size) {}
16
17 MojoBufferBacking::~MojoBufferBacking() { mojo::UnmapBuffer(memory_); }
18
19 // static
20 scoped_ptr<gpu::BufferBacking> MojoBufferBacking::Create(
21 mojo::ScopedSharedBufferHandle handle,
22 size_t size) {
23 void* memory = NULL;
24 MojoResult result = mojo::MapBuffer(
25 handle.get(), 0, size, &memory, MOJO_MAP_BUFFER_FLAG_NONE);
26 if (result != MOJO_RESULT_OK)
27 return scoped_ptr<BufferBacking>();
28 DCHECK(memory);
29 return scoped_ptr<BufferBacking>(
30 new MojoBufferBacking(handle.Pass(), memory, size));
31 }
32 void* MojoBufferBacking::GetMemory() const { return memory_; }
33 size_t MojoBufferBacking::GetSize() const { return size_; }
34
35 } // namespace gles2
36 } // namespace mojo
OLDNEW
« no previous file with comments | « 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