Bug 138190 - Clean up virtual functions in inspector/
Summary: Clean up virtual functions in inspector/
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Enhancement
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-10-29 15:21 PDT by Chris Dumez
Modified: 2014-10-29 16:28 PDT (History)
5 users (show)

See Also:


Attachments
Patch (18.67 KB, patch)
2014-10-29 15:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-10-29 15:21:06 PDT
Clean up virtual functions in inspector/ by:
- Making virtual functions final when possible
- Making classes final when possible
- Explicitly marking functions / destructors as virtual when they are
  inherently virtual
- Making isXXX() virtual functions private on XXX classes to avoid
      unnecessary type checks
Comment 1 Radar WebKit Bug Importer 2014-10-29 15:21:38 PDT
<rdar://problem/18817528>
Comment 2 Chris Dumez 2014-10-29 15:23:39 PDT
Created attachment 240631 [details]
Patch
Comment 3 Joseph Pecoraro 2014-10-29 15:43:11 PDT
Comment on attachment 240631 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=240631&action=review

r=me!

> Source/WebCore/inspector/PageConsoleAgent.h:50
> -    virtual bool isWorkerAgent() const override { return false; }
> -
>  private:
> +    virtual bool isWorkerAgent() const override { return false; }

I never really understood this (moving public virtual functions to private). They are still public, so why not leave it public?
Comment 4 Chris Dumez 2014-10-29 15:45:43 PDT
Comment on attachment 240631 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=240631&action=review

>> Source/WebCore/inspector/PageConsoleAgent.h:50
>> +    virtual bool isWorkerAgent() const override { return false; }
> 
> I never really understood this (moving public virtual functions to private). They are still public, so why not leave it public?

Calling PageConsoleAgent::isWorkerAgent() should give you a compile error now because it *is* private (if the instance is a PageConsoleAgent, not a generic WebConsoleAgent). This makes sure we don't do unnecessary type checks in the code as explained in the Changelog.
Comment 5 WebKit Commit Bot 2014-10-29 16:28:52 PDT
Comment on attachment 240631 [details]
Patch

Clearing flags on attachment: 240631

Committed r175355: <http://trac.webkit.org/changeset/175355>
Comment 6 WebKit Commit Bot 2014-10-29 16:28:56 PDT
All reviewed patches have been landed.  Closing bug.