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

Side by Side Diff: ui/compositor/compositor.cc

Issue 14241034: ui: Use WebGraphicsContext3DInProcessCommandBufferImpl in compositor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « no previous file | 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 "ui/compositor/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 15 matching lines...) Expand all
26 #include "ui/compositor/compositor_observer.h" 26 #include "ui/compositor/compositor_observer.h"
27 #include "ui/compositor/compositor_switches.h" 27 #include "ui/compositor/compositor_switches.h"
28 #include "ui/compositor/dip_util.h" 28 #include "ui/compositor/dip_util.h"
29 #include "ui/compositor/layer.h" 29 #include "ui/compositor/layer.h"
30 #include "ui/compositor/test_web_graphics_context_3d.h" 30 #include "ui/compositor/test_web_graphics_context_3d.h"
31 #include "ui/gl/gl_context.h" 31 #include "ui/gl/gl_context.h"
32 #include "ui/gl/gl_implementation.h" 32 #include "ui/gl/gl_implementation.h"
33 #include "ui/gl/gl_surface.h" 33 #include "ui/gl/gl_surface.h"
34 #include "ui/gl/gl_switches.h" 34 #include "ui/gl/gl_switches.h"
35 #include "webkit/gpu/grcontext_for_webgraphicscontext3d.h" 35 #include "webkit/gpu/grcontext_for_webgraphicscontext3d.h"
36 #include "webkit/gpu/webgraphicscontext3d_in_process_impl.h" 36 #include "webkit/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h"
37 37
38 #if defined(OS_CHROMEOS) 38 #if defined(OS_CHROMEOS)
39 #include "base/chromeos/chromeos_version.h" 39 #include "base/chromeos/chromeos_version.h"
40 #endif 40 #endif
41 41
42 namespace { 42 namespace {
43 43
44 const double kDefaultRefreshRate = 60.0; 44 const double kDefaultRefreshRate = 60.0;
45 const double kTestRefreshRate = 200.0; 45 const double kTestRefreshRate = 200.0;
46 46
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon( 239 WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon(
240 Compositor* compositor, 240 Compositor* compositor,
241 bool offscreen) { 241 bool offscreen) {
242 DCHECK(offscreen || compositor); 242 DCHECK(offscreen || compositor);
243 WebKit::WebGraphicsContext3D::Attributes attrs; 243 WebKit::WebGraphicsContext3D::Attributes attrs;
244 attrs.depth = false; 244 attrs.depth = false;
245 attrs.stencil = false; 245 attrs.stencil = false;
246 attrs.antialias = false; 246 attrs.antialias = false;
247 attrs.shareResources = true; 247 attrs.shareResources = true;
248 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
248 WebKit::WebGraphicsContext3D* context = 249 WebKit::WebGraphicsContext3D* context =
249 offscreen ? 250 offscreen ?
250 webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWebView( 251 WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
251 attrs, false) : 252 attrs) :
252 webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWindow( 253 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
253 attrs, compositor->widget(), NULL); 254 attrs, compositor->widget());
254 if (!context) 255 if (!context)
255 return NULL; 256 return NULL;
256 257
257 CommandLine* command_line = CommandLine::ForCurrentProcess(); 258 CommandLine* command_line = CommandLine::ForCurrentProcess();
258 if (!offscreen) { 259 if (!offscreen) {
259 context->makeContextCurrent(); 260 context->makeContextCurrent();
260 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent(); 261 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent();
261 bool vsync = !command_line->HasSwitch(switches::kDisableGpuVsync); 262 bool vsync = !command_line->HasSwitch(switches::kDisableGpuVsync);
262 gl_context->SetSwapInterval(vsync ? 1 : 0); 263 gl_context->SetSwapInterval(vsync ? 1 : 0);
263 gl_context->ReleaseCurrent(NULL); 264 gl_context->ReleaseCurrent(NULL);
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 COMPOSITOR_EXPORT void DisableTestCompositor() { 808 COMPOSITOR_EXPORT void DisableTestCompositor() {
808 ResetImplicitFactory(); 809 ResetImplicitFactory();
809 g_test_compositor_enabled = false; 810 g_test_compositor_enabled = false;
810 } 811 }
811 812
812 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 813 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
813 return g_test_compositor_enabled; 814 return g_test_compositor_enabled;
814 } 815 }
815 816
816 } // namespace ui 817 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698