Bug 90713

Summary: Consider closing unused localStorage database after a timeout.
Product: WebKit Reporter: Yongjun Zhang <yongjun_zhang>
Component: WebCore Misc.Assignee: Yongjun Zhang <yongjun_zhang>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, ddkilzer, dglazkov, gustavo, jer.noble, laszlo.gombos, philn, rakuco, rniwa, webkit.review.bot, xan.lopez, yongjun_zhang
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
close unused sqlite db after 300 seconds.
gyuyoung.kim: commit-queue-
Fix build and style issues.
none
Fix more style issues.
beidson: review-
Addressing review comments.
beidson: review+, webkit.review.bot: commit-queue-
Reviewed patch for commit. none

Description Yongjun Zhang 2012-07-06 16:48:34 PDT
We should consider closing the underlying sqlite database if there is no active document referencing it.  We can do this after a timeout to avoid closing and opening the same database too often, e.g., when user is doing back/forward navigation.
Comment 1 Yongjun Zhang 2012-07-06 17:30:07 PDT
Created attachment 151124 [details]
close unused sqlite db after 300 seconds.
Comment 2 WebKit Review Bot 2012-07-06 17:33:48 PDT
Attachment 151124 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/plat..." exit_code: 1
Source/WebCore/storage/StorageAreaImpl.cpp:277:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 1 in 20 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Gyuyoung Kim 2012-07-06 17:36:38 PDT
Comment on attachment 151124 [details]
close unused sqlite db after 300 seconds.

Attachment 151124 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/13156263
Comment 4 WebKit Review Bot 2012-07-06 17:41:38 PDT
Comment on attachment 151124 [details]
close unused sqlite db after 300 seconds.

Attachment 151124 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13151498
Comment 5 Build Bot 2012-07-06 17:55:26 PDT
Comment on attachment 151124 [details]
close unused sqlite db after 300 seconds.

Attachment 151124 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/13157247
Comment 6 Yongjun Zhang 2012-07-06 22:00:08 PDT
Created attachment 151131 [details]
Fix build and style issues.
Comment 7 WebKit Review Bot 2012-07-06 22:04:35 PDT
Attachment 151131 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/plat..." exit_code: 1
Tools/ChangeLog:3:  Line contains tab character.  [whitespace/tab] [5]
Tools/ChangeLog:4:  Line contains tab character.  [whitespace/tab] [5]
Tools/ChangeLog:6:  Line contains tab character.  [whitespace/tab] [5]
Tools/ChangeLog:7:  Line contains tab character.  [whitespace/tab] [5]
Tools/ChangeLog:9:  Line contains tab character.  [whitespace/tab] [5]
Tools/DumpRenderTree/win/LayoutTestControllerWin.cpp:1489:  Tab found; better to use spaces  [whitespace/tab] [1]
Source/WebCore/storage/StorageAreaImpl.cpp:279:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Source/WebCore/storage/StorageArea.h:59:  Missing space inside { }.  [whitespace/braces] [5]
Source/WebCore/storage/StorageArea.h:60:  Missing space inside { }.  [whitespace/braces] [5]
Total errors found: 9 in 23 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Yongjun Zhang 2012-07-06 22:12:48 PDT
Created attachment 151132 [details]
Fix more style issues.
Comment 9 Simon Fraser (smfr) 2012-07-09 10:11:33 PDT
Comment on attachment 151132 [details]
Fix more style issues.

View in context: https://bugs.webkit.org/attachment.cgi?id=151132&action=review

> Source/WebCore/storage/StorageAreaImpl.cpp:277
> +    --m_accessCount;

This should assert that it doesn't go negative.
Comment 10 Brady Eidson 2012-07-09 10:34:47 PDT
Comment on attachment 151132 [details]
Fix more style issues.

View in context: https://bugs.webkit.org/attachment.cgi?id=151132&action=review

Let's go one more pass

> Source/WebCore/storage/StorageTracker.cpp:51
> +// If there is no document referecing a storage database, close the underlying database
> +// after it has been idle for s_StorageDatabaseIdleInterval seconds.
> +static const double StorageDatabaseIdleInterval = 300;

typo "referecing"

s_StorageDatabaseIdleInterval should be m_StorageDatabaseIdleInterval?

And StorageDatabaseIdleInterval should be "DefaultStorageDatabaseIdleInterval"
Comment 11 Yongjun Zhang 2012-07-09 12:12:07 PDT
Created attachment 151293 [details]
Addressing review comments.
Comment 12 WebKit Review Bot 2012-07-09 16:09:58 PDT
Comment on attachment 151293 [details]
Addressing review comments. 

Rejecting attachment 151293 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '-..." exit_code: 1

ERROR: /mnt/git/webkit-commit-queue/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).

Full output: http://queues.webkit.org/results/13165455
Comment 13 Yongjun Zhang 2012-07-09 17:05:50 PDT
Created attachment 151359 [details]
Reviewed patch for commit.
Comment 14 WebKit Review Bot 2012-07-09 18:03:55 PDT
Comment on attachment 151359 [details]
Reviewed patch for commit.

Clearing flags on attachment: 151359

Committed r122174: <http://trac.webkit.org/changeset/122174>
Comment 15 WebKit Review Bot 2012-07-09 18:04:01 PDT
All reviewed patches have been landed.  Closing bug.
Comment 16 Ryosuke Niwa 2012-07-09 18:35:25 PDT
Build fix landed in http://trac.webkit.org/changeset/122177.
Comment 17 Jer Noble 2012-07-19 12:47:53 PDT
This patch added no support for testRunner.setStorageDatabaseIdleInterval() on WK2.  Thus, this new test is failing on all WK2 ports.