OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_impl.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_impl.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "cc/input/input_handler.h" | 9 #include "cc/input/input_handler.h" |
10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" | 10 #include "content/browser/android/in_process/synchronous_compositor_factory_impl
.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 void SynchronousCompositor::SetGpuService( | 86 void SynchronousCompositor::SetGpuService( |
87 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { | 87 scoped_refptr<gpu::InProcessCommandBuffer::Service> service) { |
88 g_factory.Get().SetDeferredGpuService(service); | 88 g_factory.Get().SetDeferredGpuService(service); |
89 } | 89 } |
90 | 90 |
91 bool SynchronousCompositorImpl::InitializeHwDraw( | 91 bool SynchronousCompositorImpl::InitializeHwDraw( |
92 scoped_refptr<gfx::GLSurface> surface) { | 92 scoped_refptr<gfx::GLSurface> surface) { |
93 DCHECK(CalledOnValidThread()); | 93 DCHECK(CalledOnValidThread()); |
94 DCHECK(output_surface_); | 94 DCHECK(output_surface_); |
95 | 95 |
96 // Create contexts in this order so that the share group gets passed | |
97 // along correctly. | |
98 scoped_refptr<cc::ContextProvider> offscreen_context = | |
99 g_factory.Get().GetOffscreenContextProviderForCompositorThread(); | |
100 scoped_refptr<cc::ContextProvider> onscreen_context = | 96 scoped_refptr<cc::ContextProvider> onscreen_context = |
101 g_factory.Get().CreateOnscreenContextProviderForCompositorThread(surface); | 97 g_factory.Get().CreateOnscreenContextProviderForCompositorThread(surface); |
102 | 98 |
103 bool success = output_surface_->InitializeHwDraw(onscreen_context); | 99 bool success = output_surface_->InitializeHwDraw(onscreen_context); |
104 | 100 |
105 if (success) | 101 if (success) |
106 g_factory.Get().CompositorInitializedHardwareDraw(); | 102 g_factory.Get().CompositorInitializedHardwareDraw(); |
107 return success; | 103 return success; |
108 } | 104 } |
109 | 105 |
110 void SynchronousCompositorImpl::ReleaseHwDraw() { | 106 void SynchronousCompositorImpl::ReleaseHwDraw() { |
111 DCHECK(CalledOnValidThread()); | 107 DCHECK(CalledOnValidThread()); |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 g_factory.Get(); // Ensure it's initialized. | 280 g_factory.Get(); // Ensure it's initialized. |
285 SynchronousCompositorImpl::CreateForWebContents(contents); | 281 SynchronousCompositorImpl::CreateForWebContents(contents); |
286 } | 282 } |
287 if (SynchronousCompositorImpl* instance = | 283 if (SynchronousCompositorImpl* instance = |
288 SynchronousCompositorImpl::FromWebContents(contents)) { | 284 SynchronousCompositorImpl::FromWebContents(contents)) { |
289 instance->SetClient(client); | 285 instance->SetClient(client); |
290 } | 286 } |
291 } | 287 } |
292 | 288 |
293 } // namespace content | 289 } // namespace content |
OLD | NEW |