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

Side by Side Diff: components/mus/gles2/gl_surface_adapter.cc

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « components/mus/gles2/gl_surface_adapter.h ('k') | components/mus/gles2/gpu_impl.h » ('j') | 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 (c) 2016 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 "components/mus/gles2/gl_surface_adapter.h"
6
7 #include "base/bind.h"
8
9 namespace mus {
10
11 GLSurfaceAdapterMus::GLSurfaceAdapterMus(scoped_refptr<gl::GLSurface> surface)
12 : gl::GLSurfaceAdapter(surface.get()),
13 surface_(surface),
14 weak_ptr_factory_(this) {}
15
16 GLSurfaceAdapterMus::~GLSurfaceAdapterMus() {}
17
18 void GLSurfaceAdapterMus::SwapBuffersAsync(
19 const GLSurface::SwapCompletionCallback& callback) {
20 gl::GLSurfaceAdapter::SwapBuffersAsync(
21 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync,
22 weak_ptr_factory_.GetWeakPtr(), callback));
23 }
24
25 void GLSurfaceAdapterMus::PostSubBufferAsync(
26 int x,
27 int y,
28 int width,
29 int height,
30 const GLSurface::SwapCompletionCallback& callback) {
31 gl::GLSurfaceAdapter::PostSubBufferAsync(
32 x, y, width, height,
33 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync,
34 weak_ptr_factory_.GetWeakPtr(), callback));
35 }
36
37 void GLSurfaceAdapterMus::CommitOverlayPlanesAsync(
38 const GLSurface::SwapCompletionCallback& callback) {
39 gl::GLSurfaceAdapter::CommitOverlayPlanesAsync(
40 base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync,
41 weak_ptr_factory_.GetWeakPtr(), callback));
42 }
43
44 void GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync(
45 const gl::GLSurface::SwapCompletionCallback& original_callback,
46 gfx::SwapResult result) {
47 if (!adapter_callback_.is_null())
48 adapter_callback_.Run(result);
49 original_callback.Run(result);
50 }
51
52 void GLSurfaceAdapterMus::SetGpuCompletedSwapBuffersCallback(
53 gl::GLSurface::SwapCompletionCallback callback) {
54 adapter_callback_ = std::move(callback);
55 }
56
57 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/gles2/gl_surface_adapter.h ('k') | components/mus/gles2/gpu_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698