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

Issue 1323093006: Change the media::PowerLineFrequency from an enum class to a proper class (Closed)

Created:
5 years, 3 months ago by suvanjanmukherjee
Modified:
5 years, 3 months ago
CC:
chromium-reviews, feature-media-reviews_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Change the media::PowerLineFrequency from an enum class to a proper class so that querying its value in conditional statements won't require ugly static_cast(s) BUG=525167

Patch Set 1 #

Total comments: 24

Patch Set 2 : Pass around PowerLineFrequency objects in VideoCaptureDevice instead of integers #

Unified diffs Side-by-side diffs Delta from patch set Stats (+143 lines, -35 lines) Patch
M AUTHORS View 1 chunk +1 line, -0 lines 0 comments Download
M content/common/media/media_param_traits.h View 1 2 chunks +9 lines, -0 lines 0 comments Download
M content/common/media/media_param_traits.cc View 1 2 chunks +24 lines, -0 lines 0 comments Download
M content/common/media/video_capture_messages.h View 1 1 chunk +0 lines, -2 lines 0 comments Download
M content/renderer/media/media_stream_video_capturer_source.cc View 1 1 chunk +2 lines, -3 lines 0 comments Download
M media/base/BUILD.gn View 1 chunk +1 line, -0 lines 0 comments Download
M media/base/video_capture_types.h View 1 1 chunk +34 lines, -12 lines 0 comments Download
M media/base/video_capture_types.cc View 1 1 chunk +27 lines, -0 lines 0 comments Download
A media/base/video_capture_types_unittest.cc View 1 1 chunk +20 lines, -0 lines 0 comments Download
M media/capture/video/linux/video_capture_device_linux.h View 1 1 chunk +2 lines, -1 line 0 comments Download
M media/capture/video/linux/video_capture_device_linux.cc View 1 1 chunk +5 lines, -4 lines 0 comments Download
M media/capture/video/mac/video_capture_device_mac.mm View 1 1 chunk +1 line, -1 line 0 comments Download
M media/capture/video/video_capture_device.h View 1 1 chunk +3 lines, -2 lines 0 comments Download
M media/capture/video/video_capture_device.cc View 1 2 chunks +10 lines, -7 lines 0 comments Download
M media/capture/video/win/video_capture_device_win.cc View 1 2 chunks +3 lines, -3 lines 0 comments Download
M media/media.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 12 (3 generated)
suvanjanmukherjee
Please have a look at my change that changes the PowerLineFrequency enum used to map ...
5 years, 3 months ago (2015-09-08 23:46:33 UTC) #2
wolenetz
Thank you for working on this! I've provided some general comments below, mostly around style, ...
5 years, 3 months ago (2015-09-09 19:39:15 UTC) #4
dcheng
Why not just make this a plain old enum?
5 years, 3 months ago (2015-09-09 22:50:09 UTC) #5
suvanjanmukherjee
On 2015/09/09 22:50:09, dcheng wrote: > Why not just make this a plain old enum? ...
5 years, 3 months ago (2015-09-09 23:39:49 UTC) #6
dcheng
On 2015/09/09 at 23:39:49, suvanjanmukherjee wrote: > On 2015/09/09 22:50:09, dcheng wrote: > > Why ...
5 years, 3 months ago (2015-09-10 00:08:13 UTC) #7
ajose
Thanks a lot, Suvanjan! Considering there are only a few valid states (50HZ, 60HZ, maybe ...
5 years, 3 months ago (2015-09-10 17:24:55 UTC) #8
suvanjanmukherjee
Incorporating suggestions from previous review and passing around PowerLineFrequency objects in VideoDeviceCapture instead of integers ...
5 years, 3 months ago (2015-09-13 15:33:46 UTC) #10
dcheng
On 2015/09/13 at 15:33:46, suvanjanmukherjee wrote: > Incorporating suggestions from previous review and passing around ...
5 years, 3 months ago (2015-09-13 15:55:22 UTC) #11
wolenetz
5 years, 3 months ago (2015-09-24 19:10:07 UTC) #12
On 2015/09/13 15:55:22, dcheng wrote:
> On 2015/09/13 at 15:33:46, suvanjanmukherjee wrote:
> > Incorporating suggestions from previous review and passing around
> PowerLineFrequency objects in VideoDeviceCapture instead of integers as
> suggested in the previous review.
> > 
> > https://codereview.chromium.org/1323093006/diff/1/media/base/BUILD.gn
> > File media/base/BUILD.gn (right):
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/BUILD.gn#newcode412
> > media/base/BUILD.gn:412: "video_capture_types_unittest.cc",
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > Please also update //src/media/media.gyp
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > File media/base/video_capture_types.cc (right):
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.cc:14: void PowerLineFrequency::check(int
freq)
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > nit: remember to follow the updated declaration order here in the impl,
too.
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.cc:15: {
> > On 2015/09/10 17:24:55, ajose wrote:
> > > Move open curly brace to the end of the same line as the last parameter: 
> > >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Function_Decl...
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.cc:22: freq_ =  freq;
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > nit: s/  / /
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > File media/base/video_capture_types.h (right):
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.h:59: private:
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > public before private:
> > >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Declaration_O...
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.h:62: void check(int freq);
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > methods before data members:
> > >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Declaration_O...
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.h:65: static constexpr int FREQUENCY_DEFAULT
=
> 0;
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > constexpr usage is currently banned in Chromium (see
> > > http://chromium-cpp.appspot.com/)
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.h:71: PowerLineFrequency(int freq);
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > use "explicit"
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.h:72: PowerLineFrequency& operator = (int
> freq);
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > For this and the next line, use consistent and correct whitespace.
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types.h:79:
> static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_DEFAULT) == 0,
> > On 2015/09/10 17:24:55, ajose wrote:
> > > Remove static_casts?
> > 
> > Done.
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > File media/base/video_capture_types_unittest.cc (right):
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types_unittest.cc:6: PowerLineFrequency
> p50_a(PowerLineFrequency::FREQUENCY_50HZ);
> > On 2015/09/10 17:24:55, ajose wrote:
> > > Consider using more descriptive variable names.
> > 
> > Using only one variable in the new test. Simple setting and testing. Please
> let me know if using more descriptive names is still advisable
> > 
> >
>
https://codereview.chromium.org/1323093006/diff/1/media/base/video_capture_ty...
> > media/base/video_capture_types_unittest.cc:16: case
> PowerLineFrequency::FREQUENCY_50HZ: result = true; break;
> > On 2015/09/09 19:39:15, wolenetz wrote:
> > > nit: make the case and default code blocks multi-line. See, for example,
> > >
>
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html#Loops_and_Swi...
> > 
> > No longer using a switch case here
> 
> Why not just change this back to an enum class? The class is unnecessary, now
> that the need to cast is largely eliminated.

Given there is a newer CL (https://codereview.chromium.org/1345993002/) being
reviewed that makes this one obsolete, please close this CL so that it doesn't
pollute reviewers' TODO lists :)

Thanks!
Matt

Powered by Google App Engine
This is Rietveld 408576698