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

Side by Side Diff: ui/compositor/compositor.cc

Issue 996453002: Allow ui::Compositor to disable commits during tab-switch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use DeferCommits instead Created 5 years, 9 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
« cc/trees/proxy.h ('K') | « ui/compositor/compositor.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 (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 "ui/compositor/compositor.h" 5 #include "ui/compositor/compositor.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 scoped_refptr<base::SingleThreadTaskRunner> task_runner) 69 scoped_refptr<base::SingleThreadTaskRunner> task_runner)
70 : context_factory_(context_factory), 70 : context_factory_(context_factory),
71 root_layer_(NULL), 71 root_layer_(NULL),
72 widget_(widget), 72 widget_(widget),
73 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()), 73 surface_id_allocator_(context_factory->CreateSurfaceIdAllocator()),
74 task_runner_(task_runner), 74 task_runner_(task_runner),
75 vsync_manager_(new CompositorVSyncManager()), 75 vsync_manager_(new CompositorVSyncManager()),
76 device_scale_factor_(0.0f), 76 device_scale_factor_(0.0f),
77 last_started_frame_(0), 77 last_started_frame_(0),
78 last_ended_frame_(0), 78 last_ended_frame_(0),
79 disable_schedule_composite_(false),
80 compositor_lock_(NULL), 79 compositor_lock_(NULL),
81 layer_animator_collection_(this), 80 layer_animator_collection_(this),
82 weak_ptr_factory_(this) { 81 weak_ptr_factory_(this) {
83 root_web_layer_ = cc::Layer::Create(); 82 root_web_layer_ = cc::Layer::Create();
84 83
85 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 84 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
86 85
87 cc::LayerTreeSettings settings; 86 cc::LayerTreeSettings settings;
88 // When impl-side painting is enabled, this will ensure PictureLayers always 87 // When impl-side painting is enabled, this will ensure PictureLayers always
89 // can have LCD text, to match the previous behaviour with ContentLayers, 88 // can have LCD text, to match the previous behaviour with ContentLayers,
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 animation_observer_list_, 286 animation_observer_list_,
288 OnAnimationStep(args.frame_time)); 287 OnAnimationStep(args.frame_time));
289 if (animation_observer_list_.might_have_observers()) 288 if (animation_observer_list_.might_have_observers())
290 host_->SetNeedsAnimate(); 289 host_->SetNeedsAnimate();
291 } 290 }
292 291
293 void Compositor::BeginMainFrameNotExpectedSoon() { 292 void Compositor::BeginMainFrameNotExpectedSoon() {
294 } 293 }
295 294
296 void Compositor::Layout() { 295 void Compositor::Layout() {
297 // We're sending damage that will be addressed during this composite
298 // cycle, so we don't need to schedule another composite to address it.
299 disable_schedule_composite_ = true;
300 if (root_layer_) 296 if (root_layer_)
301 root_layer_->SendDamagedRects(); 297 root_layer_->SendDamagedRects();
302 disable_schedule_composite_ = false;
303 } 298 }
304 299
305 void Compositor::RequestNewOutputSurface() { 300 void Compositor::RequestNewOutputSurface() {
306 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr()); 301 context_factory_->CreateOutputSurface(weak_ptr_factory_.GetWeakPtr());
307 } 302 }
308 303
309 void Compositor::DidInitializeOutputSurface() { 304 void Compositor::DidInitializeOutputSurface() {
310 } 305 }
311 306
312 void Compositor::DidFailToInitializeOutputSurface() { 307 void Compositor::DidFailToInitializeOutputSurface() {
(...skipping 10 matching lines...) Expand all
323 } 318 }
324 319
325 void Compositor::DidCommitAndDrawFrame() { 320 void Compositor::DidCommitAndDrawFrame() {
326 } 321 }
327 322
328 void Compositor::DidCompleteSwapBuffers() { 323 void Compositor::DidCompleteSwapBuffers() {
329 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 324 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
330 OnCompositingEnded(this)); 325 OnCompositingEnded(this));
331 } 326 }
332 327
328 void Compositor::SetDeferCommits(bool defer_commits) {
329 host_->SetDeferCommits(defer_commits);
danakj 2015/03/11 17:22:55 You'll now have a state where commits are deferred
ccameron 2015/03/11 21:46:43 The timeout for the lock is only so that the UI do
330 }
331
333 void Compositor::DidPostSwapBuffers() { 332 void Compositor::DidPostSwapBuffers() {
334 base::TimeTicks start_time = gfx::FrameTime::Now(); 333 base::TimeTicks start_time = gfx::FrameTime::Now();
335 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 334 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
336 OnCompositingStarted(this, start_time)); 335 OnCompositingStarted(this, start_time));
337 } 336 }
338 337
339 void Compositor::DidAbortSwapBuffers() { 338 void Compositor::DidAbortSwapBuffers() {
340 FOR_EACH_OBSERVER(CompositorObserver, 339 FOR_EACH_OBSERVER(CompositorObserver,
341 observer_list_, 340 observer_list_,
342 OnCompositingAborted(this)); 341 OnCompositingAborted(this));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 observer_list_, 373 observer_list_,
375 OnCompositingLockStateChanged(this)); 374 OnCompositingLockStateChanged(this));
376 } 375 }
377 376
378 void Compositor::CancelCompositorLock() { 377 void Compositor::CancelCompositorLock() {
379 if (compositor_lock_) 378 if (compositor_lock_)
380 compositor_lock_->CancelLock(); 379 compositor_lock_->CancelLock();
381 } 380 }
382 381
383 } // namespace ui 382 } // namespace ui
OLDNEW
« cc/trees/proxy.h ('K') | « ui/compositor/compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698