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

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: Rebasing onto master. 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 | Annotate | Revision Log
« cc/trees/single_thread_proxy.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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 334
335 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() { 335 void ThreadProxy::DidSwapBuffersCompleteOnImplThread() {
336 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread"); 336 TRACE_EVENT0("cc", "ThreadProxy::DidSwapBuffersCompleteOnImplThread");
337 DCHECK(IsImplThread()); 337 DCHECK(IsImplThread());
338 impl().scheduler->DidSwapBuffersComplete(); 338 impl().scheduler->DidSwapBuffersComplete();
339 Proxy::MainThreadTaskRunner()->PostTask( 339 Proxy::MainThreadTaskRunner()->PostTask(
340 FROM_HERE, 340 FROM_HERE,
341 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_)); 341 base::Bind(&ThreadProxy::DidCompleteSwapBuffers, main_thread_weak_ptr_));
342 } 342 }
343 343
344 void ThreadProxy::SetNeedsBeginFrame(bool enable) {
345 TRACE_EVENT1("cc", "ThreadProxy::SetNeedsBeginFrame", "enable", enable);
346 impl().layer_tree_host_impl->SetNeedsBeginFrame(enable);
347 UpdateBackgroundAnimateTicking();
348 }
349
350 void ThreadProxy::BeginFrame(const BeginFrameArgs& args) {
351 impl().scheduler->BeginFrame(args);
352 }
353
354 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { 344 void ThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
355 impl().layer_tree_host_impl->WillBeginImplFrame(args); 345 impl().layer_tree_host_impl->WillBeginImplFrame(args);
356 } 346 }
357 347
358 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) { 348 void ThreadProxy::OnCanDrawStateChanged(bool can_draw) {
359 TRACE_EVENT1( 349 TRACE_EVENT1(
360 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); 350 "cc", "ThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
361 DCHECK(IsImplThread()); 351 DCHECK(IsImplThread());
362 impl().scheduler->SetCanDraw(can_draw); 352 impl().scheduler->SetCanDraw(can_draw);
363 UpdateBackgroundAnimateTicking(); 353 UpdateBackgroundAnimateTicking();
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 settings.timeout_and_draw_when_animation_checkerboards; 1239 settings.timeout_and_draw_when_animation_checkerboards;
1250 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ = 1240 scheduler_settings.maximum_number_of_failed_draws_before_draw_is_forced_ =
1251 settings.maximum_number_of_failed_draws_before_draw_is_forced_; 1241 settings.maximum_number_of_failed_draws_before_draw_is_forced_;
1252 scheduler_settings.using_synchronous_renderer_compositor = 1242 scheduler_settings.using_synchronous_renderer_compositor =
1253 settings.using_synchronous_renderer_compositor; 1243 settings.using_synchronous_renderer_compositor;
1254 scheduler_settings.throttle_frame_production = 1244 scheduler_settings.throttle_frame_production =
1255 settings.throttle_frame_production; 1245 settings.throttle_frame_production;
1256 impl().scheduler = Scheduler::Create(this, 1246 impl().scheduler = Scheduler::Create(this,
1257 scheduler_settings, 1247 scheduler_settings,
1258 impl().layer_tree_host_id, 1248 impl().layer_tree_host_id,
1249 impl().layer_tree_host_impl.get(),
1259 ImplThreadTaskRunner()); 1250 ImplThreadTaskRunner());
1260 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible()); 1251 impl().scheduler->SetVisible(impl().layer_tree_host_impl->visible());
1261 1252
1262 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr(); 1253 impl_thread_weak_ptr_ = impl().weak_factory.GetWeakPtr();
1263 completion->Signal(); 1254 completion->Signal();
1264 } 1255 }
1265 1256
1266 void ThreadProxy::InitializeOutputSurfaceOnImplThread( 1257 void ThreadProxy::InitializeOutputSurfaceOnImplThread(
1267 CompletionEvent* completion, 1258 CompletionEvent* completion,
1268 scoped_ptr<OutputSurface> output_surface, 1259 scoped_ptr<OutputSurface> output_surface,
(...skipping 28 matching lines...) Expand all
1297 impl().layer_tree_host_impl->resource_provider()->Finish(); 1288 impl().layer_tree_host_impl->resource_provider()->Finish();
1298 completion->Signal(); 1289 completion->Signal();
1299 } 1290 }
1300 1291
1301 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) { 1292 void ThreadProxy::LayerTreeHostClosedOnImplThread(CompletionEvent* completion) {
1302 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread"); 1293 TRACE_EVENT0("cc", "ThreadProxy::LayerTreeHostClosedOnImplThread");
1303 DCHECK(IsImplThread()); 1294 DCHECK(IsImplThread());
1304 layer_tree_host()->DeleteContentsTexturesOnImplThread( 1295 layer_tree_host()->DeleteContentsTexturesOnImplThread(
1305 impl().layer_tree_host_impl->resource_provider()); 1296 impl().layer_tree_host_impl->resource_provider());
1306 impl().current_resource_update_controller.reset(); 1297 impl().current_resource_update_controller.reset();
1307 impl().layer_tree_host_impl->SetNeedsBeginFrame(false);
1308 impl().scheduler.reset(); 1298 impl().scheduler.reset();
1309 impl().layer_tree_host_impl.reset(); 1299 impl().layer_tree_host_impl.reset();
1310 impl().weak_factory.InvalidateWeakPtrs(); 1300 impl().weak_factory.InvalidateWeakPtrs();
1311 impl().contents_texture_manager = NULL; 1301 impl().contents_texture_manager = NULL;
1312 completion->Signal(); 1302 completion->Signal();
1313 } 1303 }
1314 1304
1315 size_t ThreadProxy::MaxPartialTextureUpdates() const { 1305 size_t ThreadProxy::MaxPartialTextureUpdates() const {
1316 return ResourceUpdateController::MaxPartialTextureUpdates(); 1306 return ResourceUpdateController::MaxPartialTextureUpdates();
1317 } 1307 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 1456
1467 impl().timing_history.DidActivatePendingTree(); 1457 impl().timing_history.DidActivatePendingTree();
1468 } 1458 }
1469 1459
1470 void ThreadProxy::DidManageTiles() { 1460 void ThreadProxy::DidManageTiles() {
1471 DCHECK(IsImplThread()); 1461 DCHECK(IsImplThread());
1472 impl().scheduler->DidManageTiles(); 1462 impl().scheduler->DidManageTiles();
1473 } 1463 }
1474 1464
1475 } // namespace cc 1465 } // namespace cc
OLDNEW
« cc/trees/single_thread_proxy.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