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_); | |
boliu
2015/06/08 16:54:52
Should check for registered_with_client_ after reb
hush (inactive)
2015/06/09 19:11:34
Done.
| |
358 compositor_client_->SetNeedsAnimateScroll(animation); | |
352 } | 359 } |
353 | 360 |
354 void SynchronousCompositorImpl::UpdateRootLayerState( | 361 void SynchronousCompositorImpl::UpdateRootLayerState( |
355 const gfx::ScrollOffset& total_scroll_offset, | 362 const gfx::ScrollOffset& total_scroll_offset, |
356 const gfx::ScrollOffset& max_scroll_offset, | 363 const gfx::ScrollOffset& max_scroll_offset, |
357 const gfx::SizeF& scrollable_size, | 364 const gfx::SizeF& scrollable_size, |
358 float page_scale_factor, | 365 float page_scale_factor, |
359 float min_page_scale_factor, | 366 float min_page_scale_factor, |
360 float max_page_scale_factor) { | 367 float max_page_scale_factor) { |
361 DCHECK(CalledOnValidThread()); | 368 DCHECK(CalledOnValidThread()); |
(...skipping 26 matching lines...) Expand all Loading... | |
388 g_factory.Get(); // Ensure it's initialized. | 395 g_factory.Get(); // Ensure it's initialized. |
389 SynchronousCompositorImpl::CreateForWebContents(contents); | 396 SynchronousCompositorImpl::CreateForWebContents(contents); |
390 } | 397 } |
391 SynchronousCompositorImpl* instance = | 398 SynchronousCompositorImpl* instance = |
392 SynchronousCompositorImpl::FromWebContents(contents); | 399 SynchronousCompositorImpl::FromWebContents(contents); |
393 DCHECK(instance); | 400 DCHECK(instance); |
394 instance->SetClient(client); | 401 instance->SetClient(client); |
395 } | 402 } |
396 | 403 |
397 } // namespace content | 404 } // namespace content |
OLD | NEW |