| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
| 6 | 6 |
| 7 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 7 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
| 8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
| 9 #include "gpu/command_buffer/client/gl_in_process_context.h" | 9 #include "gpu/command_buffer/client/gl_in_process_context.h" |
| 10 #include "ui/gl/android/surface_texture.h" | 10 #include "ui/gl/android/surface_texture.h" |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 172 |
| 173 if (failed) { | 173 if (failed) { |
| 174 offscreen_context_for_main_thread_ = NULL; | 174 offscreen_context_for_main_thread_ = NULL; |
| 175 } | 175 } |
| 176 return offscreen_context_for_main_thread_; | 176 return offscreen_context_for_main_thread_; |
| 177 } | 177 } |
| 178 | 178 |
| 179 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: | 179 scoped_refptr<cc::ContextProvider> SynchronousCompositorFactoryImpl:: |
| 180 CreateOnscreenContextProviderForCompositorThread( | 180 CreateOnscreenContextProviderForCompositorThread( |
| 181 scoped_refptr<gfx::GLSurface> surface) { | 181 scoped_refptr<gfx::GLSurface> surface) { |
| 182 DCHECK(surface); | |
| 183 DCHECK(service_); | 182 DCHECK(service_); |
| 184 | 183 |
| 185 if (!share_context_.get()) | 184 if (!share_context_.get()) |
| 186 share_context_ = CreateContext(NULL, service_, NULL); | 185 share_context_ = CreateContext(NULL, service_, NULL); |
| 187 return webkit::gpu::ContextProviderInProcess::Create( | 186 return webkit::gpu::ContextProviderInProcess::Create( |
| 188 WrapContext(CreateContext(surface, service_, share_context_.get())), | 187 WrapContext(CreateContext(surface, service_, share_context_.get())), |
| 189 "Compositor-Onscreen"); | 188 "Child-Compositor"); |
| 189 } |
| 190 |
| 191 gpu::GLInProcessContext* SynchronousCompositorFactoryImpl::GetShareContext() { |
| 192 DCHECK(share_context_.get()); |
| 193 return share_context_.get(); |
| 190 } | 194 } |
| 191 | 195 |
| 192 scoped_refptr<StreamTextureFactory> | 196 scoped_refptr<StreamTextureFactory> |
| 193 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int view_id) { | 197 SynchronousCompositorFactoryImpl::CreateStreamTextureFactory(int view_id) { |
| 194 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( | 198 scoped_refptr<StreamTextureFactorySynchronousImpl> factory( |
| 195 StreamTextureFactorySynchronousImpl::Create( | 199 StreamTextureFactorySynchronousImpl::Create( |
| 196 base::Bind( | 200 base::Bind( |
| 197 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, | 201 &SynchronousCompositorFactoryImpl::TryCreateStreamTextureFactory, |
| 198 base::Unretained(this)), | 202 base::Unretained(this)), |
| 199 view_id)); | 203 view_id)); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 return video_context_provider_; | 244 return video_context_provider_; |
| 241 } | 245 } |
| 242 | 246 |
| 243 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( | 247 void SynchronousCompositorFactoryImpl::SetDeferredGpuService( |
| 244 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 248 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
| 245 DCHECK(!service_); | 249 DCHECK(!service_); |
| 246 service_ = service; | 250 service_ = service; |
| 247 } | 251 } |
| 248 | 252 |
| 249 } // namespace content | 253 } // namespace content |
| OLD | NEW |