Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(790)

Side by Side Diff: chrome/browser/history/download_database.h

Issue 10823203: Fix downloads db state=3 corruption using version=23 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_ 5 #ifndef CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_ 6 #define CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // all downloads that are in progress or are waiting to be cancelled. 63 // all downloads that are in progress or are waiting to be cancelled.
64 bool RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); 64 bool RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
65 65
66 protected: 66 protected:
67 // Returns the database for the functions in this interface. 67 // Returns the database for the functions in this interface.
68 virtual sql::Connection& GetDB() = 0; 68 virtual sql::Connection& GetDB() = 0;
69 69
70 // Returns the meta-table object for the functions in this interface. 70 // Returns the meta-table object for the functions in this interface.
71 virtual sql::MetaTable& GetMetaTable() = 0; 71 virtual sql::MetaTable& GetMetaTable() = 0;
72 72
73 // Returns true if able to successfully rewrite the invalid values for the
74 // |state| field from 3 to 4. Returns false if there was an error fixing the
75 // database. See http://crbug.com/140687
76 bool MigrateDownloadsState();
77
73 // Creates the downloads table if needed. 78 // Creates the downloads table if needed.
74 bool InitDownloadTable(); 79 bool InitDownloadTable();
75 80
76 // Used to quickly clear the downloads. First you would drop it, then you 81 // Used to quickly clear the downloads. First you would drop it, then you
77 // would re-initialize it. 82 // would re-initialize it.
78 bool DropDownloadTable(); 83 bool DropDownloadTable();
79 84
80 private: 85 private:
81 // TODO(rdsmith): Remove after http://crbug.com/96627 has been resolved. 86 // TODO(rdsmith): Remove after http://crbug.com/96627 has been resolved.
82 void CheckThread(); 87 void CheckThread();
83 88
84 bool EnsureColumnExists(const std::string& name, const std::string& type); 89 bool EnsureColumnExists(const std::string& name, const std::string& type);
85 90
86 bool owning_thread_set_; 91 bool owning_thread_set_;
87 base::PlatformThreadId owning_thread_; 92 base::PlatformThreadId owning_thread_;
88 93
89 int next_id_; 94 int next_id_;
90 int next_db_handle_; 95 int next_db_handle_;
91 96
92 DISALLOW_COPY_AND_ASSIGN(DownloadDatabase); 97 DISALLOW_COPY_AND_ASSIGN(DownloadDatabase);
93 }; 98 };
94 99
95 } // namespace history 100 } // namespace history
96 101
97 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_ 102 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_item_model.cc ('k') | chrome/browser/history/download_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698