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

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

Issue 20185002: ContextProvider in OutputSurface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contextprovider: don't access Context3d() in OutputSurface contructors, it's not bound yet Created 7 years, 4 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 | « ui/compositor/compositor.h ('k') | webkit/common/gpu/context_provider_in_process.h » ('j') | 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 if (!gfx::GLSurface::InitializeOneOff() || 102 if (!gfx::GLSurface::InitializeOneOff() ||
103 gfx::GetGLImplementation() == gfx::kGLImplementationNone) { 103 gfx::GetGLImplementation() == gfx::kGLImplementationNone) {
104 LOG(ERROR) << "Could not load the GL bindings"; 104 LOG(ERROR) << "Could not load the GL bindings";
105 return false; 105 return false;
106 } 106 }
107 return true; 107 return true;
108 } 108 }
109 109
110 scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface( 110 scoped_ptr<cc::OutputSurface> DefaultContextFactory::CreateOutputSurface(
111 Compositor* compositor) { 111 Compositor* compositor) {
112 WebKit::WebGraphicsContext3D::Attributes attrs;
113 attrs.depth = false;
114 attrs.stencil = false;
115 attrs.antialias = false;
116 attrs.shareResources = true;
117 112
118 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl; 113 using webkit::gpu::ContextProviderInProcess;
119 scoped_ptr<WebKit::WebGraphicsContext3D> context( 114 scoped_refptr<ContextProviderInProcess> context_provider =
120 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext( 115 ContextProviderInProcess::Create(
121 attrs, compositor->widget())); 116 base::Bind(&DefaultContextFactory::CreateViewContext, compositor));
122 return make_scoped_ptr(new cc::OutputSurface(context.Pass())); 117 DCHECK(context_provider.get());
118 return make_scoped_ptr(new cc::OutputSurface(context_provider));
123 } 119 }
124 120
125 scoped_refptr<Reflector> DefaultContextFactory::CreateReflector( 121 scoped_refptr<Reflector> DefaultContextFactory::CreateReflector(
126 Compositor* mirroed_compositor, 122 Compositor* mirroed_compositor,
127 Layer* mirroring_layer) { 123 Layer* mirroring_layer) {
128 return NULL; 124 return NULL;
129 } 125 }
130 126
131 void DefaultContextFactory::RemoveReflector( 127 void DefaultContextFactory::RemoveReflector(
132 scoped_refptr<Reflector> reflector) { 128 scoped_refptr<Reflector> reflector) {
(...skipping 20 matching lines...) Expand all
153 webkit::gpu::ContextProviderInProcess::CreateOffscreen(); 149 webkit::gpu::ContextProviderInProcess::CreateOffscreen();
154 } 150 }
155 return offscreen_contexts_compositor_thread_; 151 return offscreen_contexts_compositor_thread_;
156 } 152 }
157 153
158 void DefaultContextFactory::RemoveCompositor(Compositor* compositor) { 154 void DefaultContextFactory::RemoveCompositor(Compositor* compositor) {
159 } 155 }
160 156
161 bool DefaultContextFactory::DoesCreateTestContexts() { return false; } 157 bool DefaultContextFactory::DoesCreateTestContexts() { return false; }
162 158
159 // static
160 scoped_ptr<webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl>
161 DefaultContextFactory::CreateViewContext(Compositor* compositor) {
162 WebKit::WebGraphicsContext3D::Attributes attrs;
163 attrs.depth = false;
164 attrs.stencil = false;
165 attrs.antialias = false;
166 attrs.shareResources = true;
167
168 using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
169 scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context(
170 WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
171 attrs, compositor->widget()));
172 CHECK(context);
173 return context.Pass();
174 }
175
163 TestContextFactory::TestContextFactory() {} 176 TestContextFactory::TestContextFactory() {}
164 177
165 TestContextFactory::~TestContextFactory() {} 178 TestContextFactory::~TestContextFactory() {}
166 179
167 scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface( 180 scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface(
168 Compositor* compositor) { 181 Compositor* compositor) {
169 scoped_ptr<WebKit::WebGraphicsContext3D> context( 182 return make_scoped_ptr(
170 cc::TestWebGraphicsContext3D::Create()); 183 new cc::OutputSurface(cc::TestContextProvider::Create()));
171 return make_scoped_ptr(new cc::OutputSurface(context.Pass()));
172 } 184 }
173 185
174 scoped_refptr<Reflector> TestContextFactory::CreateReflector( 186 scoped_refptr<Reflector> TestContextFactory::CreateReflector(
175 Compositor* mirrored_compositor, 187 Compositor* mirrored_compositor,
176 Layer* mirroring_layer) { 188 Layer* mirroring_layer) {
177 return new Reflector(); 189 return new Reflector();
178 } 190 }
179 191
180 void TestContextFactory::RemoveReflector(scoped_refptr<Reflector> reflector) { 192 void TestContextFactory::RemoveReflector(scoped_refptr<Reflector> reflector) {
181 } 193 }
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 } 771 }
760 772
761 void Compositor::NotifyEnd() { 773 void Compositor::NotifyEnd() {
762 last_ended_frame_++; 774 last_ended_frame_++;
763 FOR_EACH_OBSERVER(CompositorObserver, 775 FOR_EACH_OBSERVER(CompositorObserver,
764 observer_list_, 776 observer_list_,
765 OnCompositingEnded(this)); 777 OnCompositingEnded(this));
766 } 778 }
767 779
768 } // namespace ui 780 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | webkit/common/gpu/context_provider_in_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698