Closed Bug 692119 Opened 9 years ago Closed 9 years ago

Don't init the autocomplete database connection till the first search

Categories

(Toolkit :: Places, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla10

People

(Reporter: mak, Assigned: mak)

References

Details

(Whiteboard: [Ts])

Attachments

(1 file)

RegisterOpenPage runs really early in the browser startup, but we don't need the data till the first search.  So we may temporarily cache it till the first autocomplete search.
Attached patch patch v1.0Splinter Review
This was an easy win.
I use a local array while the connection does not exist, when it is inited for the first search I populate the temp table with the cache contents, and from that point on requests directly go the database.
Attachment #564949 - Flags: review?(dietrich)
Comment on attachment 564949 [details] [diff] [review]
patch v1.0

Review of attachment 564949 [details] [diff] [review]:
-----------------------------------------------------------------

r=me comments addressed.

::: toolkit/components/places/nsPlacesAutoComplete.js
@@ +527,3 @@
>    registerOpenPage: function PAC_registerOpenPage(aURI)
>    {
> +    if (Object.getOwnPropertyDescriptor(this, "_db").value === undefined) {

would prefer using an explicit flag or isInited helper here.
Comment on attachment 564949 [details] [diff] [review]
patch v1.0

Review of attachment 564949 [details] [diff] [review]:
-----------------------------------------------------------------

r=me comments addressed.

::: toolkit/components/places/nsPlacesAutoComplete.js
@@ +527,3 @@
>    registerOpenPage: function PAC_registerOpenPage(aURI)
>    {
> +    if (Object.getOwnPropertyDescriptor(this, "_db").value === undefined) {

would prefer using an explicit flag or isInited helper here.
Attachment #564949 - Flags: review?(dietrich) → review+
(In reply to Dietrich Ayala (:dietrich) from comment #3)
> > +    if (Object.getOwnPropertyDescriptor(this, "_db").value === undefined) {
> 
> would prefer using an explicit flag or isInited helper here.

I uses that since it's consistent with the other checks in the same file. I'll add a private _databaseInitialized getter and replaces all uses.
https://hg.mozilla.org/mozilla-central/rev/198dbe19cfaa
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in before you can comment on or make changes to this bug.