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

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

Issue 2275253003: Fix jank on Android due to bad scheduler deadline (Closed)
Patch Set: Created 4 years, 3 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 #include <stdint.h> 9 #include <stdint.h>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 DCHECK(obs); 193 DCHECK(obs);
194 DCHECK(observers_.find(obs) != observers_.end()); 194 DCHECK(observers_.find(obs) != observers_.end());
195 195
196 observers_.erase(obs); 196 observers_.erase(obs);
197 if (observers_.empty()) 197 if (observers_.empty())
198 compositor_->OnNeedsBeginFramesChange(false); 198 compositor_->OnNeedsBeginFramesChange(false);
199 } 199 }
200 200
201 void ExternalBeginFrameSource::OnVSync(base::TimeTicks frame_time, 201 void ExternalBeginFrameSource::OnVSync(base::TimeTicks frame_time,
202 base::TimeDelta vsync_period) { 202 base::TimeDelta vsync_period) {
203 base::TimeTicks deadline = std::max(base::TimeTicks::Now(), frame_time); 203 // frame time is in the past, so give the next vsync period as the deadline.
204 base::TimeTicks deadline = frame_time + vsync_period;
204 last_begin_frame_args_ = 205 last_begin_frame_args_ =
205 cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, frame_time, deadline, 206 cc::BeginFrameArgs::Create(BEGINFRAME_FROM_HERE, frame_time, deadline,
206 vsync_period, cc::BeginFrameArgs::NORMAL); 207 vsync_period, cc::BeginFrameArgs::NORMAL);
207 std::unordered_set<cc::BeginFrameObserver*> observers(observers_); 208 std::unordered_set<cc::BeginFrameObserver*> observers(observers_);
208 for (auto* obs : observers) 209 for (auto* obs : observers)
209 obs->OnBeginFrame(last_begin_frame_args_); 210 obs->OnBeginFrame(last_begin_frame_args_);
210 } 211 }
211 212
212 // Used to override capabilities_.adjust_deadline_for_parent to false 213 // Used to override capabilities_.adjust_deadline_for_parent to false
213 class OutputSurfaceWithoutParent : public cc::OutputSurface { 214 class OutputSurfaceWithoutParent : public cc::OutputSurface {
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 796
796 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); 797 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate");
797 host_->SetNeedsAnimate(); 798 host_->SetNeedsAnimate();
798 } 799 }
799 800
800 bool CompositorImpl::HavePendingReadbacks() { 801 bool CompositorImpl::HavePendingReadbacks() {
801 return !readback_layer_tree_->children().empty(); 802 return !readback_layer_tree_->children().empty();
802 } 803 }
803 804
804 } // namespace content 805 } // 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