[Webkit-unassigned] [Bug 34912] audio engine: add ReverbConvolver class

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 23 12:46:20 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=34912





--- Comment #23 from Chris Rogers <crogers at google.com>  2010-03-23 12:46:20 PST ---
(In reply to comment #21)
> (In reply to comment #19)
> > Hi Jeremy, I've addressed most of your comments.  Here are my comments about
> > the others:
> > 
> > >Always use ___Ptr's as member and automatic/local variables.  Use Pass___Ptr's
> > >as method parameters and return values.  You might want to re-read the
> > >PassRefPtr doc (just google that word) if you don't understand why.
> > 
> > I've found that this can work with RefPtr, but not with OwnPtr (won't compile).
> >  It looks like in the case of OwnPtr, it's not reference counted and you can't
> > assign from one OwnPtr to another.  The current code does the right thing, but
> > another option is to just forget the PassOwnPtr and use a straight pointer as
> > the local variable.  It gets appended to a Vector<OwnPtr<> > so the memory
> > management is handled.
> 
> The point of the OwnPtr is that it'll get deleted if you go out of scope.  I
> don't know what you're doing wrong here, but there are a LOT of examples in the
> code of how to do this properly.  Make sure you have PassOwnPtr.h included in
> the file.  It should know how to convert stuff from an OwnPtr to a PassOwnPtr.

I had Dimitri take a look and he's pretty sure it's not possible to do this in
this particular case.  I've created a simple test case to illustrate how this
won't compile:

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class Test {
public:
    Test() { printf("%p: Test::Test()\n", this); }
    ~Test() { printf("%p: Test::~Test()\n", this); }
};

Vector<OwnPtr<Test> > testList;

void test()
{
    OwnPtr<Test> p(new Test());  // <------------ WON'T COMPILE
    testList.append(p);
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you change the test() function to be:

void test()
{
    Test* p = new Test(); // < ---- WILL COMPILE
    testList.append(p);
}

Then it *will* compile.  The issue is that you cannot assign from one OwnPtr to
another OwnPtr, and this is what is happening when you call the append()
method.  Please have a close look at the exact usage in my code - thanks.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list