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 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 5 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
10 #endif | 10 #endif |
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 { | 771 { |
772 AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(), | 772 AutoLockAndDecoderDetachThread lock(g_decoder_lock.Get(), |
773 g_all_shared_contexts.Get()); | 773 g_all_shared_contexts.Get()); |
774 DCHECK(g_all_shared_contexts.Get().empty()); | 774 DCHECK(g_all_shared_contexts.Get().empty()); |
775 } | 775 } |
776 #endif // !defined(NDEBUG) | 776 #endif // !defined(NDEBUG) |
777 g_use_virtualized_gl_context = true; | 777 g_use_virtualized_gl_context = true; |
778 } | 778 } |
779 | 779 |
780 // static | 780 // static |
781 WebGraphicsContext3DInProcessCommandBufferImpl* | 781 scoped_ptr<WebKit::WebGraphicsContext3D> |
782 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( | 782 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( |
783 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 783 const WebKit::WebGraphicsContext3D::Attributes& attributes, |
784 gfx::AcceleratedWidget window) { | 784 gfx::AcceleratedWidget window) { |
785 if (!gfx::GLSurface::InitializeOneOff()) | 785 scoped_ptr<WebKit::WebGraphicsContext3D> context; |
786 return NULL; | 786 if (gfx::GLSurface::InitializeOneOff()) { |
787 return new WebGraphicsContext3DInProcessCommandBufferImpl( | 787 context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl( |
788 attributes, false, window); | 788 attributes, false, window)); |
| 789 } |
| 790 return context.Pass(); |
789 } | 791 } |
790 | 792 |
791 // static | 793 // static |
792 WebGraphicsContext3DInProcessCommandBufferImpl* | 794 scoped_ptr<WebKit::WebGraphicsContext3D> |
793 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( | 795 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( |
794 const WebKit::WebGraphicsContext3D::Attributes& attributes) { | 796 const WebKit::WebGraphicsContext3D::Attributes& attributes) { |
795 return new WebGraphicsContext3DInProcessCommandBufferImpl( | 797 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( |
796 attributes, true, gfx::kNullAcceleratedWidget); | 798 attributes, true, gfx::kNullAcceleratedWidget)) |
| 799 .PassAs<WebKit::WebGraphicsContext3D>(); |
797 } | 800 } |
798 | 801 |
799 WebGraphicsContext3DInProcessCommandBufferImpl:: | 802 WebGraphicsContext3DInProcessCommandBufferImpl:: |
800 WebGraphicsContext3DInProcessCommandBufferImpl( | 803 WebGraphicsContext3DInProcessCommandBufferImpl( |
801 const WebKit::WebGraphicsContext3D::Attributes& attributes, | 804 const WebKit::WebGraphicsContext3D::Attributes& attributes, |
802 bool is_offscreen, | 805 bool is_offscreen, |
803 gfx::AcceleratedWidget window) | 806 gfx::AcceleratedWidget window) |
804 : is_offscreen_(is_offscreen), | 807 : is_offscreen_(is_offscreen), |
805 window_(window), | 808 window_(window), |
806 initialized_(false), | 809 initialized_(false), |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, | 1982 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, |
1980 WGC3Denum) | 1983 WGC3Denum) |
1981 | 1984 |
1982 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator( | 1985 void WebGraphicsContext3DInProcessCommandBufferImpl::SetGpuMemoryBufferCreator( |
1983 GpuMemoryBufferCreator* creator) { | 1986 GpuMemoryBufferCreator* creator) { |
1984 g_gpu_memory_buffer_creator = creator; | 1987 g_gpu_memory_buffer_creator = creator; |
1985 } | 1988 } |
1986 | 1989 |
1987 } // namespace gpu | 1990 } // namespace gpu |
1988 } // namespace webkit | 1991 } // namespace webkit |
OLD | NEW |