• John Delaney's avatar
    [conversions] Lazily create and open sql database · e0ce4141
    John Delaney authored
    What: Defer creation/opening of the sql database until there is a
    storage operation which needs it.
    
    Why: We unconditionally create the database for every storage partition
    whether the API is being used which is unnecessary. This has the added
    benefit of not forcing the database to be initialized in every
    browsertest once  the feature is enabled by default.
    
    How: Use the presence of the database file as a signal for creation.
    If the file path doesn't exist, we can defer creation until an
    impression is stored. No other operations need to create the database
    as it is empty and would be a no-op regardless.
    
    If the database path does exist, we defer opening the database until
    any operation is called, as there may be conversions that need to be
    sent or impression to convert etc.
    
    Change-Id: I25446805a991f04fcbf9aa237195950d055558aa
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2360471
    Commit-Queue: John Delaney <johnidel@chromium.org>
    Reviewed-by: default avatarCharlie Harrison <csharrison@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#799370}
    e0ce4141
conversion_storage_sql.h 4.07 KB