summaryrefslogtreecommitdiffstats
path: root/components/test
diff options
context:
space:
mode:
authorasanka <asanka@chromium.org>2016-03-14 14:23:11 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-14 21:24:56 +0000
commiteef62b0282ec19ebc040785d0b7ac36de398cbc1 (patch)
tree63ae61a479d8e411e1e1313dfd17401499138ef6 /components/test
parent434d59f2d742f4378d03a8cc3d1f1e2326883744 (diff)
downloadchromium_src-eef62b0282ec19ebc040785d0b7ac36de398cbc1.zip
chromium_src-eef62b0282ec19ebc040785d0b7ac36de398cbc1.tar.gz
chromium_src-eef62b0282ec19ebc040785d0b7ac36de398cbc1.tar.bz2
[Downloads] Introduce GUIDs for downloads.
Chrome on Android and extensions attempt to keep references to downloads across browser sessions using download IDs. This isn't safe since a subsequent browser session could reuse a download ID to refer to a different download. In order to provide a weak cross-session reference, this CL introduces GUIDs. At worst, attempting to lookup a download via a GUID will fail rather than end up referring to a different download. This assumes that there will not be any conflicts among the GUIDs, which is apparently a safe assumption to make. This CL includes the following changes: * Introduce a GetGuid() method to DownloadItem and its subclasses. * Allow DownloadItemImpl to create a new GUID for itself for new downloads using base::GenerateGuid(). * Store and retrieve GUIDs from downloads history for persisted downloads. * Generate GUIDs for downloads in the history DB which are being migrated due to a browser upgrade. * Since we are revving the history DB schema, also adds the fields for HTTP method and hash fields. Note that in order to keep the size of the CL sane, code for incorporating HTTP method and hash into the downloads system is not included in this CL. The latter is https://codereview.chromium.org/1751603002 . BUG=593020 Review URL: https://codereview.chromium.org/1781983002 Cr-Commit-Position: refs/heads/master@{#381071}
Diffstat (limited to 'components/test')
-rw-r--r--components/test/data/history/history.29.sql25
1 files changed, 25 insertions, 0 deletions
diff --git a/components/test/data/history/history.29.sql b/components/test/data/history/history.29.sql
new file mode 100644
index 0000000..7161163
--- /dev/null
+++ b/components/test/data/history/history.29.sql
@@ -0,0 +1,25 @@
+PRAGMA foreign_keys=OFF;
+BEGIN TRANSACTION;
+CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR);
+INSERT INTO "meta" VALUES('version','29');
+INSERT INTO "meta" VALUES('last_compatible_version','16');
+CREATE TABLE urls(id INTEGER PRIMARY KEY,url LONGVARCHAR,title LONGVARCHAR,visit_count INTEGER DEFAULT 0 NOT NULL,typed_count INTEGER DEFAULT 0 NOT NULL,last_visit_time INTEGER NOT NULL,hidden INTEGER DEFAULT 0 NOT NULL,favicon_id INTEGER DEFAULT 0 NOT NULL);
+CREATE TABLE visits(id INTEGER PRIMARY KEY,url INTEGER NOT NULL,visit_time INTEGER NOT NULL,from_visit INTEGER,transition INTEGER DEFAULT 0 NOT NULL,segment_id INTEGER,visit_duration INTEGER DEFAULT 0 NOT NULL);
+CREATE TABLE visit_source(id INTEGER PRIMARY KEY,source INTEGER NOT NULL);
+CREATE TABLE keyword_search_terms (keyword_id INTEGER NOT NULL,url_id INTEGER NOT NULL,lower_term LONGVARCHAR NOT NULL,term LONGVARCHAR NOT NULL);
+CREATE TABLE downloads (id INTEGER PRIMARY KEY,current_path LONGVARCHAR NOT NULL,target_path LONGVARCHAR NOT NULL,start_time INTEGER NOT NULL,received_bytes INTEGER NOT NULL,total_bytes INTEGER NOT NULL,state INTEGER NOT NULL,danger_type INTEGER NOT NULL, interrupt_reason INTEGER NOT NULL,end_time INTEGER NOT NULL,opened INTEGER NOT NULL,referrer VARCHAR NOT NULL,by_ext_id VARCHAR NOT NULL,by_ext_name VARCHAR NOT NULL,etag VARCHAR NOT NULL,last_modified VARCHAR NOT NULL, mime_type VARCHAR NOT NULL, original_mime_type VARCHAR NOT NULL);
+CREATE TABLE downloads_url_chains (id INTEGER NOT NULL,chain_index INTEGER NOT NULL,url LONGVARCHAR NOT NULL, PRIMARY KEY (id, chain_index) );
+CREATE TABLE segments (id INTEGER PRIMARY KEY,name VARCHAR,url_id INTEGER NON NULL);
+CREATE TABLE segment_usage (id INTEGER PRIMARY KEY,segment_id INTEGER NOT NULL,time_slot INTEGER NOT NULL,visit_count INTEGER DEFAULT 0 NOT NULL);
+CREATE INDEX visits_url_index ON visits (url);
+CREATE INDEX visits_from_index ON visits (from_visit);
+CREATE INDEX visits_time_index ON visits (visit_time);
+CREATE INDEX segments_name ON segments(name);
+CREATE INDEX segments_url_id ON segments(url_id);
+CREATE INDEX segment_usage_time_slot_segment_id ON segment_usage(time_slot, segment_id);
+CREATE INDEX segments_usage_seg_id ON segment_usage(segment_id);
+CREATE INDEX urls_url_index ON urls (url);
+CREATE INDEX keyword_search_terms_index1 ON keyword_search_terms (keyword_id, lower_term);
+CREATE INDEX keyword_search_terms_index2 ON keyword_search_terms (url_id);
+CREATE INDEX keyword_search_terms_index3 ON keyword_search_terms (term);
+COMMIT;