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

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

Issue 467703003: Update ui::CompositorObserver instrumentation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 6 years, 4 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 void Compositor::SetBackgroundColor(SkColor color) { 271 void Compositor::SetBackgroundColor(SkColor color) {
272 host_->set_background_color(color); 272 host_->set_background_color(color);
273 ScheduleDraw(); 273 ScheduleDraw();
274 } 274 }
275 275
276 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const { 276 scoped_refptr<CompositorVSyncManager> Compositor::vsync_manager() const {
277 return vsync_manager_; 277 return vsync_manager_;
278 } 278 }
279 279
280 void Compositor::AddObserver(CompositorObserver* observer) { 280 void Compositor::AddObserver(CompositorObserver* observer) {
281 #if defined(OS_MACOSX) 281 #if DCHECK_IS_ON
282 // Debugging instrumentation for crbug.com/401630. 282 DCHECK(observer);
283 // TODO(ccameron): remove this.
284 CHECK(observer);
285 if (!observer_list_.HasObserver(observer)) 283 if (!observer_list_.HasObserver(observer))
286 observer->observing_count_ += 1; 284 observer->observing_count_ += 1;
287 #endif 285 #endif
288 286
289 observer_list_.AddObserver(observer); 287 observer_list_.AddObserver(observer);
290 } 288 }
291 289
292 void Compositor::RemoveObserver(CompositorObserver* observer) { 290 void Compositor::RemoveObserver(CompositorObserver* observer) {
293 #if defined(OS_MACOSX) 291 #if DCHECK_IS_ON
294 // Debugging instrumentation for crbug.com/401630.
295 // TODO(ccameron): remove this.
296 if (observer_list_.HasObserver(observer)) 292 if (observer_list_.HasObserver(observer))
297 observer->observing_count_ -= 1; 293 observer->observing_count_ -= 1;
298 #endif 294 #endif
299 295
300 observer_list_.RemoveObserver(observer); 296 observer_list_.RemoveObserver(observer);
301 } 297 }
302 298
303 bool Compositor::HasObserver(CompositorObserver* observer) { 299 bool Compositor::HasObserver(CompositorObserver* observer) {
304 return observer_list_.HasObserver(observer); 300 return observer_list_.HasObserver(observer);
305 } 301 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // CompositorObservers to be notified before starting another 434 // CompositorObservers to be notified before starting another
439 // draw cycle. 435 // draw cycle.
440 ScheduleDraw(); 436 ScheduleDraw();
441 } 437 }
442 FOR_EACH_OBSERVER(CompositorObserver, 438 FOR_EACH_OBSERVER(CompositorObserver,
443 observer_list_, 439 observer_list_,
444 OnCompositingEnded(this)); 440 OnCompositingEnded(this));
445 } 441 }
446 442
447 } // namespace ui 443 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/compositor_observer.h » ('j') | ui/compositor/compositor_observer.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698