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

Unified Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 11112020: Allow multiple sql::Connection error delegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sql/connection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/sqlite_persistent_cookie_store.cc
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index 10e315328e680804d9c8884a19952b4fde14f7e3..4db5f8450ce347d8d1f3e5985d94a9d6bebdf3c4 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -75,8 +75,7 @@ class SQLitePersistentCookieStore::Backend
num_cookies_read_(0),
num_priority_waiting_(0),
total_priority_requests_(0) {
- error_delegate_ =
- new KillDatabaseErrorDelegate(this, GetErrorHandlerForCookieDb());
+ error_delegate_ = new KillDatabaseErrorDelegate(this);
}
// Creates or loads the SQLite database.
@@ -109,8 +108,7 @@ class SQLitePersistentCookieStore::Backend
class KillDatabaseErrorDelegate : public sql::ErrorDelegate {
public:
- KillDatabaseErrorDelegate(Backend* backend,
- sql::ErrorDelegate* wrapped_delegate);
+ explicit KillDatabaseErrorDelegate(Backend* backend);
// ErrorDelegate implementation.
virtual int OnError(int error,
sql::Connection* connection,
@@ -129,7 +127,6 @@ class SQLitePersistentCookieStore::Backend
// reference (Backend -> Connection -> ErrorDelegate -> Backend). Instead,
// Backend will call reset_backend() when it is going away.
Backend* backend_;
- scoped_refptr<sql::ErrorDelegate> wrapped_delegate_;
DISALLOW_COPY_AND_ASSIGN(KillDatabaseErrorDelegate);
};
@@ -285,17 +282,12 @@ class SQLitePersistentCookieStore::Backend
};
SQLitePersistentCookieStore::Backend::KillDatabaseErrorDelegate::
-KillDatabaseErrorDelegate(Backend* backend,
- sql::ErrorDelegate* wrapped_delegate)
- : backend_(backend),
- wrapped_delegate_(wrapped_delegate) {
+KillDatabaseErrorDelegate(Backend* backend)
+ : backend_(backend) {
}
int SQLitePersistentCookieStore::Backend::KillDatabaseErrorDelegate::OnError(
int error, sql::Connection* connection, sql::Statement* stmt) {
- if (wrapped_delegate_.get())
- error = wrapped_delegate_->OnError(error, connection, stmt);
-
bool delete_db = false;
switch (error) {
@@ -374,7 +366,7 @@ int SQLitePersistentCookieStore::Backend::KillDatabaseErrorDelegate::OnError(
// Avoid being called more than once. There should still be a reference to
// this ErrorDelegate in the backend, but just in case don't refer to any
// members from here forward.
- connection->set_error_delegate(wrapped_delegate_.get());
+ connection->remove_error_delegate(this);
}
return error;
« no previous file with comments | « no previous file | sql/connection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698