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

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: 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);
429 }
joth 2013/09/25 15:12:07 nit: why you add these here?
mkosiba (inactive) 2013/09/25 16:14:15 Done.
422 } 430 }
423 431
424 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() { 432 gfx::Vector2dF SynchronousCompositorImpl::GetTotalScrollOffset() {
425 DCHECK(CalledOnValidThread()); 433 DCHECK(CalledOnValidThread());
426 if (compositor_client_) 434 if (compositor_client_)
427 return compositor_client_->GetTotalRootLayerScrollOffset(); 435 return compositor_client_->GetTotalRootLayerScrollOffset();
428 return gfx::Vector2dF(); 436 return gfx::Vector2dF();
429 } 437 }
430 438
439 void SynchronousCompositorImpl::SetPageScaleFactor(float page_scale_factor) {
440 DCHECK(CalledOnValidThread());
441 if (compositor_client_)
442 compositor_client_->SetRootLayerPageScaleFactor(page_scale_factor);
443 }
444
445 void SynchronousCompositorImpl::SetScrollableSize(gfx::SizeF scrollable_size) {
446 DCHECK(CalledOnValidThread());
447 if (compositor_client_)
448 compositor_client_->SetRootLayerScrollableSize(scrollable_size);
449 }
450
431 // Not using base::NonThreadSafe as we want to enforce a more exacting threading 451 // Not using base::NonThreadSafe as we want to enforce a more exacting threading
432 // requirement: SynchronousCompositorImpl() must only be used on the UI thread. 452 // requirement: SynchronousCompositorImpl() must only be used on the UI thread.
433 bool SynchronousCompositorImpl::CalledOnValidThread() const { 453 bool SynchronousCompositorImpl::CalledOnValidThread() const {
434 return BrowserThread::CurrentlyOn(BrowserThread::UI); 454 return BrowserThread::CurrentlyOn(BrowserThread::UI);
435 } 455 }
436 456
437 // static 457 // static
438 void SynchronousCompositor::SetClientForWebContents( 458 void SynchronousCompositor::SetClientForWebContents(
439 WebContents* contents, 459 WebContents* contents,
440 SynchronousCompositorClient* client) { 460 SynchronousCompositorClient* client) {
441 DCHECK(contents); 461 DCHECK(contents);
442 if (client) { 462 if (client) {
443 g_factory.Get(); // Ensure it's initialized. 463 g_factory.Get(); // Ensure it's initialized.
444 SynchronousCompositorImpl::CreateForWebContents(contents); 464 SynchronousCompositorImpl::CreateForWebContents(contents);
445 } 465 }
446 if (SynchronousCompositorImpl* instance = 466 if (SynchronousCompositorImpl* instance =
447 SynchronousCompositorImpl::FromWebContents(contents)) { 467 SynchronousCompositorImpl::FromWebContents(contents)) {
448 instance->SetClient(client); 468 instance->SetClient(client);
449 } 469 }
450 } 470 }
451 471
452 } // namespace content 472 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698