OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 5 |
6 #include <pthread.h> | 6 #include <pthread.h> |
7 | 7 |
8 #include "ppapi/c/pp_graphics_3d.h" | 8 #include "ppapi/c/pp_graphics_3d.h" |
9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
10 #include "ppapi/gles2/gl2ext_ppapi.h" | 10 #include "ppapi/gles2/gl2ext_ppapi.h" |
11 #include "opengl_context.h" | 11 #include "opengl_context.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 // This is called by the brower when the 3D context has been flushed to the | 14 // This is called by the browser when the 3D context has been flushed to the |
15 // browser window. | 15 // browser window. |
16 void FlushCallback(void* data, int32_t result) { | 16 void FlushCallback(void* data, int32_t result) { |
17 static_cast<tumbler::OpenGLContext*>(data)->set_flush_pending(false); | 17 static_cast<tumbler::OpenGLContext*>(data)->set_flush_pending(false); |
18 } | 18 } |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 namespace tumbler { | 21 namespace tumbler { |
22 | 22 |
23 OpenGLContext::OpenGLContext(pp::Instance* instance) | 23 OpenGLContext::OpenGLContext(pp::Instance* instance) |
24 : pp::Graphics3DClient(instance), | 24 : pp::Graphics3DClient(instance), |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void OpenGLContext::FlushContext() { | 77 void OpenGLContext::FlushContext() { |
78 if (flush_pending()) { | 78 if (flush_pending()) { |
79 // A flush is pending so do nothing; just drop this flush on the floor. | 79 // A flush is pending so do nothing; just drop this flush on the floor. |
80 return; | 80 return; |
81 } | 81 } |
82 set_flush_pending(true); | 82 set_flush_pending(true); |
83 context_.SwapBuffers(pp::CompletionCallback(&FlushCallback, this)); | 83 context_.SwapBuffers(pp::CompletionCallback(&FlushCallback, this)); |
84 } | 84 } |
85 } // namespace tumbler | 85 } // namespace tumbler |
86 | 86 |
OLD | NEW |