| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 DCHECK(CalledOnValidThread()); | 336 DCHECK(CalledOnValidThread()); |
| 337 DCHECK(compositor_client_); | 337 DCHECK(compositor_client_); |
| 338 if (!registered_with_client_) | 338 if (!registered_with_client_) |
| 339 return gfx::ScrollOffset(); | 339 return gfx::ScrollOffset(); |
| 340 // TODO(miletus): Make GetTotalRootLayerScrollOffset return | 340 // TODO(miletus): Make GetTotalRootLayerScrollOffset return |
| 341 // ScrollOffset. crbug.com/414283. | 341 // ScrollOffset. crbug.com/414283. |
| 342 return gfx::ScrollOffset( | 342 return gfx::ScrollOffset( |
| 343 compositor_client_->GetTotalRootLayerScrollOffset()); | 343 compositor_client_->GetTotalRootLayerScrollOffset()); |
| 344 } | 344 } |
| 345 | 345 |
| 346 bool SynchronousCompositorImpl::IsExternalFlingActive() const { | 346 bool SynchronousCompositorImpl::IsExternalScrollActive() const { |
| 347 DCHECK(CalledOnValidThread()); | 347 DCHECK(CalledOnValidThread()); |
| 348 DCHECK(compositor_client_); | 348 DCHECK(compositor_client_); |
| 349 if (!registered_with_client_) | 349 if (!registered_with_client_) |
| 350 return false; | 350 return false; |
| 351 return compositor_client_->IsExternalFlingActive(); | 351 return compositor_client_->IsExternalScrollActive(); |
| 352 } |
| 353 |
| 354 void SynchronousCompositorImpl::SetNeedsAnimate( |
| 355 const AnimationCallback& animation) { |
| 356 DCHECK(CalledOnValidThread()); |
| 357 DCHECK(compositor_client_); |
| 358 if (!registered_with_client_) |
| 359 return; |
| 360 compositor_client_->SetNeedsAnimateScroll(animation); |
| 352 } | 361 } |
| 353 | 362 |
| 354 void SynchronousCompositorImpl::UpdateRootLayerState( | 363 void SynchronousCompositorImpl::UpdateRootLayerState( |
| 355 const gfx::ScrollOffset& total_scroll_offset, | 364 const gfx::ScrollOffset& total_scroll_offset, |
| 356 const gfx::ScrollOffset& max_scroll_offset, | 365 const gfx::ScrollOffset& max_scroll_offset, |
| 357 const gfx::SizeF& scrollable_size, | 366 const gfx::SizeF& scrollable_size, |
| 358 float page_scale_factor, | 367 float page_scale_factor, |
| 359 float min_page_scale_factor, | 368 float min_page_scale_factor, |
| 360 float max_page_scale_factor) { | 369 float max_page_scale_factor) { |
| 361 DCHECK(CalledOnValidThread()); | 370 DCHECK(CalledOnValidThread()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 388 g_factory.Get(); // Ensure it's initialized. | 397 g_factory.Get(); // Ensure it's initialized. |
| 389 SynchronousCompositorImpl::CreateForWebContents(contents); | 398 SynchronousCompositorImpl::CreateForWebContents(contents); |
| 390 } | 399 } |
| 391 SynchronousCompositorImpl* instance = | 400 SynchronousCompositorImpl* instance = |
| 392 SynchronousCompositorImpl::FromWebContents(contents); | 401 SynchronousCompositorImpl::FromWebContents(contents); |
| 393 DCHECK(instance); | 402 DCHECK(instance); |
| 394 instance->SetClient(client); | 403 instance->SetClient(client); |
| 395 } | 404 } |
| 396 | 405 |
| 397 } // namespace content | 406 } // namespace content |
| OLD | NEW |