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

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

Issue 1513053002: WIP - Gutterless resize on Windows Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 output_surface_requested_(false), 72 output_surface_requested_(false),
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 locks_will_time_out_(true), 79 locks_will_time_out_(true),
80 compositor_lock_(NULL), 80 compositor_lock_(NULL),
81 layer_animator_collection_(this), 81 layer_animator_collection_(this),
82 has_swapped_frame_at_current_size_(false),
82 weak_ptr_factory_(this) { 83 weak_ptr_factory_(this) {
83 root_web_layer_ = cc::Layer::Create(Layer::UILayerSettings()); 84 root_web_layer_ = cc::Layer::Create(Layer::UILayerSettings());
84 85
85 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 86 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
86 87
87 cc::LayerTreeSettings settings; 88 cc::LayerTreeSettings settings;
88 89
89 // This will ensure PictureLayers always can have LCD text, to match the 90 // This will ensure PictureLayers always can have LCD text, to match the
90 // previous behaviour with ContentLayers, where LCD-not-allowed notifications 91 // previous behaviour with ContentLayers, where LCD-not-allowed notifications
91 // were ignored. 92 // were ignored.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 271
271 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { 272 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
272 scoped_ptr<cc::SwapPromise> swap_promise( 273 scoped_ptr<cc::SwapPromise> swap_promise(
273 new cc::LatencyInfoSwapPromise(latency_info)); 274 new cc::LatencyInfoSwapPromise(latency_info));
274 host_->QueueSwapPromise(swap_promise.Pass()); 275 host_->QueueSwapPromise(swap_promise.Pass());
275 } 276 }
276 277
277 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { 278 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
278 DCHECK_GT(scale, 0); 279 DCHECK_GT(scale, 0);
279 if (!size_in_pixel.IsEmpty()) { 280 if (!size_in_pixel.IsEmpty()) {
281 if (size_ != size_in_pixel) {
282 has_swapped_frame_at_current_size_ = false;
283 }
284
280 size_ = size_in_pixel; 285 size_ = size_in_pixel;
281 host_->SetViewportSize(size_in_pixel); 286 host_->SetViewportSize(size_in_pixel);
282 root_web_layer_->SetBounds(size_in_pixel); 287 root_web_layer_->SetBounds(size_in_pixel);
283 context_factory_->ResizeDisplay(this, size_in_pixel); 288 context_factory_->ResizeDisplay(this, size_in_pixel);
284 } 289 }
285 if (device_scale_factor_ != scale) { 290 if (device_scale_factor_ != scale) {
286 device_scale_factor_ = scale; 291 device_scale_factor_ = scale;
287 host_->SetDeviceScaleFactor(scale); 292 host_->SetDeviceScaleFactor(scale);
288 if (root_layer_) 293 if (root_layer_)
289 root_layer_->OnDeviceScaleFactorChanged(scale); 294 root_layer_->OnDeviceScaleFactorChanged(scale);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 DCHECK(!IsLocked()); 436 DCHECK(!IsLocked());
432 FOR_EACH_OBSERVER(CompositorObserver, 437 FOR_EACH_OBSERVER(CompositorObserver,
433 observer_list_, 438 observer_list_,
434 OnCompositingDidCommit(this)); 439 OnCompositingDidCommit(this));
435 } 440 }
436 441
437 void Compositor::DidCommitAndDrawFrame() { 442 void Compositor::DidCommitAndDrawFrame() {
438 } 443 }
439 444
440 void Compositor::DidCompleteSwapBuffers() { 445 void Compositor::DidCompleteSwapBuffers() {
446 has_swapped_frame_at_current_size_ = true;
piman 2015/12/11 07:53:12 It is possible that the main thread will start the
ericrk 2015/12/15 00:25:03 Good feedback - I've updated this to use a SwapPro
441 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 447 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
442 OnCompositingEnded(this)); 448 OnCompositingEnded(this));
443 } 449 }
444 450
445 void Compositor::DidPostSwapBuffers() { 451 void Compositor::DidPostSwapBuffers() {
446 base::TimeTicks start_time = base::TimeTicks::Now(); 452 base::TimeTicks start_time = base::TimeTicks::Now();
447 FOR_EACH_OBSERVER(CompositorObserver, observer_list_, 453 FOR_EACH_OBSERVER(CompositorObserver, observer_list_,
448 OnCompositingStarted(this, start_time)); 454 OnCompositingStarted(this, start_time));
449 } 455 }
450 456
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 observer_list_, 510 observer_list_,
505 OnCompositingLockStateChanged(this)); 511 OnCompositingLockStateChanged(this));
506 } 512 }
507 513
508 void Compositor::CancelCompositorLock() { 514 void Compositor::CancelCompositorLock() {
509 if (compositor_lock_) 515 if (compositor_lock_)
510 compositor_lock_->CancelLock(); 516 compositor_lock_->CancelLock();
511 } 517 }
512 518
513 } // namespace ui 519 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698