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

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

Issue 267783004: Refactoring the way begin frame sources inside scheduler work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: I have a race condition in LayerTreeHostTestAbortedCommitDoesntStallDisabledVsync.RunMultiThread_De… Created 6 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 | Annotate | Revision Log
« cc/scheduler/scheduler.cc ('K') | « cc/trees/thread_proxy.h ('k') | 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 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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 348
349 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { 349 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() {
350 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); 350 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread");
351 DCHECK(IsImplThread()); 351 DCHECK(IsImplThread());
352 impl().scheduler->DidSwapBuffersComplete(); 352 impl().scheduler->DidSwapBuffersComplete();
353 Proxy::MainThreadTaskRunner()->PostTask( 353 Proxy::MainThreadTaskRunner()->PostTask(
354 FROM_HERE, 354 FROM_HERE,
355 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); 355 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_));
356 } 356 }
357 357
358 void ThreadProxy::SetNeedsBeginFrame(bool enable) { 358 BeginFrameSource* ThreadProxy::GetExternalBeginFrameSource() {
359 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); 359 return impl().layer_tree_host_impl.get();
360 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable);
361 UpdateBackgroundAnimateTicking();
362 }
363
364 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) {
365 impl().scheduler->BeginFrame(args);
366 } 360 }
367 361
368 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { 362 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
369 impl().layer_tree_host_impl->WillBeginImplFrame(args); 363 impl().layer_tree_host_impl->WillBeginImplFrame(args);
370 } 364 }
371 365
372 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { 366 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
373 TRACE_EVENT1( 367 TRACE_EVENT1(
374 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); 368 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
375 DCHECK(IsImplThread()); 369 DCHECK(IsImplThread());
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 completion->Signal(); 1255 completion->Signal();
1262 } 1256 }
1263 1257
1264 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1258 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1265 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1259 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
1266 DCHECK(IsImplThread()); 1260 DCHECK(IsImplThread());
1267 DCHECK(IsMainThreadBlocked()); 1261 DCHECK(IsMainThreadBlocked());
1268 layer_tree_host()->DeleteContentsTexturesOnImplThread( 1262 layer_tree_host()->DeleteContentsTexturesOnImplThread(
1269 impl().layer_tree_host_impl->resource_provider()); 1263 impl().layer_tree_host_impl->resource_provider());
1270 impl().current_resource_update_controller.reset(); 1264 impl().current_resource_update_controller.reset();
1271 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); 1265 impl().layer_tree_host_impl->SetNeedsBeginFrames(false);
1272 impl().scheduler.reset(); 1266 impl().scheduler.reset();
1273 impl().layer_tree_host_impl.reset(); 1267 impl().layer_tree_host_impl.reset();
1274 impl().weak_factory.InvalidateWeakPtrs(); 1268 impl().weak_factory.InvalidateWeakPtrs();
1275 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. 1269 // We need to explicitly cancel the notifier, since it isn't using weak ptrs.
1276 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep 1270 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep
1277 // the convention of having a weak ptr factory initialized last. Alternatively 1271 // the convention of having a weak ptr factory initialized last. Alternatively
1278 // we should moved the notifier (and RenewTreePriority) to LTHI. See 1272 // we should moved the notifier (and RenewTreePriority) to LTHI. See
1279 // crbug.com/411972 1273 // crbug.com/411972
1280 impl().smoothness_priority_expiration_notifier.Cancel(); 1274 impl().smoothness_priority_expiration_notifier.Cancel();
1281 impl().contents_texture_manager = NULL; 1275 impl().contents_texture_manager = NULL;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 1413
1420 impl().timing_history.DidActivateSyncTree(); 1414 impl().timing_history.DidActivateSyncTree();
1421 } 1415 }
1422 1416
1423 void ThreadProxy::DidManageTiles() { 1417 void ThreadProxy::DidManageTiles() {
1424 DCHECK(IsImplThread()); 1418 DCHECK(IsImplThread());
1425 impl().scheduler->DidManageTiles(); 1419 impl().scheduler->DidManageTiles();
1426 } 1420 }
1427 1421
1428 } // namespace cc 1422 } // namespace cc
OLDNEW
« cc/scheduler/scheduler.cc ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698