RESOLVED FIXED 112862
IndexedDB: Histogram available disk space on attempt to open database
https://bugs.webkit.org/show_bug.cgi?id=112862
Summary IndexedDB: Histogram available disk space on attempt to open database
David Grogan
Reported 2013-03-20 17:48:35 PDT
IndexedDB: Histogram available disk space on attempt to open database
Attachments
Patch (4.29 KB, patch)
2013-03-20 17:55 PDT, David Grogan
no flags
Patch (4.55 KB, patch)
2013-03-20 17:57 PDT, David Grogan
no flags
Patch (4.61 KB, patch)
2013-03-20 18:05 PDT, David Grogan
no flags
Patch (4.57 KB, patch)
2013-03-20 18:24 PDT, David Grogan
no flags
Patch (4.71 KB, patch)
2013-03-21 16:09 PDT, David Grogan
no flags
Patch (4.70 KB, patch)
2013-03-21 22:15 PDT, David Grogan
no flags
David Grogan
Comment 1 2013-03-20 17:55:33 PDT
David Grogan
Comment 2 2013-03-20 17:57:58 PDT
WebKit Review Bot
Comment 3 2013-03-20 18:01:19 PDT
Please wait for approval from abarth@webkit.org, dglazkov@chromium.org, fishd@chromium.org, jamesr@chromium.org or tkent@chromium.org before submitting, as this patch contains changes to the Chromium public API. See also https://trac.webkit.org/wiki/ChromiumWebKitAPI.
David Grogan
Comment 4 2013-03-20 18:05:28 PDT
David Grogan
Comment 5 2013-03-20 18:07:06 PDT
As written, this patch requires https://code.google.com/p/chromium/issues/detail?id=222432 to land in chromium first.
David Grogan
Comment 6 2013-03-20 18:16:13 PDT
Josh/Alec, could you give this a look?
David Grogan
Comment 7 2013-03-20 18:24:01 PDT
Joshua Bell
Comment 8 2013-03-21 10:13:40 PDT
lgtm
David Grogan
Comment 9 2013-03-21 13:23:26 PDT
WebKit API reviewers - r?
Adam Barth
Comment 10 2013-03-21 13:28:21 PDT
Comment on attachment 194160 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=194160&action=review > Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:146 > +static void HistogramFreeSpace(const char* type, String fileName) HistogramFreeSpace -> histogramFreeSpace > Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:149 > + String name = String::format("WebCore.IndexedDB.LevelDB.Open%sFreeDiskSpace", type); You should just use operator+ on String. It's faster. > Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:156 > + HistogramSupport::histogramCustomCounts(name.utf8().data(), clampedDiskSpaceKBytes, 1, 1e9, 11); Should we COMPILE_ASSERT a relationship between 1e9 and INT_MAX?
Adam Barth
Comment 11 2013-03-21 13:28:57 PDT
Comment on attachment 194160 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=194160&action=review > Source/Platform/chromium/public/Platform.h:363 > + virtual long long availableDiskSpaceInBytes(const WebString& fileName) { return 0; } Is this a blocking call? Is there a restriction on calling this function from the main thread?
David Grogan
Comment 12 2013-03-21 16:09:35 PDT
David Grogan
Comment 13 2013-03-21 16:09:54 PDT
Comment on attachment 194160 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=194160&action=review >> Source/Platform/chromium/public/Platform.h:363 >> + virtual long long availableDiskSpaceInBytes(const WebString& fileName) { return 0; } > > Is this a blocking call? Is there a restriction on calling this function from the main thread? It does block and probably shouldn't be called from the main thread. Chromium only calls it from the browser process's WebKit thread (aka IndexedDB thread). Is there a way to enforce non-main-thread usage in other ports? >> Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:146 >> +static void HistogramFreeSpace(const char* type, String fileName) > > HistogramFreeSpace -> histogramFreeSpace Done. >> Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:149 >> + String name = String::format("WebCore.IndexedDB.LevelDB.Open%sFreeDiskSpace", type); > > You should just use operator+ on String. It's faster. Done, but semi-awkwardly. >> Source/WebCore/platform/leveldb/LevelDBDatabase.cpp:156 >> + HistogramSupport::histogramCustomCounts(name.utf8().data(), clampedDiskSpaceKBytes, 1, 1e9, 11); > > Should we COMPILE_ASSERT a relationship between 1e9 and INT_MAX? Done, though again semi-awkwardly.
David Grogan
Comment 14 2013-03-21 16:14:03 PDT
Comment on attachment 194372 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=194372&action=review > Source/Platform/chromium/public/Platform.h:363 > + virtual long long availableDiskSpaceInBytes(const WebString& fileName) { return 0; } I said "other ports" forgetting that this platform layer is only available to chromium. Should I put ASSERT(!isMainThread()) somewhere or just leave as is?
Adam Barth
Comment 15 2013-03-21 16:16:05 PDT
(In reply to comment #14) > (From update of attachment 194372 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=194372&action=review > > > Source/Platform/chromium/public/Platform.h:363 > > + virtual long long availableDiskSpaceInBytes(const WebString& fileName) { return 0; } > > I said "other ports" forgetting that this platform layer is only available to chromium. Should I put ASSERT(!isMainThread()) somewhere or just leave as is? We should probably leave it as-is. I suspect we set the "main thread" bit on the in-process WebKit thread.
Adam Barth
Comment 16 2013-03-21 16:16:26 PDT
Comment on attachment 194372 [details] Patch Thanks!
David Grogan
Comment 17 2013-03-21 16:29:57 PDT
(Want to wait until the platformsupport implementation lands so that I don't get confused about unexpected zeros showing up in the histogram)
WebKit Review Bot
Comment 18 2013-03-21 21:05:52 PDT
Comment on attachment 194372 [details] Patch Clearing flags on attachment: 194372 Committed r146560: <http://trac.webkit.org/changeset/146560>
WebKit Review Bot
Comment 19 2013-03-21 21:05:58 PDT
All reviewed patches have been landed. Closing bug.
David Grogan
Comment 20 2013-03-21 22:01:01 PDT
Reverted r146560 for reason: invalid parameter to histogram Committed r146561: <http://trac.webkit.org/changeset/146561>
David Grogan
Comment 21 2013-03-21 22:15:25 PDT
David Grogan
Comment 22 2013-03-21 22:20:29 PDT
Adam, could I get you to re-review? The only change is on Line 152. "1, 1" became "1, 2" because the boundary is supposed to be higher than the minimum, not equal to it[1]. Untested code == broken code, indeed. 1. https://code.google.com/p/chromium/codesearch#chromium/src/base/metrics/histogram.h&sq=package:chromium&type=cs&l=25
David Grogan
Comment 23 2013-03-21 23:13:42 PDT
Tony, could you review this? It looks like Adam just left for vacation. It has WebKit API in it, but abarth@ has already approved that part. History is: r+ from abarth committed rolled out fixed non webkit-api and reuploaded now
Tony Chang
Comment 24 2013-03-22 10:29:57 PDT
Comment on attachment 194442 [details] Patch OK
WebKit Review Bot
Comment 25 2013-03-22 10:36:46 PDT
Comment on attachment 194442 [details] Patch Clearing flags on attachment: 194442 Committed r146628: <http://trac.webkit.org/changeset/146628>
WebKit Review Bot
Comment 26 2013-03-22 10:36:51 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.