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

Side by Side Diff: mojo/gles2/gles2_impl.cc

Issue 687433002: Remove mojo/shell and (most) service implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove mojo/gles2, disable mojo apps in component build Created 6 years, 1 month 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 | « mojo/gles2/gles2_context.cc ('k') | mojo/gles2/gles2_impl_export.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 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/public/c/gles2/gles2.h"
6
7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h"
9 #include "gpu/GLES2/gl2extchromium.h"
10 #include "gpu/command_buffer/client/gles2_interface.h"
11 #include "mojo/gles2/gles2_context.h"
12 #include "mojo/gles2/gles2_impl_export.h"
13
14 using mojo::gles2::GLES2Context;
15
16 namespace {
17
18 base::LazyInstance<base::ThreadLocalPointer<gpu::gles2::GLES2Interface> >::Leaky
19 g_gpu_interface;
20
21 } // namespace
22
23 extern "C" {
24 MojoGLES2Context MojoGLES2CreateContext(MojoHandle handle,
25 MojoGLES2ContextLost lost_callback,
26 void* closure,
27 const MojoAsyncWaiter* async_waiter) {
28 mojo::MessagePipeHandle mph(handle);
29 mojo::ScopedMessagePipeHandle scoped_handle(mph);
30 scoped_ptr<GLES2Context> client(new GLES2Context(
31 async_waiter, scoped_handle.Pass(), lost_callback, closure));
32 if (!client->Initialize())
33 client.reset();
34 return client.release();
35 }
36
37 void MojoGLES2DestroyContext(MojoGLES2Context context) {
38 delete static_cast<GLES2Context*>(context);
39 }
40
41 void MojoGLES2MakeCurrent(MojoGLES2Context context) {
42 gpu::gles2::GLES2Interface* interface = NULL;
43 if (context) {
44 GLES2Context* client = static_cast<GLES2Context*>(context);
45 interface = client->interface();
46 DCHECK(interface);
47 }
48 g_gpu_interface.Get().Set(interface);
49 }
50
51 void MojoGLES2SwapBuffers() {
52 DCHECK(g_gpu_interface.Get().Get());
53 g_gpu_interface.Get().Get()->SwapBuffers();
54 }
55
56 void* MojoGLES2GetGLES2Interface(MojoGLES2Context context) {
57 return static_cast<GLES2Context*>(context)->interface();
58 }
59
60 void* MojoGLES2GetContextSupport(MojoGLES2Context context) {
61 return static_cast<GLES2Context*>(context)->context_support();
62 }
63
64 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \
65 ReturnType gl##Function PARAMETERS { \
66 DCHECK(g_gpu_interface.Get().Get()); \
67 return g_gpu_interface.Get().Get()->Function ARGUMENTS; \
68 }
69 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h"
70 #include "mojo/public/c/gles2/gles2_call_visitor_chromium_sync_point_autogen.h"
71 #include "mojo/public/c/gles2/gles2_call_visitor_chromium_texture_mailbox_autoge n.h"
72 #undef VISIT_GL_CALL
73
74 } // extern "C"
OLDNEW
« no previous file with comments | « mojo/gles2/gles2_context.cc ('k') | mojo/gles2/gles2_impl_export.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698