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

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

Issue 9592026: Create meta table atomically. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 #pragma once 7 #pragma once
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Remove all completed downloads that started after |remove_begin| 57 // Remove all completed downloads that started after |remove_begin|
58 // (inclusive) and before |remove_end|. You may use null Time values 58 // (inclusive) and before |remove_end|. You may use null Time values
59 // to do an unbounded delete in either direction. This function ignores 59 // to do an unbounded delete in either direction. This function ignores
60 // all downloads that are in progress or are waiting to be cancelled. 60 // all downloads that are in progress or are waiting to be cancelled.
61 bool RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end); 61 bool RemoveDownloadsBetween(base::Time remove_begin, base::Time remove_end);
62 62
63 protected: 63 protected:
64 // Returns the database for the functions in this interface. 64 // Returns the database for the functions in this interface.
65 virtual sql::Connection& GetDB() = 0; 65 virtual sql::Connection& GetDB() = 0;
66 66
67 // Returns the meta-table object for the functions in this interface.
68 virtual sql::MetaTable& GetMetaTable() = 0;
69
67 // Creates the downloads table if needed. 70 // Creates the downloads table if needed.
68 bool InitDownloadTable(); 71 bool InitDownloadTable();
69 72
70 // Used to quickly clear the downloads. First you would drop it, then you 73 // Used to quickly clear the downloads. First you would drop it, then you
71 // would re-initialize it. 74 // would re-initialize it.
72 bool DropDownloadTable(); 75 bool DropDownloadTable();
73 76
74 private: 77 private:
75 // TODO(rdsmith): Remove after http://crbug.com/96627 has been resolved. 78 // TODO(rdsmith): Remove after http://crbug.com/96627 has been resolved.
76 void CheckThread(); 79 void CheckThread();
77 80
78 bool EnsureColumnExists(const std::string& name, const std::string& type); 81 bool EnsureColumnExists(const std::string& name, const std::string& type);
79 82
80 bool owning_thread_set_; 83 bool owning_thread_set_;
81 base::PlatformThreadId owning_thread_; 84 base::PlatformThreadId owning_thread_;
82 85
83 int next_id_; 86 int next_id_;
84 int next_db_handle_; 87 int next_db_handle_;
85 sql::MetaTable meta_table_;
86 88
87 DISALLOW_COPY_AND_ASSIGN(DownloadDatabase); 89 DISALLOW_COPY_AND_ASSIGN(DownloadDatabase);
88 }; 90 };
89 91
90 } // namespace history 92 } // namespace history
91 93
92 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_ 94 #endif // CHROME_BROWSER_HISTORY_DOWNLOAD_DATABASE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698