Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(902)

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_impl.cc

Issue 23533051: [android_webview] Use a fraction to calculate scroll offset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert changes from previous patch set as they break AwSettings tests Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 contents_->GetRenderWidgetHostView()); 408 contents_->GetRenderWidgetHostView());
409 if (rwhv) 409 if (rwhv)
410 rwhv->SynchronousFrameMetadata(frame_metadata); 410 rwhv->SynchronousFrameMetadata(frame_metadata);
411 } 411 }
412 412
413 void SynchronousCompositorImpl::DidActivatePendingTree() { 413 void SynchronousCompositorImpl::DidActivatePendingTree() {
414 if (compositor_client_) 414 if (compositor_client_)
415 compositor_client_->DidUpdateContent(); 415 compositor_client_->DidUpdateContent();
416 } 416 }
417 417
418 void SynchronousCompositorImpl::SetMaxScrollOffset(
419 gfx::Vector2dF max_scroll_offset) {
420 DCHECK(CalledOnValidThread());
421 if (compositor_client_)
422 compositor_client_->SetMaxRootLayerScrollOffset(max_scroll_offset);
423 }
424
418 void SynchronousCompositorImpl::SetTotalScrollOffset(gfx::Vector2dF new_value) { 425 void SynchronousCompositorImpl::SetTotalScrollOffset(gfx::Vector2dF new_value) {
419 DCHECK(CalledOnValidThread()); 426 DCHECK(CalledOnValidThread());
420 if (compositor_client_) 427 if (compositor_client_)
421 compositor_client_->SetTotalRootLayerScrollOffset(new_value); 428 compositor_client_->SetTotalRootLayerScrollOffset(new_value);
422 } 429 }
423 430
424 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() { 431 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() {
425 DCHECK(CalledOnValidThread()); 432 DCHECK(CalledOnValidThread());
426 if (compositor_client_) 433 if (compositor_client_)
427 return compositor_client_->GetTotalRootLayerScrollOffset(); 434 return compositor_client_->GetTotalRootLayerScrollOffset();
428 return gfx::Vector2dF(); 435 return gfx::Vector2dF();
429 } 436 }
430 437
438 void SynchronousCompositorImpl::SetPageScaleFactor(float page_scale_factor) {
439 DCHECK(CalledOnValidThread());
440 if (compositor_client_)
441 compositor_client_->SetRootLayerPageScaleFactor(page_scale_factor);
442 }
443
444 void SynchronousCompositorImpl::SetScrollableSize(gfx::SizeF scrollable_size) {
445 DCHECK(CalledOnValidThread());
446 if (compositor_client_)
447 compositor_client_->SetRootLayerScrollableSize(scrollable_size);
448 }
449
431 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 450 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
432 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. 451 // requirement: SynchronousCompositorImpl() must only be used on the UI thread.
433 bool SynchronousCompositorImpl::CalledOnValidThread() const { 452 bool SynchronousCompositorImpl::CalledOnValidThread() const {
434 return BrowserThread::CurrentlyOn(BrowserThread::UI); 453 return BrowserThread::CurrentlyOn(BrowserThread::UI);
435 } 454 }
436 455
437 // static 456 // static
438 void SynchronousCompositor::SetClientForWebContents( 457 void SynchronousCompositor::SetClientForWebContents(
439 WebContents* contents, 458 WebContents* contents,
440 SynchronousCompositorClient* client) { 459 SynchronousCompositorClient* client) {
441 DCHECK(contents); 460 DCHECK(contents);
442 if (client) { 461 if (client) {
443 g_factory.Get(); // Ensure it's initialized. 462 g_factory.Get(); // Ensure it's initialized.
444 SynchronousCompositorImpl::CreateForWebContents(contents); 463 SynchronousCompositorImpl::CreateForWebContents(contents);
445 } 464 }
446 if (SynchronousCompositorImpl* instance = 465 if (SynchronousCompositorImpl* instance =
447 SynchronousCompositorImpl::FromWebContents(contents)) { 466 SynchronousCompositorImpl::FromWebContents(contents)) {
448 instance->SetClient(client); 467 instance->SetClient(client);
449 } 468 }
450 } 469 }
451 470
452 } // namespace content 471 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698