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

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

Issue 767443002: Ensure Surface size always matches window size on swap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 !command_line->HasSwitch(switches::kDisableGpuVsync); 102 !command_line->HasSwitch(switches::kDisableGpuVsync);
103 #if !defined(OS_MACOSX) 103 #if !defined(OS_MACOSX)
104 settings.renderer_settings.partial_swap_enabled = 104 settings.renderer_settings.partial_swap_enabled =
105 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap); 105 !command_line->HasSwitch(cc::switches::kUIDisablePartialSwap);
106 #endif 106 #endif
107 #if defined(OS_CHROMEOS) 107 #if defined(OS_CHROMEOS)
108 settings.per_tile_painting_enabled = true; 108 settings.per_tile_painting_enabled = true;
109 #endif 109 #endif
110 #if defined(OS_WIN) 110 #if defined(OS_WIN)
111 settings.disable_hi_res_timer_tasks_on_battery = true; 111 settings.disable_hi_res_timer_tasks_on_battery = true;
112 settings.renderer_settings.finish_rendering_on_resize = true;
112 #endif 113 #endif
113 114
114 // These flags should be mirrored by renderer versions in content/renderer/. 115 // These flags should be mirrored by renderer versions in content/renderer/.
115 settings.initial_debug_state.show_debug_borders = 116 settings.initial_debug_state.show_debug_borders =
116 command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders); 117 command_line->HasSwitch(cc::switches::kUIShowCompositedLayerBorders);
117 settings.initial_debug_state.show_fps_counter = 118 settings.initial_debug_state.show_fps_counter =
118 command_line->HasSwitch(cc::switches::kUIShowFPSCounter); 119 command_line->HasSwitch(cc::switches::kUIShowFPSCounter);
119 settings.initial_debug_state.show_layer_animation_bounds_rects = 120 settings.initial_debug_state.show_layer_animation_bounds_rects =
120 command_line->HasSwitch(cc::switches::kUIShowLayerAnimationBounds); 121 command_line->HasSwitch(cc::switches::kUIShowLayerAnimationBounds);
121 settings.initial_debug_state.show_paint_rects = 122 settings.initial_debug_state.show_paint_rects =
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 250 }
250 251
251 void Compositor::ScheduleFullRedraw() { 252 void Compositor::ScheduleFullRedraw() {
252 host_->SetNeedsRedraw(); 253 host_->SetNeedsRedraw();
253 } 254 }
254 255
255 void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) { 256 void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) {
256 host_->SetNeedsRedrawRect(damage_rect); 257 host_->SetNeedsRedrawRect(damage_rect);
257 } 258 }
258 259
259 void Compositor::FinishAllRendering() { 260 void Compositor::DisableSwapUntilResize() {
260 host_->FinishAllRendering(); 261 host_->FinishAllRendering();
262 context_factory_->ResizeDisplay(this, gfx::Size());
261 } 263 }
262 264
263 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) { 265 void Compositor::SetLatencyInfo(const ui::LatencyInfo& latency_info) {
264 scoped_ptr<cc::SwapPromise> swap_promise( 266 scoped_ptr<cc::SwapPromise> swap_promise(
265 new cc::LatencyInfoSwapPromise(latency_info)); 267 new cc::LatencyInfoSwapPromise(latency_info));
266 host_->QueueSwapPromise(swap_promise.Pass()); 268 host_->QueueSwapPromise(swap_promise.Pass());
267 } 269 }
268 270
269 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) { 271 void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
270 DCHECK_GT(scale, 0); 272 DCHECK_GT(scale, 0);
271 if (!size_in_pixel.IsEmpty()) { 273 if (!size_in_pixel.IsEmpty()) {
272 size_ = size_in_pixel; 274 size_ = size_in_pixel;
273 host_->SetViewportSize(size_in_pixel); 275 host_->SetViewportSize(size_in_pixel);
274 root_web_layer_->SetBounds(size_in_pixel); 276 root_web_layer_->SetBounds(size_in_pixel);
277 context_factory_->ResizeDisplay(this, size_in_pixel);
275 } 278 }
276 if (device_scale_factor_ != scale) { 279 if (device_scale_factor_ != scale) {
277 device_scale_factor_ = scale; 280 device_scale_factor_ = scale;
278 host_->SetDeviceScaleFactor(scale); 281 host_->SetDeviceScaleFactor(scale);
279 if (root_layer_) 282 if (root_layer_)
280 root_layer_->OnDeviceScaleFactorChanged(scale); 283 root_layer_->OnDeviceScaleFactorChanged(scale);
281 } 284 }
282 } 285 }
283 286
284 void Compositor::SetBackgroundColor(SkColor color) { 287 void Compositor::SetBackgroundColor(SkColor color) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 // Call ScheduleDraw() instead of Draw() in order to allow other 463 // Call ScheduleDraw() instead of Draw() in order to allow other
461 // CompositorObservers to be notified before starting another 464 // CompositorObservers to be notified before starting another
462 // draw cycle. 465 // draw cycle.
463 ScheduleDraw(); 466 ScheduleDraw();
464 } 467 }
465 FOR_EACH_OBSERVER( 468 FOR_EACH_OBSERVER(
466 CompositorObserver, observer_list_, OnCompositingEnded(this)); 469 CompositorObserver, observer_list_, OnCompositingEnded(this));
467 } 470 }
468 471
469 } // namespace ui 472 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698