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

Side by Side Diff: cc/trees/thread_proxy.cc

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working on aura with --enable-begin-frame-scheduling Created 6 years, 4 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/trees/thread_proxy.h" 5 #include "cc/trees/thread_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 DCHECK(IsMainThread()); 86 DCHECK(IsMainThread());
87 DCHECK(this->layer_tree_host()); 87 DCHECK(this->layer_tree_host());
88 } 88 }
89 89
90 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy, 90 ThreadProxy::MainThreadOnly::MainThreadOnly(ThreadProxy* proxy,
91 int layer_tree_host_id) 91 int layer_tree_host_id)
92 : layer_tree_host_id(layer_tree_host_id), 92 : layer_tree_host_id(layer_tree_host_id),
93 animate_requested(false), 93 animate_requested(false),
94 commit_requested(false), 94 commit_requested(false),
95 commit_request_sent_to_impl_thread(false), 95 commit_request_sent_to_impl_thread(false),
96 begin_frame_requested(false),
96 started(false), 97 started(false),
97 manage_tiles_pending(false), 98 manage_tiles_pending(false),
98 can_cancel_commit(true), 99 can_cancel_commit(true),
99 defer_commits(false), 100 defer_commits(false),
100 weak_factory(proxy) {} 101 weak_factory(proxy) {}
101 102
102 ThreadProxy::MainThreadOnly::~MainThreadOnly() {} 103 ThreadProxy::MainThreadOnly::~MainThreadOnly() {}
103 104
104 ThreadProxy::MainThreadOrBlockedMainThread::MainThreadOrBlockedMainThread( 105 ThreadProxy::MainThreadOrBlockedMainThread::MainThreadOrBlockedMainThread(
105 LayerTreeHost* host) 106 LayerTreeHost* host)
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 } 1182 }
1182 1183
1183 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() { 1184 base::TimeDelta ThreadProxy::CommitToActivateDurationEstimate() {
1184 return impl().timing_history.CommitToActivateDurationEstimate(); 1185 return impl().timing_history.CommitToActivateDurationEstimate();
1185 } 1186 }
1186 1187
1187 void ThreadProxy::DidBeginImplFrameDeadline() { 1188 void ThreadProxy::DidBeginImplFrameDeadline() {
1188 impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame(); 1189 impl().layer_tree_host_impl->ResetCurrentFrameTimeForNextFrame();
1189 } 1190 }
1190 1191
1192 void ThreadProxy::SendBeginFrame(const BeginFrameArgs& args) {
1193 DCHECK(IsImplThread());
1194 Proxy::MainThreadTaskRunner()->PostTask(
brianderson 2014/08/21 00:14:00 It would be nice if we could send directly Rendere
simonhong 2014/08/21 00:36:49 Is ChromeOS also a target for SingleThreadProxy? I
simonhong 2014/08/26 08:24:48 This also removed.
1195 FROM_HERE,
1196 base::Bind(&ThreadProxy::SendBeginFrameOnMainThread,
1197 main_thread_weak_ptr_,
1198 args));
1199 }
1200
1201 void ThreadProxy::SendBeginFrameOnMainThread(const BeginFrameArgs& args) {
1202 DCHECK(IsMainThread());
1203 DCHECK(main().begin_frame_requested);
1204 main().begin_frame_requested = false;
1205 layer_tree_host()->SendBeginFrame(args);
1206 }
1207
1191 void ThreadProxy::ReadyToFinalizeTextureUpdates() { 1208 void ThreadProxy::ReadyToFinalizeTextureUpdates() {
1192 DCHECK(IsImplThread()); 1209 DCHECK(IsImplThread());
1193 impl().scheduler->NotifyReadyToCommit(); 1210 impl().scheduler->NotifyReadyToCommit();
1194 } 1211 }
1195 1212
1196 void ThreadProxy::DidCommitAndDrawFrame() { 1213 void ThreadProxy::DidCommitAndDrawFrame() {
1197 DCHECK(IsMainThread()); 1214 DCHECK(IsMainThread());
1198 layer_tree_host()->DidCommitAndDrawFrame(); 1215 layer_tree_host()->DidCommitAndDrawFrame();
1199 } 1216 }
1200 1217
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 Proxy::ImplThreadTaskRunner()->PostTask( 1346 Proxy::ImplThreadTaskRunner()->PostTask(
1330 FROM_HERE, 1347 FROM_HERE,
1331 base::Bind(&ThreadProxy::CommitPendingOnImplThreadForTesting, 1348 base::Bind(&ThreadProxy::CommitPendingOnImplThreadForTesting,
1332 impl_thread_weak_ptr_, 1349 impl_thread_weak_ptr_,
1333 &commit_pending_request)); 1350 &commit_pending_request));
1334 commit_pending_request.completion.Wait(); 1351 commit_pending_request.completion.Wait();
1335 } 1352 }
1336 return commit_pending_request.commit_pending; 1353 return commit_pending_request.commit_pending;
1337 } 1354 }
1338 1355
1356 void ThreadProxy::BeginFrameRequested() {
1357 DCHECK(IsMainThread());
1358 if (main().begin_frame_requested)
1359 return;
1360
1361 main().begin_frame_requested = true;
1362
1363 TRACE_EVENT0("cc", "ThreadProxy::BeginFrameRequested");
1364 Proxy::ImplThreadTaskRunner()->PostTask(
1365 FROM_HERE,
1366 base::Bind(&ThreadProxy::BeginFrameRequestedOnImplThread,
1367 impl_thread_weak_ptr_));
1368 }
1369
1370 void ThreadProxy::BeginFrameRequestedOnImplThread() const {
1371 DCHECK(IsImplThread());
1372 impl().scheduler->BeginFrameRequested();
1373 }
1374
1339 void ThreadProxy::CommitPendingOnImplThreadForTesting( 1375 void ThreadProxy::CommitPendingOnImplThreadForTesting(
1340 CommitPendingRequest* request) { 1376 CommitPendingRequest* request) {
1341 DCHECK(IsImplThread()); 1377 DCHECK(IsImplThread());
1342 if (impl().layer_tree_host_impl->output_surface()) 1378 if (impl().layer_tree_host_impl->output_surface())
1343 request->commit_pending = impl().scheduler->CommitPending(); 1379 request->commit_pending = impl().scheduler->CommitPending();
1344 else 1380 else
1345 request->commit_pending = false; 1381 request->commit_pending = false;
1346 request->completion.Signal(); 1382 request->completion.Signal();
1347 } 1383 }
1348 1384
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 1450
1415 impl().timing_history.DidActivateSyncTree(); 1451 impl().timing_history.DidActivateSyncTree();
1416 } 1452 }
1417 1453
1418 void ThreadProxy::DidManageTiles() { 1454 void ThreadProxy::DidManageTiles() {
1419 DCHECK(IsImplThread()); 1455 DCHECK(IsImplThread());
1420 impl().scheduler->DidManageTiles(); 1456 impl().scheduler->DidManageTiles();
1421 } 1457 }
1422 1458
1423 } // namespace cc 1459 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698