Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DeviceStorage API change: be sure to keep your gecko and gaia in sync

11 views
Skip to first unread message

David Flanagan

unread,
Jan 28, 2013, 2:46:54 PM1/28/13
to <dev-gaia@lists.mozilla.org>
A DeviceStorage API change just landed in gecko b2g18, gaia master, gaia
v1.0.0 and gaia v1-train. (It landed on m-c over the weekend).

This is one of those bugs that requires synchronized changes to gecko
and gaia. If you have an old gecko and a new gaia (or vice versa) many
things will probably break. This means that if you pull the latest
version of gaia today, you'll need to build a new version of gecko.
Sorry about that! And if you build the latest gecko, you'll need to be
sure to install the latest gaia.

If you want details about the particular commits to gecko and gaia, see
https://bugzilla.mozilla.org/show_bug.cgi?id=834595

If you're interested in the API change itself, read on:

DeviceStorage used to have an async stat method that would return three
pieces of information to the caller:

1) whether the storage was available, in use (mounted by USB) or
unavailable (no sdcard)
2) how much space remained on the volume
3) how much space was used

The first two items were very quick to compute. The third one, however
was very slow because it was type specific: it had to compute how much
space was used by photos, videos, or music on the sdcard.

So the problem was that apps that just wanted to check to make sure that
the sdcard was available or that there was enough space to save a file
had to wait for stat() to compute how much space was being used.

To resolve this performance issue, stat() has been replaced with three
separate methods. Quoting Doug from the bug:
> nsIDOMDOMRequest freeSpace();
> e.target.result == free space for the given device storage object
>
>
> nsIDOMDOMRequest usedSpace();
> e.target.result == used space for the given device storage object
>
> nsIDOMDOMRequest available();
> e.target.result == same was what stat() state did.
We expect that this new API will result in noticeable improvements in
app startup times.

Dietrich Ayala

unread,
Jan 28, 2013, 6:34:30 PM1/28/13
to David Flanagan, <dev-gaia@lists.mozilla.org>
On Mon, Jan 28, 2013 at 11:46 AM, David Flanagan <dfla...@mozilla.com> wrote:
> We expect that this new API will result in noticeable improvements in app
> startup times.

YAY.

Faramarz Rashed

unread,
Jan 28, 2013, 7:09:46 PM1/28/13
to David Flanagan, <dev-gaia@lists.mozilla.org>
awesome! thanks dave! we needed changes like this across the board the make this puppy go fast!!!

faramarz
> We expect that this new API will result in noticeable improvements in app startup times.
> _______________________________________________
> dev-gaia mailing list
> dev-...@lists.mozilla.org
> https://lists.mozilla.org/listinfo/dev-gaia

Josh Carpenter

unread,
Jan 28, 2013, 7:45:33 PM1/28/13
to David Flanagan, <dev-gaia@lists.mozilla.org>
Presenting: The Further Adventures of the Amazing David Flanagan.

:D

Awesome news!


Josh Carpenter
UX Designer
Mozilla

David Flanagan

unread,
Jan 28, 2013, 7:58:25 PM1/28/13
to Josh Carpenter, <dev-gaia@lists.mozilla.org>
Thanks Dietrich, Faramarz and Josh for the positive comments on this change.

Please note that I'm mostly just the messenger here. James Lal figured
out that we could optimize startup times with this change and Doug
Turner implemented the change in gecko. I just made a few tweaks to
Gaia and sent out the email.

David

On 1/28/13 4:45 PM, Josh Carpenter wrote:
> Presenting: The Further Adventures of the Amazing David Flanagan.
>
> :D
>
> Awesome news!
>
> —
> Josh Carpenter
> UX Designer
> Mozilla
>
> On Jan 28, 2013, at 11:46 AM, David Flanagan <dfla...@mozilla.com
>> dev-...@lists.mozilla.org <mailto:dev-...@lists.mozilla.org>
>> https://lists.mozilla.org/listinfo/dev-gaia
>

Tony Chung

unread,
Jan 28, 2013, 8:43:00 PM1/28/13
to David Flanagan, <dev-gaia@lists.mozilla.org>, Josh Carpenter
hi david,

besides the obvious gecko/gaia breaking if out of sync, what types of regressions or risky changes should QA be looking for here? perhaps mathematical miscalculations?

Thanks,
Tony
> https://lists.mozilla.org/listinfo/dev-gaia

Doug Turner

unread,
Jan 28, 2013, 8:42:58 PM1/28/13
to dev-...@lists.mozilla.org
James is the hero. I just type.

Doug Turner

unread,
Jan 28, 2013, 8:46:49 PM1/28/13
to dev-...@lists.mozilla.org
On 1/28/13 5:43 PM, Tony Chung wrote:
> hi david,
>
> besides the obvious gecko/gaia breaking if out of sync, what types of regressions or risky changes should QA be looking for here? perhaps mathematical miscalculations?

There were only 12 or so call sites that used the old API. We switched
most of them to a new faster API. The change on the gaia side was
mechanical. The change to gecko was mostly plumbing. So, basically
anything that dealt with device storage could be busted. If things were
broken, I'd imagine bugs like "pictures not showing up in gallery" and
"bad things happen when I remove the sdcard while using the music player".

Hope this helps.

0 new messages