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

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

Issue 542113004: [Linux] Show preview contents for minimized windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 widget_(widget), 76 widget_(widget),
77 compositor_thread_loop_(context_factory->GetCompositorMessageLoop()), 77 compositor_thread_loop_(context_factory->GetCompositorMessageLoop()),
78 task_runner_(task_runner), 78 task_runner_(task_runner),
79 vsync_manager_(new CompositorVSyncManager()), 79 vsync_manager_(new CompositorVSyncManager()),
80 device_scale_factor_(0.0f), 80 device_scale_factor_(0.0f),
81 last_started_frame_(0), 81 last_started_frame_(0),
82 last_ended_frame_(0), 82 last_ended_frame_(0),
83 disable_schedule_composite_(false), 83 disable_schedule_composite_(false),
84 compositor_lock_(NULL), 84 compositor_lock_(NULL),
85 defer_draw_scheduling_(false), 85 defer_draw_scheduling_(false),
86 block_drawing_(false),
86 waiting_on_compositing_end_(false), 87 waiting_on_compositing_end_(false),
87 draw_on_compositing_end_(false), 88 draw_on_compositing_end_(false),
88 swap_state_(SWAP_NONE), 89 swap_state_(SWAP_NONE),
89 layer_animator_collection_(this), 90 layer_animator_collection_(this),
90 schedule_draw_factory_(this) { 91 schedule_draw_factory_(this) {
91 root_web_layer_ = cc::Layer::Create(); 92 root_web_layer_ = cc::Layer::Create();
92 93
93 CommandLine* command_line = CommandLine::ForCurrentProcess(); 94 CommandLine* command_line = CommandLine::ForCurrentProcess();
94 95
95 cc::LayerTreeSettings settings; 96 cc::LayerTreeSettings settings;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (compositor_thread_loop_.get()) { 181 if (compositor_thread_loop_.get()) {
181 host_->SetNeedsCommit(); 182 host_->SetNeedsCommit();
182 } else if (!defer_draw_scheduling_) { 183 } else if (!defer_draw_scheduling_) {
183 defer_draw_scheduling_ = true; 184 defer_draw_scheduling_ = true;
184 task_runner_->PostTask( 185 task_runner_->PostTask(
185 FROM_HERE, 186 FROM_HERE,
186 base::Bind(&Compositor::Draw, schedule_draw_factory_.GetWeakPtr())); 187 base::Bind(&Compositor::Draw, schedule_draw_factory_.GetWeakPtr()));
187 } 188 }
188 } 189 }
189 190
191 void Compositor::SetBlockDrawing(bool block_drawing) {
192 DCHECK(!compositor_thread_loop_);
193
194 if (block_drawing_ == block_drawing)
195 return;
196
197 block_drawing_ = block_drawing;
198 defer_draw_scheduling_ = block_drawing;
199
200 if (!block_drawing)
201 ScheduleDraw();
202 }
203
190 void Compositor::SetRootLayer(Layer* root_layer) { 204 void Compositor::SetRootLayer(Layer* root_layer) {
191 if (root_layer_ == root_layer) 205 if (root_layer_ == root_layer)
192 return; 206 return;
193 if (root_layer_) 207 if (root_layer_)
194 root_layer_->SetCompositor(NULL); 208 root_layer_->SetCompositor(NULL);
195 root_layer_ = root_layer; 209 root_layer_ = root_layer;
196 if (root_layer_ && !root_layer_->GetCompositor()) 210 if (root_layer_ && !root_layer_->GetCompositor())
197 root_layer_->SetCompositor(this); 211 root_layer_->SetCompositor(this);
198 root_web_layer_->RemoveAllChildren(); 212 root_web_layer_->RemoveAllChildren();
199 if (root_layer_) 213 if (root_layer_)
200 root_web_layer_->AddChild(root_layer_->cc_layer()); 214 root_web_layer_->AddChild(root_layer_->cc_layer());
201 } 215 }
202 216
203 void Compositor::SetHostHasTransparentBackground( 217 void Compositor::SetHostHasTransparentBackground(
204 bool host_has_transparent_background) { 218 bool host_has_transparent_background) {
205 host_->set_has_transparent_background(host_has_transparent_background); 219 host_->set_has_transparent_background(host_has_transparent_background);
206 } 220 }
207 221
208 void Compositor::Draw() { 222 void Compositor::Draw() {
209 DCHECK(!compositor_thread_loop_.get()); 223 DCHECK(!compositor_thread_loop_.get());
210 224
225 if (block_drawing_)
226 return;
227
211 defer_draw_scheduling_ = false; 228 defer_draw_scheduling_ = false;
212 if (waiting_on_compositing_end_) { 229 if (waiting_on_compositing_end_) {
213 draw_on_compositing_end_ = true; 230 draw_on_compositing_end_ = true;
214 return; 231 return;
215 } 232 }
216 if (!root_layer_) 233 if (!root_layer_)
217 return; 234 return;
218 235
219 TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1); 236 TRACE_EVENT_ASYNC_BEGIN0("ui", "Compositor::Draw", last_started_frame_ + 1);
220 237
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 if (root_layer_) 286 if (root_layer_)
270 root_layer_->OnDeviceScaleFactorChanged(scale); 287 root_layer_->OnDeviceScaleFactorChanged(scale);
271 } 288 }
272 } 289 }
273 290
274 void Compositor::SetBackgroundColor(SkColor color) { 291 void Compositor::SetBackgroundColor(SkColor color) {
275 host_->set_background_color(color); 292 host_->set_background_color(color);
276 ScheduleDraw(); 293 ScheduleDraw();
277 } 294 }
278 295
279 void Compositor::SetVisible(bool visible) { 296 void Compositor::SetVisible(bool visible) {
danakj 2014/09/05 15:03:15 Why don't you just call this?
280 host_->SetVisible(visible); 297 host_->SetVisible(visible);
281 } 298 }
282 299
283 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { 300 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const {
284 return vsync_manager_; 301 return vsync_manager_;
285 } 302 }
286 303
287 void Compositor::AddObserver(CompositorObserver* observer) { 304 void Compositor::AddObserver(CompositorObserver* observer) {
288 #if defined(OS_MACOSX) 305 #if defined(OS_MACOSX)
289 // Debugging instrumentation for crbug.com/401630. 306 // Debugging instrumentation for crbug.com/401630.
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // Call ScheduleDraw() instead of Draw() in order to allow other 461 // Call ScheduleDraw() instead of Draw() in order to allow other
445 // CompositorObservers to be notified before starting another 462 // CompositorObservers to be notified before starting another
446 // draw cycle. 463 // draw cycle.
447 ScheduleDraw(); 464 ScheduleDraw();
448 } 465 }
449 FOR_EACH_OBSERVER( 466 FOR_EACH_OBSERVER(
450 CompositorObserver, observer_list_, OnCompositingEnded(this)); 467 CompositorObserver, observer_list_, OnCompositingEnded(this));
451 } 468 }
452 469
453 } // namespace ui 470 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.h ('k') | ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698