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

Side by Side Diff: chromecast/graphics/cast_vsync_settings.cc

Issue 2422853002: Remove usage of FOR_EACH_OBSERVER macro in chromecast (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chromecast/graphics/cast_vsync_settings.h" 5 #include "chromecast/graphics/cast_vsync_settings.h"
6 6
7 namespace chromecast { 7 namespace chromecast {
8 namespace { 8 namespace {
9 base::LazyInstance<CastVSyncSettings> g_instance = LAZY_INSTANCE_INITIALIZER; 9 base::LazyInstance<CastVSyncSettings> g_instance = LAZY_INSTANCE_INITIALIZER;
10 } // namespace 10 } // namespace
11 11
12 // static 12 // static
13 CastVSyncSettings* CastVSyncSettings::GetInstance() { 13 CastVSyncSettings* CastVSyncSettings::GetInstance() {
14 return g_instance.Pointer(); 14 return g_instance.Pointer();
15 } 15 }
16 16
17 base::TimeDelta CastVSyncSettings::GetVSyncInterval() const { 17 base::TimeDelta CastVSyncSettings::GetVSyncInterval() const {
18 return interval_; 18 return interval_;
19 } 19 }
20 20
21 void CastVSyncSettings::SetVSyncInterval(base::TimeDelta interval) { 21 void CastVSyncSettings::SetVSyncInterval(base::TimeDelta interval) {
22 if (interval_ == interval) 22 if (interval_ == interval)
23 return; 23 return;
24 interval_ = interval; 24 interval_ = interval;
25 FOR_EACH_OBSERVER(Observer, observers_, 25 for (auto& observer : observers_)
26 OnVSyncIntervalChanged(interval)); 26 observer.OnVSyncIntervalChanged(interval);
27 } 27 }
28 28
29 void CastVSyncSettings::AddObserver(Observer* observer) { 29 void CastVSyncSettings::AddObserver(Observer* observer) {
30 observers_.AddObserver(observer); 30 observers_.AddObserver(observer);
31 } 31 }
32 32
33 void CastVSyncSettings::RemoveObserver(Observer* observer) { 33 void CastVSyncSettings::RemoveObserver(Observer* observer) {
34 observers_.RemoveObserver(observer); 34 observers_.RemoveObserver(observer);
35 } 35 }
36 36
37 // Default to 60fps until set otherwise 37 // Default to 60fps until set otherwise
38 CastVSyncSettings::CastVSyncSettings() 38 CastVSyncSettings::CastVSyncSettings()
39 : interval_(base::TimeDelta::FromMicroseconds(16666)) {} 39 : interval_(base::TimeDelta::FromMicroseconds(16666)) {}
40 40
41 CastVSyncSettings::~CastVSyncSettings() = default; 41 CastVSyncSettings::~CastVSyncSettings() = default;
42 42
43 } // namespace chromecast 43 } // namespace chromecast
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698