Bug 124819 - DatabaseProcess: Add "UniqueIDBDatabase" that multiple WebProcesses can connect to
Summary: DatabaseProcess: Add "UniqueIDBDatabase" that multiple WebProcesses can conne...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Brady Eidson
URL:
Keywords:
Depends on:
Blocks: 124521
  Show dependency treegraph
 
Reported: 2013-11-24 12:30 PST by Brady Eidson
Modified: 2013-11-24 16:19 PST (History)
14 users (show)

See Also:


Attachments
Patch v1 (35.24 KB, patch)
2013-11-24 12:41 PST, Brady Eidson
eflews.bot: commit-queue-
Details | Formatted Diff | Diff
Patch v2 - Fix includes leftover from a stash merge. (34.79 KB, patch)
2013-11-24 13:26 PST, Brady Eidson
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brady Eidson 2013-11-24 12:30:52 PST
DatbaseProcess: Add "UniquedIDBDatabase" that multiple WebProcesses can connect to
Comment 1 Brady Eidson 2013-11-24 12:41:28 PST
Created attachment 217764 [details]
Patch v1
Comment 2 EFL EWS Bot 2013-11-24 12:55:08 PST
Comment on attachment 217764 [details]
Patch v1

Attachment 217764 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/35328266
Comment 3 Brady Eidson 2013-11-24 13:26:16 PST
Created attachment 217765 [details]
Patch v2 - Fix includes leftover from a stash merge.
Comment 4 mitz 2013-11-24 13:47:39 PST
Comment on attachment 217765 [details]
Patch v2 - Fix includes leftover from a stash merge.

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

> Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp:81
> +    RefPtr<UniqueIDBDatabase> database = m_idbDatabases.get(identifier);
> +    if (database)
> +        return database;
> +
> +    database = UniqueIDBDatabase::create(identifier);
> +    m_idbDatabases.set(identifier, database);
> +
> +    return database.release();

Is there a way to do this without hashing twice in the not-found case? I think there is (using HashMap::find).

> Source/WebKit2/DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.h:70
> +    UniqueIDBDatabaseIdentifier m_databaseIdentifier;

Why do we need this as a member variable here and can’t rely on getting the identifier from the m_uniqueIDBDatabase member?

> Source/WebKit2/DatabaseProcess/IndexedDB/UniqueIDBDatabaseIdentifier.h:58
> +    mutable String m_identifierString;

This doesn’t appear to be used.
Comment 5 Brady Eidson 2013-11-24 15:10:32 PST
http://trac.webkit.org/changeset/159737
Comment 6 Darin Adler 2013-11-24 16:19:47 PST
Comment on attachment 217765 [details]
Patch v2 - Fix includes leftover from a stash merge.

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

>> Source/WebKit2/DatabaseProcess/DatabaseProcess.cpp:81
>> +    RefPtr<UniqueIDBDatabase> database = m_idbDatabases.get(identifier);
>> +    if (database)
>> +        return database;
>> +
>> +    database = UniqueIDBDatabase::create(identifier);
>> +    m_idbDatabases.set(identifier, database);
>> +
>> +    return database.release();
> 
> Is there a way to do this without hashing twice in the not-found case? I think there is (using HashMap::find).

Here’s a good way to write it without hashing twice:

    RefPtr<UniqueIDDatabase>& database = m_idbDatabases.add(identifier, nullptr).iterator->value;
    if (!database)
        database = UniqueIDBDatabase::create(identifier);
    return database;

We use this idiom a lot.

> Source/WebKit2/DatabaseProcess/IndexedDB/DatabaseProcessIDBConnection.cpp:66
> +    m_databaseIdentifier = std::move(UniqueIDBDatabaseIdentifier(databaseName, openingOrigin, mainFrameOrigin));

I don’t think this std::move is needed or helpful.