Bug 130241 - Refactor checking log channel state in MediaPlayerPrivateGStreamerBase.
Summary: Refactor checking log channel state in MediaPlayerPrivateGStreamerBase.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Peter Molnar
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-14 09:01 PDT by Peter Molnar
Modified: 2014-03-20 03:07 PDT (History)
14 users (show)

See Also:


Attachments
patch (2.88 KB, patch)
2014-03-14 09:02 PDT, Peter Molnar
no flags Details | Formatted Diff | Diff
patch (2.92 KB, patch)
2014-03-17 03:31 PDT, Peter Molnar
no flags Details | Formatted Diff | Diff
patch - fixed style (2.98 KB, patch)
2014-03-17 04:10 PDT, Peter Molnar
no flags Details | Formatted Diff | Diff
patch (2.88 KB, patch)
2014-03-19 02:01 PDT, Peter Molnar
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Molnar 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.
Comment 1 Peter Molnar 2014-03-14 09:02:29 PDT
Created attachment 226723 [details]
patch
Comment 2 Philippe Normand 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.
Comment 3 Peter Molnar 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.
Comment 4 WebKit Commit Bot 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.
Comment 5 Peter Molnar 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.
Comment 6 WebKit Commit Bot 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.
Comment 7 Philippe Normand 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
Comment 8 Peter Molnar 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
Comment 9 WebKit Commit Bot 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.
Comment 10 WebKit Commit Bot 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>
Comment 11 WebKit Commit Bot 2014-03-20 03:07:36 PDT
All reviewed patches have been landed.  Closing bug.