[Webkit-unassigned] [Bug 43258] Implement chromium WebDeviceOrientationClient wrapper and have WebViewImpl get it from WebViewClient.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Aug 9 04:28:23 PDT 2010
--- Comment #19 from hans at chromium.org 2010-08-09 04:28:23 PST ---
(In reply to comment #18)
> (From update of attachment 63717 [details])
> + m_deviceOrientationClientProxy.set(new DeviceOrientationClientProxy(client ? client->deviceOrientationClient() : 0));
> See if you can clean up this logic a bit. It's kinda weird how we have this matrix of possibilities between whether the flag is on and whether there's a client.
Done. Always initializing m_deviceOrientationClientProxy, but only passing it on to Page is the runtime flag is set.
> + #include "PassRefPtr.h"
> + void WebDeviceOrientationController::didChangeDeviceOrientation(const WebDeviceOrientation& o)
> use a better variable name
> + delete m_clientMock;
> and set it to 0...and first do an if to see if it's already 0
Setting it to 0 after delete. Not sure why I'd need an if before delete? delete 0 just does nothing.
> and maybe you should just make a class much like PrivatePtr...make that PrivateRefPtr and then add PrivateOwnPtr? Just a thought.
Filed Bug 43709 to do that, but I don't think this patch needs to block on it?
> + m_clientMock = new WebCore::DeviceOrientationClientMock();
> Hmmm...i'm tempted to have this call reset() but I guess the constructor doesn't set it to 0 before calling it...so that's not possible. I guess leave it as is.
> + return lastOrientation ? new WebDeviceOrientation(lastOrientation) : 0;
> Hmmm....this should probably just pass back the object, not a pointer to it. But the problem is that there might not be a last orientation. Hmmmm....maybe you shoudl add an invalid/null state to the WebDO class? This is what we've done for serializedScriptValue and a couple others where a null refPtr has semantic meaning. Not sure about this, but I think it's better than passing around pointers when we don't absolutely have to.
Adding null state to WebDeviceOrientation and having WebDOClient::lastOrientation() return an object rather than a pointer.
> + m_canProvideGamma = o->canProvideGamma();
> what about the actual gamma value?
> + m_canProvideGamma(o->canProvideGamma())
> + #include "RefPtr.h"
> ditto ditto ditto
> + if (!m_client)
> add fixme about getting rid of these null checks once it's enabled by default
> + OwnPtr<WebDeviceOrientation> lastWebOrientation(m_client->lastOrientation());
> Hmmm...this probably needs to be a refPtr in WebCore.
This is obsolete now that WebDOClient::lastOrientation() returns an object instead of a pointer.
> + m_lastOrientation = *lastWebOrientation;
> Why are we caching it here? I guess because it was an own ptr? Well, we should def make it ref.
That's an unpleasant detail. DeviceOrientation::lastOrientation() is expected to return a raw pointer to a DeviceOrientation object, which is reference counted.
The problem is we create the DeviceOrientation object from the WebDeviceOrientation object, and if we don't hold a reference to it ourselves, it will be destructed before our caller gets the result and puts it in a RefPtr. That's why we cache it: to hold an extra reference to it.
If this is too ugly, we should talk to Steve about changing DeviceOrientation::lastOrientation() to return a PassRefPtr.
> + : m_canProvideAlpha(canProvideAlpha),
> too many spaces in
> + }
> You probably should add methods to this for getting the values.
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