| 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" |
| 11 #include "ui/gl/gl_surface.h" | 11 #include "ui/gl/gl_surface.h" |
| 12 #include "webkit/common/gpu/context_provider_in_process.h" | 12 #include "webkit/common/gpu/context_provider_in_process.h" |
| 13 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" | 13 #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.
h" |
| 14 | 14 |
| 15 using webkit::gpu::ContextProviderWebContext; |
| 16 |
| 15 namespace content { | 17 namespace content { |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 class VideoContextProvider | 21 class VideoContextProvider |
| 20 : public StreamTextureFactorySynchronousImpl::ContextProvider { | 22 : public StreamTextureFactorySynchronousImpl::ContextProvider { |
| 21 public: | 23 public: |
| 22 VideoContextProvider( | 24 VideoContextProvider( |
| 23 const scoped_refptr<cc::ContextProvider>& context_provider, | 25 const scoped_refptr<cc::ContextProvider>& context_provider, |
| 24 gpu::GLInProcessContext* gl_in_process_context) | 26 gpu::GLInProcessContext* gl_in_process_context) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 scoped_ptr<SynchronousCompositorOutputSurface> output_surface( | 68 scoped_ptr<SynchronousCompositorOutputSurface> output_surface( |
| 67 new SynchronousCompositorOutputSurface(routing_id)); | 69 new SynchronousCompositorOutputSurface(routing_id)); |
| 68 return output_surface.PassAs<cc::OutputSurface>(); | 70 return output_surface.PassAs<cc::OutputSurface>(); |
| 69 } | 71 } |
| 70 | 72 |
| 71 InputHandlerManagerClient* | 73 InputHandlerManagerClient* |
| 72 SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() { | 74 SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() { |
| 73 return synchronous_input_event_filter(); | 75 return synchronous_input_event_filter(); |
| 74 } | 76 } |
| 75 | 77 |
| 76 scoped_refptr<cc::ContextProvider> | 78 scoped_refptr<ContextProviderWebContext> |
| 77 SynchronousCompositorFactoryImpl::GetOffscreenContextProviderForMainThread() { | 79 SynchronousCompositorFactoryImpl::GetOffscreenContextProviderForMainThread() { |
| 78 // This check only guarantees the main thread context is created after | 80 // This check only guarantees the main thread context is created after |
| 79 // a compositor did successfully initialize hardware draw in the past. | 81 // a compositor did successfully initialize hardware draw in the past. |
| 80 // In particular this does not guarantee that the main thread context | 82 // In particular this does not guarantee that the main thread context |
| 81 // will fail creation when all compositors release hardware draw. | 83 // will fail creation when all compositors release hardware draw. |
| 82 bool failed = !CanCreateMainThreadContext(); | 84 bool failed = !CanCreateMainThreadContext(); |
| 83 if (!failed && | 85 if (!failed && |
| 84 (!offscreen_context_for_main_thread_.get() || | 86 (!offscreen_context_for_main_thread_.get() || |
| 85 offscreen_context_for_main_thread_->DestroyedOnMainThread())) { | 87 offscreen_context_for_main_thread_->DestroyedOnMainThread())) { |
| 86 offscreen_context_for_main_thread_ = | 88 offscreen_context_for_main_thread_ = |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 wrapped_gl_context_for_main_thread_ = context.get(); | 202 wrapped_gl_context_for_main_thread_ = context.get(); |
| 201 if (!context.get()) | 203 if (!context.get()) |
| 202 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 204 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 203 | 205 |
| 204 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 206 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
| 205 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 207 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 206 context.Pass(), attributes)); | 208 context.Pass(), attributes)); |
| 207 } | 209 } |
| 208 | 210 |
| 209 } // namespace content | 211 } // namespace content |
| OLD | NEW |