Bug 130241

Summary: Refactor checking log channel state in MediaPlayerPrivateGStreamerBase.
Product: WebKit Reporter: Peter Molnar <pmolnar.u-szeged>
Component: WebCore Misc.Assignee: Peter Molnar <pmolnar.u-szeged>
Status: RESOLVED FIXED    
Severity: Normal CC: agomez, calvaris, cgarcia, commit-queue, eric.carlson, glenn, gustavo, jer.noble, menard, mrobinson, philipj, pnormand, sergio, vjaquez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch
none
patch
none
patch - fixed style
none
patch none

Peter Molnar
Reported 2014-03-14 09:01:12 PDT
The channel is passed around only to check its state. Clean this up by adding a method to check whether a log channel is enabled.
Attachments
patch (2.88 KB, patch)
2014-03-14 09:02 PDT, Peter Molnar
no flags
patch (2.92 KB, patch)
2014-03-17 03:31 PDT, Peter Molnar
no flags
patch - fixed style (2.98 KB, patch)
2014-03-17 04:10 PDT, Peter Molnar
no flags
patch (2.88 KB, patch)
2014-03-19 02:01 PDT, Peter Molnar
no flags
Peter Molnar
Comment 1 2014-03-14 09:02:29 PDT
Philippe Normand
Comment 2 2014-03-14 09:08:08 PDT
Comment on attachment 226723 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=226723&action=review > Source/WebCore/platform/Logging.cpp:50 > + WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data()); Would be good to check the channel is not null.
Peter Molnar
Comment 3 2014-03-17 03:31:17 PDT
Created attachment 226901 [details] patch (In reply to comment #2) > (From update of attachment 226723 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=226723&action=review > > > Source/WebCore/platform/Logging.cpp:50 > > + WTFLogChannel* channel = WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data()); > > Would be good to check the channel is not null. Added null check.
WebKit Commit Bot
Comment 4 2014-03-17 03:33:09 PDT
Attachment 226901 [details] did not pass style-queue: ERROR: Source/WebCore/platform/Logging.h:83: Code inside a namespace should not be indented. [whitespace/indent] [4] ERROR: Source/WebCore/platform/Logging.cpp:53: Else clause should never be on same line as else (use 2 lines) [whitespace/newline] [4] Total errors found: 2 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Peter Molnar
Comment 5 2014-03-17 04:10:51 PDT
Created attachment 226902 [details] patch - fixed style (In reply to comment #4) > Attachment 226901 [details] did not pass style-queue: > > > ERROR: Source/WebCore/platform/Logging.h:83: Code inside a namespace should not be indented. [whitespace/indent] [4] I'm not quite sure about this style error. The exactly same change in this file passed a few days ago. Someone upgraded the stlye checker? :) Should I fix the indentation in the whole file, even the lines not touched by this patch? > ERROR: Source/WebCore/platform/Logging.cpp:53: Else clause should never be on same line as else (use 2 lines) [whitespace/newline] [4] Fixed.
WebKit Commit Bot
Comment 6 2014-03-17 04:12:17 PDT
Attachment 226902 [details] did not pass style-queue: ERROR: Source/WebCore/platform/Logging.h:83: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Philippe Normand
Comment 7 2014-03-18 12:35:01 PDT
Comment on attachment 226902 [details] patch - fixed style View in context: https://bugs.webkit.org/attachment.cgi?id=226902&action=review This is basically good but the logChannelEnabled local variable can easily be avoided, we like early returns in WebKit :) > Source/WebCore/platform/Logging.cpp:53 > + if (channel) This can be transformed to an early return: if (!channel) return false; and then below return channel->state != WTFLogChannelOff; So no need for a local variable
Peter Molnar
Comment 8 2014-03-19 02:01:13 PDT
Created attachment 227168 [details] patch (In reply to comment #7) > (From update of attachment 226902 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=226902&action=review > > This is basically good but the logChannelEnabled local variable can easily be avoided, we like early returns in WebKit :) Thank you for the correction, it looks nicer indeed :) > > > Source/WebCore/platform/Logging.cpp:53 > > + if (channel) > > This can be transformed to an early return: if (!channel) return false; > > and then below return channel->state != WTFLogChannelOff; > So no need for a local variable
WebKit Commit Bot
Comment 9 2014-03-19 02:04:10 PDT
Attachment 227168 [details] did not pass style-queue: ERROR: Source/WebCore/platform/Logging.h:83: Code inside a namespace should not be indented. [whitespace/indent] [4] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Commit Bot
Comment 10 2014-03-20 03:07:29 PDT
Comment on attachment 227168 [details] patch Clearing flags on attachment: 227168 Committed r165955: <http://trac.webkit.org/changeset/165955>
WebKit Commit Bot
Comment 11 2014-03-20 03:07:36 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.