Bug 66548
Summary: | check-webkit-style should allow out RefPtr parameters | ||
---|---|---|---|
Product: | WebKit | Reporter: | Pavel Feldman <pfeldman> |
Component: | Tools / Tests | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED DUPLICATE | ||
Severity: | Normal | CC: | abarth, darin, eric, levin |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Pavel Feldman
Source/WebCore/inspector/InspectorDOMAgent.h:131: The parameter type should use PassRefPtr instead of RefPtr. [readability/pass_ptr] [5]
Attachments | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Eric Seidel (no email)
http://trac.webkit.org/browser/trunk/Source/WebCore/inspector/InspectorDOMAgent.h#L131
Eric Seidel (no email)
void getAttributes(ErrorString*, int nodeId, RefPtr<InspectorArray>* result);
Eric Seidel (no email)
I think other parts of the code would write that as a reference instead of a pointer. Or they'd return a PassRefPtr from the method itself.
Also, "get" is not normally used in method names, except where dictated by the DOM api.
I'm not sure if there is a bug here.
Darin Adler
(In reply to comment #3)
> I think other parts of the code would write that as a reference instead of a pointer. Or they'd return a PassRefPtr from the method itself.
Yes.
> Also, "get" is not normally used in method names, except where dictated by the DOM api.
I disagree; get is correctly used here to indicate a function that uses an out argument rather than a function result.
But as Eric says, in this case there is no obvious reason for use of an out argument for a single function result. Returning a PassRefPtr is the idiom for this sort of thing.
Pavel Feldman
> But as Eric says, in this case there is no obvious reason for use of an out argument for a single function result. Returning a PassRefPtr is the idiom for this sort of thing.
This is a part of the inspector protocol, methods on the agents are called from the generated dispatcher. Generator was treating RefPtr as the rest of the types, using raw pointers for all out parameters. We'll change it to:
void getAttributes(ErrorString*, int nodeId, RefPtr&<InspectorArray> result);
to address this warning under https://bugs.webkit.org/show_bug.cgi?id=69366.
David Levin
I missed this when I fixed it, so I'l just resolve this as a duplicate of the bug that I fixed for this.
If you're still get style errors about this, either let me know or feel free to submit a fix. (It should be trivial especially when you see my previous fix.)
*** This bug has been marked as a duplicate of bug 67797 ***