| OLD | NEW |
| 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 "mojo/public/c/gles2/gles2.h" | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
| 9 #include "gpu/GLES2/gl2extchromium.h" | 9 #include "gpu/GLES2/gl2extchromium.h" |
| 10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
| 11 #include "mojo/gles2/gles2_context.h" | 11 #include "mojo/gles2/gles2_context.h" |
| 12 // Even though this isn't used here, we need to include it to get the symbols to | 12 // Even though this isn't used here, we need to include it to get the symbols to |
| 13 // be exported in component build. | 13 // be exported in component build. |
| 14 #include "mojo/public/c/gles2/chromium_extension.h" | 14 #include "mojo/public/c/gles2/chromium_extension.h" |
| 15 #include "mojo/public/c/gles2/gles2.h" |
| 15 | 16 |
| 16 using gles2::GLES2Context; | 17 using gles2::GLES2Context; |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 const int32_t kNone = 0x3038; // EGL_NONE | 21 const int32_t kNone = 0x3038; // EGL_NONE |
| 21 | 22 |
| 22 base::LazyInstance<base::ThreadLocalPointer<gpu::gles2::GLES2Interface> >::Leaky | 23 base::LazyInstance<base::ThreadLocalPointer<gpu::gles2::GLES2Interface> >::Leaky |
| 23 g_gpu_interface; | 24 g_gpu_interface; |
| 24 | 25 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 mojo::ScopedMessagePipeHandle scoped_handle(mph); | 40 mojo::ScopedMessagePipeHandle scoped_handle(mph); |
| 40 std::vector<int32_t> attribs; | 41 std::vector<int32_t> attribs; |
| 41 if (attrib_list) { | 42 if (attrib_list) { |
| 42 for (int32_t const* p = attrib_list; *p != kNone;) { | 43 for (int32_t const* p = attrib_list; *p != kNone;) { |
| 43 attribs.push_back(*p++); | 44 attribs.push_back(*p++); |
| 44 attribs.push_back(*p++); | 45 attribs.push_back(*p++); |
| 45 } | 46 } |
| 46 } | 47 } |
| 47 attribs.push_back(kNone); | 48 attribs.push_back(kNone); |
| 48 scoped_ptr<GLES2Context> client(new GLES2Context( | 49 scoped_ptr<GLES2Context> client(new GLES2Context( |
| 49 attribs, async_waiter, scoped_handle.Pass(), lost_callback, closure)); | 50 attribs, async_waiter, std::move(scoped_handle), lost_callback, closure)); |
| 50 if (!client->Initialize()) | 51 if (!client->Initialize()) |
| 51 client.reset(); | 52 client.reset(); |
| 52 return client.release(); | 53 return client.release(); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void MojoGLES2DestroyContext(MojoGLES2Context context) { | 56 void MojoGLES2DestroyContext(MojoGLES2Context context) { |
| 56 delete static_cast<GLES2Context*>(context); | 57 delete static_cast<GLES2Context*>(context); |
| 57 } | 58 } |
| 58 | 59 |
| 59 void MojoGLES2MakeCurrent(MojoGLES2Context context) { | 60 void MojoGLES2MakeCurrent(MojoGLES2Context context) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ | 93 #define VISIT_GL_CALL(Function, ReturnType, PARAMETERS, ARGUMENTS) \ |
| 93 ReturnType GL_APIENTRY gl##Function PARAMETERS { \ | 94 ReturnType GL_APIENTRY gl##Function PARAMETERS { \ |
| 94 DCHECK(g_gpu_interface.Get().Get()); \ | 95 DCHECK(g_gpu_interface.Get().Get()); \ |
| 95 return g_gpu_interface.Get().Get()->Function ARGUMENTS; \ | 96 return g_gpu_interface.Get().Get()->Function ARGUMENTS; \ |
| 96 } | 97 } |
| 97 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" | 98 #include "mojo/public/c/gles2/gles2_call_visitor_autogen.h" |
| 98 #include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h" | 99 #include "mojo/public/c/gles2/gles2_call_visitor_chromium_extension_autogen.h" |
| 99 #undef VISIT_GL_CALL | 100 #undef VISIT_GL_CALL |
| 100 | 101 |
| 101 } // extern "C" | 102 } // extern "C" |
| OLD | NEW |