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 "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
10 #include "cc/input/input_handler.h" | 10 #include "cc/input/input_handler.h" |
11 #include "cc/input/layer_scroll_offset_delegate.h" | 11 #include "cc/input/layer_scroll_offset_delegate.h" |
12 #include "content/browser/android/in_process/synchronous_input_event_filter.h" | 12 #include "content/browser/android/in_process/synchronous_input_event_filter.h" |
13 #include "content/browser/renderer_host/render_widget_host_view_android.h" | 13 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
14 #include "content/public/browser/android/synchronous_compositor_client.h" | 14 #include "content/public/browser/android/synchronous_compositor_client.h" |
15 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
16 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
17 #include "content/public/browser/render_view_host.h" | 17 #include "content/public/browser/render_view_host.h" |
18 #include "content/renderer/android/synchronous_compositor_factory.h" | 18 #include "content/renderer/android/synchronous_compositor_factory.h" |
| 19 #include "ui/gl/gl_surface.h" |
19 #include "webkit/common/gpu/context_provider_in_process.h" | 20 #include "webkit/common/gpu/context_provider_in_process.h" |
20 | 21 |
21 namespace content { | 22 namespace content { |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 int GetInProcessRendererId() { | 26 int GetInProcessRendererId() { |
26 content::RenderProcessHost::iterator it = | 27 content::RenderProcessHost::iterator it = |
27 content::RenderProcessHost::AllHostsIterator(); | 28 content::RenderProcessHost::AllHostsIterator(); |
28 if (it.IsAtEnd()) { | 29 if (it.IsAtEnd()) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 compositor_client_->DidDestroyCompositor(this); | 137 compositor_client_->DidDestroyCompositor(this); |
137 SetInputHandler(NULL); | 138 SetInputHandler(NULL); |
138 } | 139 } |
139 | 140 |
140 void SynchronousCompositorImpl::SetClient( | 141 void SynchronousCompositorImpl::SetClient( |
141 SynchronousCompositorClient* compositor_client) { | 142 SynchronousCompositorClient* compositor_client) { |
142 DCHECK(CalledOnValidThread()); | 143 DCHECK(CalledOnValidThread()); |
143 compositor_client_ = compositor_client; | 144 compositor_client_ = compositor_client; |
144 } | 145 } |
145 | 146 |
146 bool SynchronousCompositorImpl::InitializeHwDraw() { | 147 bool SynchronousCompositorImpl::InitializeHwDraw( |
| 148 scoped_refptr<gfx::GLSurface> surface) { |
147 DCHECK(CalledOnValidThread()); | 149 DCHECK(CalledOnValidThread()); |
148 DCHECK(output_surface_); | 150 DCHECK(output_surface_); |
149 return output_surface_->InitializeHwDraw( | 151 return output_surface_->InitializeHwDraw( |
| 152 surface, |
150 g_factory.Get().GetOffscreenContextProviderForCompositorThread()); | 153 g_factory.Get().GetOffscreenContextProviderForCompositorThread()); |
151 } | 154 } |
152 | 155 |
153 void SynchronousCompositorImpl::ReleaseHwDraw() { | 156 void SynchronousCompositorImpl::ReleaseHwDraw() { |
154 DCHECK(CalledOnValidThread()); | 157 DCHECK(CalledOnValidThread()); |
155 DCHECK(output_surface_); | 158 DCHECK(output_surface_); |
156 return output_surface_->ReleaseHwDraw(); | 159 return output_surface_->ReleaseHwDraw(); |
157 } | 160 } |
158 | 161 |
159 bool SynchronousCompositorImpl::DemandDrawHw( | 162 bool SynchronousCompositorImpl::DemandDrawHw( |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 g_factory.Get(); // Ensure it's initialized. | 280 g_factory.Get(); // Ensure it's initialized. |
278 SynchronousCompositorImpl::CreateForWebContents(contents); | 281 SynchronousCompositorImpl::CreateForWebContents(contents); |
279 } | 282 } |
280 if (SynchronousCompositorImpl* instance = | 283 if (SynchronousCompositorImpl* instance = |
281 SynchronousCompositorImpl::FromWebContents(contents)) { | 284 SynchronousCompositorImpl::FromWebContents(contents)) { |
282 instance->SetClient(client); | 285 instance->SetClient(client); |
283 } | 286 } |
284 } | 287 } |
285 | 288 |
286 } // namespace content | 289 } // namespace content |
OLD | NEW |