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

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

Issue 12212007: cc: Route offscreen context creation for compositor to the browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put OffscreenContext class in content/common/gpu/client for renderer Created 7 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
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 cc::OutputSurface* DefaultContextFactory::CreateOutputSurface( 156 cc::OutputSurface* DefaultContextFactory::CreateOutputSurface(
157 Compositor* compositor) { 157 Compositor* compositor) {
158 return new WebGraphicsContextToOutputSurfaceAdapter( 158 return new WebGraphicsContextToOutputSurfaceAdapter(
159 CreateContextCommon(compositor, false)); 159 CreateContextCommon(compositor, false));
160 } 160 }
161 161
162 WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateOffscreenContext() { 162 WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateOffscreenContext() {
163 return CreateContextCommon(NULL, true); 163 return CreateContextCommon(NULL, true);
164 } 164 }
165 165
166 WebKit::WebGraphicsContext3D* DefaultContextFactory::
167 OffscreenContextForMainThread() {
168 return NULL;
169 }
170
171 WebKit::WebGraphicsContext3D* DefaultContextFactory::
172 OffscreenContextForCompositorThread() {
173 return NULL;
174 }
175
176 GrContext* DefaultContextFactory::
177 OffscreenGrContextForMainThread() {
178 return NULL;
179 }
180
181 GrContext* DefaultContextFactory::
182 OffscreenGrContextForCompositorThread() {
183 return NULL;
184 }
185
166 void DefaultContextFactory::RemoveCompositor(Compositor* compositor) { 186 void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
167 } 187 }
168 188
169 WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon( 189 WebKit::WebGraphicsContext3D* DefaultContextFactory::CreateContextCommon(
170 Compositor* compositor, 190 Compositor* compositor,
171 bool offscreen) { 191 bool offscreen) {
172 DCHECK(offscreen || compositor); 192 DCHECK(offscreen || compositor);
173 WebKit::WebGraphicsContext3D::Attributes attrs; 193 WebKit::WebGraphicsContext3D::Attributes attrs;
174 attrs.depth = false; 194 attrs.depth = false;
175 attrs.stencil = false; 195 attrs.stencil = false;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 new WebGraphicsContextToOutputSurfaceAdapter(test_context)); 534 new WebGraphicsContextToOutputSurfaceAdapter(test_context));
515 } else { 535 } else {
516 return scoped_ptr<cc::OutputSurface>( 536 return scoped_ptr<cc::OutputSurface>(
517 ContextFactory::GetInstance()->CreateOutputSurface(this)); 537 ContextFactory::GetInstance()->CreateOutputSurface(this));
518 } 538 }
519 } 539 }
520 540
521 void Compositor::didRecreateOutputSurface(bool success) { 541 void Compositor::didRecreateOutputSurface(bool success) {
522 } 542 }
523 543
544 WebKit::WebGraphicsContext3D*
545 Compositor::offscreenContext3dForMainThread() {
546 // TODO(danakj): Create an OffscreenContext out of a TestWebGraphicsContext3D
547 // and store it somewhere so we can get the GrContext out of it too.
548 if (g_test_compositor_enabled)
549 return NULL;
550 return ContextFactory::GetInstance()->
551 OffscreenContextForMainThread();
552 }
553
554 WebKit::WebGraphicsContext3D*
555 Compositor::offscreenContext3dForCompositorThread() {
556 // TODO(danakj): Create an OffscreenContext out of a TestWebGraphicsContext3D
557 // and store it somewhere so we can get the GrContext out of it too.
558 if (g_test_compositor_enabled)
559 return NULL;
560 return ContextFactory::GetInstance()->
561 OffscreenContextForCompositorThread();
562 }
563
564 GrContext* Compositor::offscreenGrContextForMainThread() {
565 if (g_test_compositor_enabled)
566 return NULL;
567 return ContextFactory::GetInstance()->
568 OffscreenGrContextForMainThread();
569 }
570
571 GrContext* Compositor::offscreenGrContextForCompositorThread() {
572 if (g_test_compositor_enabled)
573 return NULL;
574 return ContextFactory::GetInstance()->
575 OffscreenGrContextForCompositorThread();
576 }
577
524 scoped_ptr<cc::InputHandler> Compositor::createInputHandler() { 578 scoped_ptr<cc::InputHandler> Compositor::createInputHandler() {
525 return scoped_ptr<cc::InputHandler>(); 579 return scoped_ptr<cc::InputHandler>();
526 } 580 }
527 581
528 void Compositor::willCommit() { 582 void Compositor::willCommit() {
529 } 583 }
530 584
531 void Compositor::didCommit() { 585 void Compositor::didCommit() {
532 DCHECK(!IsLocked()); 586 DCHECK(!IsLocked());
533 FOR_EACH_OBSERVER(CompositorObserver, 587 FOR_EACH_OBSERVER(CompositorObserver,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 658
605 COMPOSITOR_EXPORT void DisableTestCompositor() { 659 COMPOSITOR_EXPORT void DisableTestCompositor() {
606 g_test_compositor_enabled = false; 660 g_test_compositor_enabled = false;
607 } 661 }
608 662
609 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() { 663 COMPOSITOR_EXPORT bool IsTestCompositorEnabled() {
610 return g_test_compositor_enabled; 664 return g_test_compositor_enabled;
611 } 665 }
612 666
613 } // namespace ui 667 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698