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_output_surfa
ce.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 129 } |
130 | 130 |
131 namespace { | 131 namespace { |
132 void AdjustTransform(gfx::Transform* transform, gfx::Rect viewport) { | 132 void AdjustTransform(gfx::Transform* transform, gfx::Rect viewport) { |
133 // CC's draw origin starts at the viewport. | 133 // CC's draw origin starts at the viewport. |
134 transform->matrix().postTranslate(-viewport.x(), -viewport.y(), 0); | 134 transform->matrix().postTranslate(-viewport.x(), -viewport.y(), 0); |
135 } | 135 } |
136 } // namespace | 136 } // namespace |
137 | 137 |
138 bool SynchronousCompositorOutputSurface::InitializeHwDraw( | 138 bool SynchronousCompositorOutputSurface::InitializeHwDraw( |
139 scoped_refptr<cc::ContextProvider> onscreen_context_provider) { | 139 scoped_refptr<cc::ContextProvider> onscreen_context_provider, |
| 140 scoped_refptr<cc::ContextProvider> worker_context_provider) { |
140 DCHECK(CalledOnValidThread()); | 141 DCHECK(CalledOnValidThread()); |
141 DCHECK(HasClient()); | 142 DCHECK(HasClient()); |
142 DCHECK(!context_provider_.get()); | 143 DCHECK(!context_provider_.get()); |
143 | 144 |
144 return InitializeAndSetContext3d(onscreen_context_provider); | 145 return InitializeAndSetContext3d(onscreen_context_provider, |
| 146 worker_context_provider); |
145 } | 147 } |
146 | 148 |
147 void SynchronousCompositorOutputSurface::ReleaseHwDraw() { | 149 void SynchronousCompositorOutputSurface::ReleaseHwDraw() { |
148 DCHECK(CalledOnValidThread()); | 150 DCHECK(CalledOnValidThread()); |
149 cc::OutputSurface::ReleaseGL(); | 151 cc::OutputSurface::ReleaseGL(); |
150 } | 152 } |
151 | 153 |
152 scoped_ptr<cc::CompositorFrame> | 154 scoped_ptr<cc::CompositorFrame> |
153 SynchronousCompositorOutputSurface::DemandDrawHw( | 155 SynchronousCompositorOutputSurface::DemandDrawHw( |
154 gfx::Size surface_size, | 156 gfx::Size surface_size, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 279 } |
278 | 280 |
279 // Not using base::NonThreadSafe as we want to enforce a more exacting threading | 281 // Not using base::NonThreadSafe as we want to enforce a more exacting threading |
280 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI | 282 // requirement: SynchronousCompositorOutputSurface() must only be used on the UI |
281 // thread. | 283 // thread. |
282 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 284 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
283 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 285 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
284 } | 286 } |
285 | 287 |
286 } // namespace content | 288 } // namespace content |
OLD | NEW |