Summary: | [BREWMP] Add a function to create a BREW instance without local variable declarations. | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Kwang Yul Seo <skyul> | ||||||||
Component: | Web Template Framework | Assignee: | Nobody <webkit-unassigned> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | abarth, beergun, commit-queue, darin, eric | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Other | ||||||||||
OS: | Other | ||||||||||
Bug Depends on: | |||||||||||
Bug Blocks: | 33564 | ||||||||||
Attachments: |
|
Description
Kwang Yul Seo
2010-02-08 08:02:50 PST
Created attachment 48333 [details]
Patch
ShellUtilBrew.h is currently under wtf/brew, but I am not sure if this is the right place to put platform-specific utility functions.
(In reply to comment #1) > ShellUtilBrew.h is currently under wtf/brew, but I am not sure if this is the > right place to put platform-specific utility functions. It’s the right directory for low-level functions of this type. But “utility” is not a word we ever use, and we certainly frown on “Util” in a file name. Created attachment 48338 [details]
Patch
Remove Util from the filename and prefix the function with shell
createInstanceBrew -> shellCreateInstanceBrew
Should this return a PassOwnPtrBrew? (In reply to comment #4) > Should this return a PassOwnPtrBrew? These is no PassOwnPtrBrew class. I just wanted to simplify the creation of a BREW instance. As OwnPtrBrew takes a raw pointer in the constructor, we can use an idiom like the following: OwnPtrBrew<IFileMgr> fileMgr(createInstanceBrew<IFileMgr>(AEECLSID_FILEMGR)); Do you suggest that this should return a PassOwnPtrBrew? > Do you suggest that this should return a PassOwnPtrBrew?
In general, createMumble methods return a PassFooBar object to ensure we don't leak the allocated memory.
Comment on attachment 48338 [details]
Patch
Why would this be part of WTF? This seems like port-specific goop.
We don't need to have PassOwnPtrBrew to approve this, but eventually it would be nice to have such a class to make leaking memory returned from this function impossible.
Created attachment 50169 [details]
Patch
Make the function return PassOwnPtr. This prevents memory leaking.
Comment on attachment 50169 [details]
Patch
LGTM.
Comment on attachment 50169 [details] Patch Clearing flags on attachment: 50169 Committed r56031: <http://trac.webkit.org/changeset/56031> All reviewed patches have been landed. Closing bug. |