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 "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 Loading... | |
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 CHECK(context_provider.get()); |
piman
2013/08/14 21:38:17
nit: So, as I read it, the only way this would fai
danakj
2013/08/14 21:49:00
That is currently true. If the context provider in
| |
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 Loading... | |
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 return context.Pass(); | |
173 } | |
174 | |
163 TestContextFactory::TestContextFactory() {} | 175 TestContextFactory::TestContextFactory() {} |
164 | 176 |
165 TestContextFactory::~TestContextFactory() {} | 177 TestContextFactory::~TestContextFactory() {} |
166 | 178 |
167 scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface( | 179 scoped_ptr<cc::OutputSurface> TestContextFactory::CreateOutputSurface( |
168 Compositor* compositor) { | 180 Compositor* compositor) { |
169 scoped_ptr<WebKit::WebGraphicsContext3D> context( | 181 return make_scoped_ptr( |
170 cc::TestWebGraphicsContext3D::Create()); | 182 new cc::OutputSurface(cc::TestContextProvider::Create())); |
171 return make_scoped_ptr(new cc::OutputSurface(context.Pass())); | |
172 } | 183 } |
173 | 184 |
174 scoped_refptr<Reflector> TestContextFactory::CreateReflector( | 185 scoped_refptr<Reflector> TestContextFactory::CreateReflector( |
175 Compositor* mirrored_compositor, | 186 Compositor* mirrored_compositor, |
176 Layer* mirroring_layer) { | 187 Layer* mirroring_layer) { |
177 return new Reflector(); | 188 return new Reflector(); |
178 } | 189 } |
179 | 190 |
180 void TestContextFactory::RemoveReflector(scoped_refptr<Reflector> reflector) { | 191 void TestContextFactory::RemoveReflector(scoped_refptr<Reflector> reflector) { |
181 } | 192 } |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 } | 770 } |
760 | 771 |
761 void Compositor::NotifyEnd() { | 772 void Compositor::NotifyEnd() { |
762 last_ended_frame_++; | 773 last_ended_frame_++; |
763 FOR_EACH_OBSERVER(CompositorObserver, | 774 FOR_EACH_OBSERVER(CompositorObserver, |
764 observer_list_, | 775 observer_list_, |
765 OnCompositingEnded(this)); | 776 OnCompositingEnded(this)); |
766 } | 777 } |
767 | 778 |
768 } // namespace ui | 779 } // namespace ui |
OLD | NEW |