| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 page_scale_factor, min_page_scale_factor, max_page_scale_factor); | 258 page_scale_factor, min_page_scale_factor, max_page_scale_factor); |
| 259 } | 259 } |
| 260 | 260 |
| 261 void SynchronousCompositorImpl::SetScrollableSize( | 261 void SynchronousCompositorImpl::SetScrollableSize( |
| 262 const gfx::SizeF& scrollable_size) { | 262 const gfx::SizeF& scrollable_size) { |
| 263 DCHECK(CalledOnValidThread()); | 263 DCHECK(CalledOnValidThread()); |
| 264 if (compositor_client_) | 264 if (compositor_client_) |
| 265 compositor_client_->SetRootLayerScrollableSize(scrollable_size); | 265 compositor_client_->SetRootLayerScrollableSize(scrollable_size); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void SynchronousCompositorImpl::SetNeedsAnimate( |
| 269 const AnimationCallback& animation) { |
| 270 DCHECK(CalledOnValidThread()); |
| 271 if (compositor_client_) |
| 272 compositor_client_->SetNeedsAnimate(animation); |
| 273 } |
| 274 |
| 268 // Not using base::NonThreadSafe as we want to enforce a more exacting threading | 275 // Not using base::NonThreadSafe as we want to enforce a more exacting threading |
| 269 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. | 276 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. |
| 270 bool SynchronousCompositorImpl::CalledOnValidThread() const { | 277 bool SynchronousCompositorImpl::CalledOnValidThread() const { |
| 271 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 278 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 272 } | 279 } |
| 273 | 280 |
| 274 // static | 281 // static |
| 275 void SynchronousCompositor::SetClientForWebContents( | 282 void SynchronousCompositor::SetClientForWebContents( |
| 276 WebContents* contents, | 283 WebContents* contents, |
| 277 SynchronousCompositorClient* client) { | 284 SynchronousCompositorClient* client) { |
| 278 DCHECK(contents); | 285 DCHECK(contents); |
| 279 if (client) { | 286 if (client) { |
| 280 g_factory.Get(); // Ensure it's initialized. | 287 g_factory.Get(); // Ensure it's initialized. |
| 281 SynchronousCompositorImpl::CreateForWebContents(contents); | 288 SynchronousCompositorImpl::CreateForWebContents(contents); |
| 282 } | 289 } |
| 283 if (SynchronousCompositorImpl* instance = | 290 if (SynchronousCompositorImpl* instance = |
| 284 SynchronousCompositorImpl::FromWebContents(contents)) { | 291 SynchronousCompositorImpl::FromWebContents(contents)) { |
| 285 instance->SetClient(client); | 292 instance->SetClient(client); |
| 286 } | 293 } |
| 287 } | 294 } |
| 288 | 295 |
| 289 } // namespace content | 296 } // namespace content |
| OLD | NEW |