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/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 compositor_client_ = nullptr; | 147 compositor_client_ = nullptr; |
148 } | 148 } |
149 | 149 |
150 bool SynchronousCompositorImpl::InitializeHwDraw() { | 150 bool SynchronousCompositorImpl::InitializeHwDraw() { |
151 DCHECK(CalledOnValidThread()); | 151 DCHECK(CalledOnValidThread()); |
152 DCHECK(output_surface_); | 152 DCHECK(output_surface_); |
153 | 153 |
154 scoped_refptr<cc::ContextProvider> onscreen_context = | 154 scoped_refptr<cc::ContextProvider> onscreen_context = |
155 g_factory.Get().CreateOnscreenContextProviderForCompositorThread(); | 155 g_factory.Get().CreateOnscreenContextProviderForCompositorThread(); |
156 | 156 |
157 bool success = output_surface_->InitializeHwDraw(onscreen_context); | 157 scoped_refptr<cc::ContextProvider> worker_context = |
158 g_factory.Get().CreateOnscreenContextProviderForCompositorThread(); | |
boliu
2015/02/13 18:04:05
Is it possible/safe to key this off of a command l
vmiura
2015/02/13 19:52:34
We need it whenever GPU rasterization is enabled.
boliu
2015/02/13 20:25:52
Oh I thought the new context will only be used wit
| |
159 | |
160 bool success = | |
161 output_surface_->InitializeHwDraw(onscreen_context, worker_context); | |
158 | 162 |
159 if (success) | 163 if (success) |
160 g_factory.Get().CompositorInitializedHardwareDraw(); | 164 g_factory.Get().CompositorInitializedHardwareDraw(); |
161 return success; | 165 return success; |
162 } | 166 } |
163 | 167 |
164 void SynchronousCompositorImpl::ReleaseHwDraw() { | 168 void SynchronousCompositorImpl::ReleaseHwDraw() { |
165 DCHECK(CalledOnValidThread()); | 169 DCHECK(CalledOnValidThread()); |
166 DCHECK(output_surface_); | 170 DCHECK(output_surface_); |
167 output_surface_->ReleaseHwDraw(); | 171 output_surface_->ReleaseHwDraw(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 g_factory.Get(); // Ensure it's initialized. | 368 g_factory.Get(); // Ensure it's initialized. |
365 SynchronousCompositorImpl::CreateForWebContents(contents); | 369 SynchronousCompositorImpl::CreateForWebContents(contents); |
366 } | 370 } |
367 SynchronousCompositorImpl* instance = | 371 SynchronousCompositorImpl* instance = |
368 SynchronousCompositorImpl::FromWebContents(contents); | 372 SynchronousCompositorImpl::FromWebContents(contents); |
369 DCHECK(instance); | 373 DCHECK(instance); |
370 instance->SetClient(client); | 374 instance->SetClient(client); |
371 } | 375 } |
372 | 376 |
373 } // namespace content | 377 } // namespace content |
OLD | NEW |