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

Unified Diff: media/base/video_capture_types.h

Issue 1323093006: Change the media::PowerLineFrequency from an enum class to a proper class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: media/base/video_capture_types.h
diff --git a/media/base/video_capture_types.h b/media/base/video_capture_types.h
index 4790ea52e1e12414226a882142495ed03c4b3eaa..2f5098676e894f5ba79c11838c7478abbd3a4b83 100644
--- a/media/base/video_capture_types.h
+++ b/media/base/video_capture_types.h
@@ -55,12 +55,25 @@ enum ResolutionChangePolicy {
// Potential values of the googPowerLineFrequency optional constraint passed to
// getUserMedia. Note that the numeric values are currently significant, and are
// used to map enum values to corresponding frequency values.
-// TODO(ajose): http://crbug.com/525167 Consider making this a class.
-enum class PowerLineFrequency {
- FREQUENCY_DEFAULT = 0,
- FREQUENCY_50HZ = 50,
- FREQUENCY_60HZ = 60,
- FREQUENCY_MAX = FREQUENCY_60HZ
+class MEDIA_EXPORT PowerLineFrequency {
+private:
wolenetz 2015/09/09 19:39:15 public before private: http://google-styleguide.go
suvanjanmukherjee 2015/09/13 15:33:46 Done.
+ int freq_;
+
+ void check(int freq);
wolenetz 2015/09/09 19:39:15 methods before data members: http://google-stylegu
suvanjanmukherjee 2015/09/13 15:33:46 Done.
+public:
+ // Static members
+ static constexpr int FREQUENCY_DEFAULT = 0;
wolenetz 2015/09/09 19:39:15 constexpr usage is currently banned in Chromium (s
suvanjanmukherjee 2015/09/13 15:33:46 Done.
+ static constexpr int FREQUENCY_50HZ = 50;
+ static constexpr int FREQUENCY_60HZ = 60;
+ static constexpr int FREQUENCY_MAX = FREQUENCY_60HZ;
+
+ // Functions
+ PowerLineFrequency(int freq);
wolenetz 2015/09/09 19:39:15 use "explicit"
suvanjanmukherjee 2015/09/13 15:33:46 Done.
+ PowerLineFrequency& operator = (int freq);
wolenetz 2015/09/09 19:39:15 For this and the next line, use consistent and cor
suvanjanmukherjee 2015/09/13 15:33:46 Done.
+ PowerLineFrequency& operator =(const PowerLineFrequency& rhs);
+
+ // Automatically cast to int
+ operator int() const;
};
// Assert that the int:frequency mapping is correct.
static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_DEFAULT) == 0,
ajose 2015/09/10 17:24:55 Remove static_casts?
suvanjanmukherjee 2015/09/13 15:33:46 Done.

Powered by Google App Engine
This is Rietveld 408576698