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

Side by Side Diff: trunk/src/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc

Issue 149953003: Revert 247793 "Ensure GL initialization only happens once, and p..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/ui/views/examples/examples_main.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include <GLES2/gl2ext.h> 11 #include <GLES2/gl2ext.h>
12 #include <GLES2/gl2extchromium.h> 12 #include <GLES2/gl2extchromium.h>
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "base/atomicops.h" 16 #include "base/atomicops.h"
17 #include "base/bind.h" 17 #include "base/bind.h"
18 #include "base/bind_helpers.h" 18 #include "base/bind_helpers.h"
19 #include "base/callback.h" 19 #include "base/callback.h"
20 #include "base/lazy_instance.h" 20 #include "base/lazy_instance.h"
21 #include "base/logging.h" 21 #include "base/logging.h"
22 #include "gpu/command_buffer/client/gl_in_process_context.h" 22 #include "gpu/command_buffer/client/gl_in_process_context.h"
23 #include "gpu/command_buffer/client/gles2_implementation.h" 23 #include "gpu/command_buffer/client/gles2_implementation.h"
24 #include "gpu/command_buffer/client/gles2_lib.h" 24 #include "gpu/command_buffer/client/gles2_lib.h"
25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h" 25 #include "gpu/skia_bindings/gl_bindings_skia_cmd_buffer.h"
26 #include "ui/gfx/size.h" 26 #include "ui/gfx/size.h"
27 #include "ui/gl/gl_implementation.h" 27 #include "ui/gl/gl_surface.h"
28 28
29 using gpu::gles2::GLES2Implementation; 29 using gpu::gles2::GLES2Implementation;
30 using gpu::GLInProcessContext; 30 using gpu::GLInProcessContext;
31 31
32 namespace webkit { 32 namespace webkit {
33 namespace gpu { 33 namespace gpu {
34 34
35 namespace { 35 namespace {
36 36
37 const int32 kCommandBufferSize = 1024 * 1024; 37 const int32 kCommandBufferSize = 1024 * 1024;
(...skipping 29 matching lines...) Expand all
67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer = 67 static base::LazyInstance<GLES2Initializer> g_gles2_initializer =
68 LAZY_INSTANCE_INITIALIZER; 68 LAZY_INSTANCE_INITIALIZER;
69 69
70 } // namespace anonymous 70 } // namespace anonymous
71 71
72 // static 72 // static
73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 73 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( 74 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
75 const blink::WebGraphicsContext3D::Attributes& attributes, 75 const blink::WebGraphicsContext3D::Attributes& attributes,
76 gfx::AcceleratedWidget window) { 76 gfx::AcceleratedWidget window) {
77 DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone); 77 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context;
78 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 78 if (gfx::GLSurface::InitializeOneOff()) {
79 context.reset(new WebGraphicsContext3DInProcessCommandBufferImpl(
79 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window)); 80 scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window));
81 }
82 return context.Pass();
80 } 83 }
81 84
82 // static 85 // static
83 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 86 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
84 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext( 87 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
85 const blink::WebGraphicsContext3D::Attributes& attributes) { 88 const blink::WebGraphicsContext3D::Attributes& attributes) {
86 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 89 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
87 scoped_ptr< ::gpu::GLInProcessContext>(), 90 scoped_ptr< ::gpu::GLInProcessContext>(),
88 attributes, 91 attributes,
89 true, 92 true,
90 gfx::kNullAcceleratedWidget)); 93 gfx::kNullAcceleratedWidget))
94 .Pass();
91 } 95 }
92 96
93 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> 97 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
94 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( 98 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
95 scoped_ptr< ::gpu::GLInProcessContext> context, 99 scoped_ptr< ::gpu::GLInProcessContext> context,
96 const blink::WebGraphicsContext3D::Attributes& attributes) { 100 const blink::WebGraphicsContext3D::Attributes& attributes) {
97 return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl( 101 return make_scoped_ptr(
98 context.Pass(), 102 new WebGraphicsContext3DInProcessCommandBufferImpl(
99 attributes, 103 context.Pass(),
100 true /* is_offscreen. Not used. */, 104 attributes,
101 gfx::kNullAcceleratedWidget /* window. Not used. */)); 105 true /* is_offscreen. Not used. */,
106 gfx::kNullAcceleratedWidget /* window. Not used. */))
107 .Pass();
102 } 108 }
103 109
104 WebGraphicsContext3DInProcessCommandBufferImpl:: 110 WebGraphicsContext3DInProcessCommandBufferImpl::
105 WebGraphicsContext3DInProcessCommandBufferImpl( 111 WebGraphicsContext3DInProcessCommandBufferImpl(
106 scoped_ptr< ::gpu::GLInProcessContext> context, 112 scoped_ptr< ::gpu::GLInProcessContext> context,
107 const blink::WebGraphicsContext3D::Attributes& attributes, 113 const blink::WebGraphicsContext3D::Attributes& attributes,
108 bool is_offscreen, 114 bool is_offscreen,
109 gfx::AcceleratedWidget window) 115 gfx::AcceleratedWidget window)
110 : is_offscreen_(is_offscreen), 116 : is_offscreen_(is_offscreen),
111 window_(window), 117 window_(window),
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 1185
1180 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM, 1186 DELEGATE_TO_GL_9(asyncTexSubImage2DCHROMIUM, AsyncTexSubImage2DCHROMIUM,
1181 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei, 1187 WGC3Denum, WGC3Dint, WGC3Dint, WGC3Dint, WGC3Dsizei, WGC3Dsizei,
1182 WGC3Denum, WGC3Denum, const void*) 1188 WGC3Denum, WGC3Denum, const void*)
1183 1189
1184 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM, 1190 DELEGATE_TO_GL_1(waitAsyncTexImage2DCHROMIUM, WaitAsyncTexImage2DCHROMIUM,
1185 WGC3Denum) 1191 WGC3Denum)
1186 1192
1187 } // namespace gpu 1193 } // namespace gpu
1188 } // namespace webkit 1194 } // namespace webkit
OLDNEW
« no previous file with comments | « trunk/src/ui/views/examples/examples_main.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698