Bug 44874 - Handle MediaQueryExp memory management exclusively with smart pointers
Summary: Handle MediaQueryExp memory management exclusively with smart pointers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Maciej Stachowiak
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-30 09:16 PDT by Maciej Stachowiak
Modified: 2010-09-08 04:08 PDT (History)
1 user (show)

See Also:


Attachments
Patch (23.06 KB, patch)
2010-08-30 09:22 PDT, Maciej Stachowiak
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Stachowiak 2010-08-30 09:16:56 PDT
Handle MediaQueryExp memory management exclusively with smart pointers
Comment 1 Maciej Stachowiak 2010-08-30 09:22:40 PDT
Created attachment 65922 [details]
Patch
Comment 2 Darin Adler 2010-08-30 09:26:39 PDT
Comment on attachment 65922 [details]
Patch

I think we can use Vector<OwnPtr> almost everywhere we do deleteAllValues.

> +inline PassOwnPtr<MediaQueryExp> MediaQueryExp::create(const AtomicString& mediaFeature, CSSParserValueList* values)
> +{
> +    return adoptPtr(new MediaQueryExp(mediaFeature, values));
> +}

The pattern I've been using on these is to put the create function into the .cpp file and marking the constructor inline. I think this results in the same amount of function call overhead, and more code sharing between call sites of the create function.

r=me
Comment 3 WebKit Review Bot 2010-08-30 09:28:39 PDT
Attachment 65922 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
JavaScriptCore/wtf/NonCopyingSort.h:27:  #ifndef header guard has wrong style, please use: NonCopyingSort_h  [build/header_guard] [5]
JavaScriptCore/wtf/NonCopyingSort.h:32:  Use 'using namespace std;' instead of 'using std::swap;'.  [build/using_std] [4]
Total errors found: 2 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Joseph Pecoraro 2010-08-30 10:10:08 PDT
Comment on attachment 65922 [details]
Patch

> Index: WebCore/ChangeLog
> ===================================================================
> +        Gace MediaQueryExp a create function, made the constructor private, and followed

If you haven't landed yet. Typo: "Gace" => "Gave"
Comment 5 Maciej Stachowiak 2010-09-08 04:08:31 PDT
Committed r66968: <http://trac.webkit.org/changeset/66968>