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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 310873002: Reschedule COMPOSITE_EVENTUALLY instead of COMPOSITE_IMMEDIATELY if we miss a browser frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add more comments Created 6 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 scoped_ptr<cc::CopyOutputRequest> request) { 675 scoped_ptr<cc::CopyOutputRequest> request) {
676 root_layer_->RequestCopyOfOutput(request.Pass()); 676 root_layer_->RequestCopyOfOutput(request.Pass());
677 } 677 }
678 678
679 void CompositorImpl::OnVSync(base::TimeTicks frame_time, 679 void CompositorImpl::OnVSync(base::TimeTicks frame_time,
680 base::TimeDelta vsync_period) { 680 base::TimeDelta vsync_period) {
681 vsync_period_ = vsync_period; 681 vsync_period_ = vsync_period;
682 last_vsync_ = frame_time; 682 last_vsync_ = frame_time;
683 683
684 if (WillCompositeThisFrame()) { 684 if (WillCompositeThisFrame()) {
685 // We somehow missed the last vsync interval, so reschedule immediately. 685 // We somehow missed the last vsync interval, so reschedule for deadline.
686 // We cannot schedule immediately, or will get us out-of-phase with new
687 // renderer frames.
686 CancelComposite(); 688 CancelComposite();
687 composite_on_vsync_trigger_ = COMPOSITE_IMMEDIATELY; 689 composite_on_vsync_trigger_ = COMPOSITE_EVENTUALLY;
688 } else { 690 } else {
689 current_composite_task_.reset(); 691 current_composite_task_.reset();
690 } 692 }
691 693
692 DCHECK(!DidCompositeThisFrame() && !WillCompositeThisFrame()); 694 DCHECK(!DidCompositeThisFrame() && !WillCompositeThisFrame());
693 if (composite_on_vsync_trigger_ != DO_NOT_COMPOSITE) { 695 if (composite_on_vsync_trigger_ != DO_NOT_COMPOSITE) {
694 CompositingTrigger trigger = composite_on_vsync_trigger_; 696 CompositingTrigger trigger = composite_on_vsync_trigger_;
695 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE; 697 composite_on_vsync_trigger_ = DO_NOT_COMPOSITE;
696 PostComposite(trigger); 698 PostComposite(trigger);
697 } 699 }
698 } 700 }
699 701
700 void CompositorImpl::SetNeedsAnimate() { 702 void CompositorImpl::SetNeedsAnimate() {
701 if (!host_) 703 if (!host_)
702 return; 704 return;
703 705
704 host_->SetNeedsAnimate(); 706 host_->SetNeedsAnimate();
705 } 707 }
706 708
707 } // namespace content 709 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698