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

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: Major rewrite based on Brian's comments. 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/trees/layer_tree_host_impl.h ('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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 344
345 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { 345 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() {
346 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); 346 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread");
347 DCHECK(IsImplThread()); 347 DCHECK(IsImplThread());
348 impl().scheduler->DidSwapBuffersComplete(); 348 impl().scheduler->DidSwapBuffersComplete();
349 Proxy::MainThreadTaskRunner()->PostTask( 349 Proxy::MainThreadTaskRunner()->PostTask(
350 FROM_HERE, 350 FROM_HERE,
351 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); 351 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_));
352 } 352 }
353 353
354 void ThreadProxy::SetNeedsBeginFrame(bool enable) { 354 BeginFrameSource* ThreadProxy::GetBeginFrameSource() {
355 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable); 355 return impl().layer_tree_host_impl.get();
356 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable);
357 UpdateBackgroundAnimateTicking();
358 }
359
360 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) {
361 impl().scheduler->BeginFrame(args);
362 } 356 }
363 357
364 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { 358 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
365 impl().layer_tree_host_impl->WillBeginImplFrame(args); 359 impl().layer_tree_host_impl->WillBeginImplFrame(args);
366 } 360 }
367 361
368 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { 362 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
369 TRACE_EVENT1( 363 TRACE_EVENT1(
370 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); 364 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
371 DCHECK(IsImplThread()); 365 DCHECK(IsImplThread());
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 completion->Signal(); 1246 completion->Signal();
1253 } 1247 }
1254 1248
1255 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1249 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1256 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1250 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
1257 DCHECK(IsImplThread()); 1251 DCHECK(IsImplThread());
1258 DCHECK(IsMainThreadBlocked()); 1252 DCHECK(IsMainThreadBlocked());
1259 layer_tree_host()->DeleteContentsTexturesOnImplThread( 1253 layer_tree_host()->DeleteContentsTexturesOnImplThread(
1260 impl().layer_tree_host_impl->resource_provider()); 1254 impl().layer_tree_host_impl->resource_provider());
1261 impl().current_resource_update_controller.reset(); 1255 impl().current_resource_update_controller.reset();
1262 impl().layer_tree_host_impl->SetNeedsBeginFrame(false); 1256 impl().layer_tree_host_impl->SetNeedsBeginFrames(false);
1263 impl().scheduler.reset(); 1257 impl().scheduler.reset();
1264 impl().layer_tree_host_impl.reset(); 1258 impl().layer_tree_host_impl.reset();
1265 impl().weak_factory.InvalidateWeakPtrs(); 1259 impl().weak_factory.InvalidateWeakPtrs();
1266 // We need to explicitly cancel the notifier, since it isn't using weak ptrs. 1260 // We need to explicitly cancel the notifier, since it isn't using weak ptrs.
1267 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep 1261 // TODO(vmpstr): We should see if we can make it use weak ptrs and still keep
1268 // the convention of having a weak ptr factory initialized last. Alternatively 1262 // the convention of having a weak ptr factory initialized last. Alternatively
1269 // we should moved the notifier (and RenewTreePriority) to LTHI. See 1263 // we should moved the notifier (and RenewTreePriority) to LTHI. See
1270 // crbug.com/411972 1264 // crbug.com/411972
1271 impl().smoothness_priority_expiration_notifier.Cancel(); 1265 impl().smoothness_priority_expiration_notifier.Cancel();
1272 impl().contents_texture_manager = NULL; 1266 impl().contents_texture_manager = NULL;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 1404
1411 impl().timing_history.DidActivateSyncTree(); 1405 impl().timing_history.DidActivateSyncTree();
1412 } 1406 }
1413 1407
1414 void ThreadProxy::DidManageTiles() { 1408 void ThreadProxy::DidManageTiles() {
1415 DCHECK(IsImplThread()); 1409 DCHECK(IsImplThread());
1416 impl().scheduler->DidManageTiles(); 1410 impl().scheduler->DidManageTiles();
1417 } 1411 }
1418 1412
1419 } // namespace cc 1413 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_impl.h ('K') | « cc/trees/thread_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698