| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() { | 74 SynchronousCompositorFactoryImpl::GetInputHandlerManagerClient() { |
| 75 return synchronous_input_event_filter(); | 75 return synchronous_input_event_filter(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 scoped_refptr<ContextProviderWebContext> | 78 scoped_refptr<ContextProviderWebContext> |
| 79 SynchronousCompositorFactoryImpl::GetOffscreenContextProviderForMainThread() { | 79 SynchronousCompositorFactoryImpl::GetOffscreenContextProviderForMainThread() { |
| 80 // This check only guarantees the main thread context is created after | 80 // This check only guarantees the main thread context is created after |
| 81 // a compositor did successfully initialize hardware draw in the past. | 81 // a compositor did successfully initialize hardware draw in the past. |
| 82 // In particular this does not guarantee that the main thread context | 82 // In particular this does not guarantee that the main thread context |
| 83 // will fail creation when all compositors release hardware draw. | 83 // will fail creation when all compositors release hardware draw. |
| 84 bool failed = !CanCreateMainThreadContext(); | 84 bool failed = false; |
| 85 if (!failed && | 85 if ((!offscreen_context_for_main_thread_.get() || |
| 86 (!offscreen_context_for_main_thread_.get() || | |
| 87 offscreen_context_for_main_thread_->DestroyedOnMainThread())) { | 86 offscreen_context_for_main_thread_->DestroyedOnMainThread())) { |
| 88 offscreen_context_for_main_thread_ = | 87 offscreen_context_for_main_thread_ = |
| 89 webkit::gpu::ContextProviderInProcess::Create( | 88 webkit::gpu::ContextProviderInProcess::Create( |
| 90 CreateOffscreenContext(), | 89 CreateOffscreenContext(), |
| 91 "Compositor-Offscreen"); | 90 "Compositor-Offscreen"); |
| 92 failed = !offscreen_context_for_main_thread_.get() || | 91 failed = !offscreen_context_for_main_thread_.get() || |
| 93 !offscreen_context_for_main_thread_->BindToCurrentThread(); | 92 !offscreen_context_for_main_thread_->BindToCurrentThread(); |
| 94 } | 93 } |
| 95 | 94 |
| 96 if (failed) { | 95 if (failed) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 wrapped_gl_context_for_main_thread_ = context.get(); | 201 wrapped_gl_context_for_main_thread_ = context.get(); |
| 203 if (!context.get()) | 202 if (!context.get()) |
| 204 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); | 203 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>(); |
| 205 | 204 |
| 206 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( | 205 return scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>( |
| 207 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( | 206 WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext( |
| 208 context.Pass(), attributes)); | 207 context.Pass(), attributes)); |
| 209 } | 208 } |
| 210 | 209 |
| 211 } // namespace content | 210 } // namespace content |
| OLD | NEW |