Index: net/extras/sqlite/sqlite_channel_id_store.cc |
diff --git a/net/extras/sqlite/sqlite_channel_id_store.cc b/net/extras/sqlite/sqlite_channel_id_store.cc |
index 56c6f6b9c03c52e8ffc08da9e5f8d8864d2c9cef..580b309c576330ac1909fb5251f91352082a85ba 100644 |
--- a/net/extras/sqlite/sqlite_channel_id_store.cc |
+++ b/net/extras/sqlite/sqlite_channel_id_store.cc |
@@ -100,6 +100,9 @@ class SQLiteChannelIDStore::Backend |
void SetForceKeepSessionState(); |
+ // Commit our pending operations to the database. |
+ void Commit(); |
+ |
private: |
friend class base::RefCountedThreadSafe<SQLiteChannelIDStore::Backend>; |
@@ -143,8 +146,6 @@ class SQLiteChannelIDStore::Backend |
// identifier in |server_identifiers|. |
void PrunePendingOperationsForDeletes( |
const std::list<std::string>& server_identifiers); |
- // Commit our pending operations to the database. |
- void Commit(); |
// Close() executed on the background task runner. |
void InternalBackgroundClose(); |
@@ -481,17 +482,10 @@ void SQLiteChannelIDStore::Backend::DeleteAllInList( |
void SQLiteChannelIDStore::Backend::BatchOperation( |
PendingOperation::OperationType op, |
const DefaultChannelIDStore::ChannelID& channel_id) { |
- // These thresholds used to be 30 seconds or 512 outstanding operations (the |
- // same values used in CookieMonster). Since cookies can be bound to Channel |
- // IDs, it's possible for a cookie to get committed to the cookie database |
- // before the Channel ID it is bound to gets committed. Decreasing these |
- // thresholds increases the chance that the Channel ID will be committed |
- // before or at the same time as the cookie. |
- |
- // Commit every 2 seconds. |
- static const int kCommitIntervalMs = 2 * 1000; |
- // Commit right away if we have more than 3 outstanding operations. |
- static const size_t kCommitAfterBatchSize = 3; |
+ // Commit every 30 seconds. |
+ static const int kCommitIntervalMs = 30 * 1000; |
+ // Commit right away if we have more than 512 outstanding operations. |
+ static const size_t kCommitAfterBatchSize = 512; |
// We do a full copy of the cert here, and hopefully just here. |
std::unique_ptr<PendingOperation> po(new PendingOperation(op, channel_id)); |
@@ -687,6 +681,10 @@ void SQLiteChannelIDStore::SetForceKeepSessionState() { |
backend_->SetForceKeepSessionState(); |
} |
+void SQLiteChannelIDStore::Flush() { |
+ backend_->Commit(); |
+} |
+ |
SQLiteChannelIDStore::~SQLiteChannelIDStore() { |
backend_->Close(); |
// We release our reference to the Backend, though it will probably still have |