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

Unified Diff: content/browser/indexed_db/indexed_db_callbacks.h

Issue 2727733004: [IndexedDB] Closing mojo connections when renderer quits (Closed)
Patch Set: comments Created 3 years, 8 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 | « content/browser/indexed_db/database_impl.cc ('k') | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/indexed_db/indexed_db_callbacks.h
diff --git a/content/browser/indexed_db/indexed_db_callbacks.h b/content/browser/indexed_db/indexed_db_callbacks.h
index b72fc605e8cd53ff426a5fc3e80cafc062876907..45d9e0d25f8e5e341a8ec9c09999755c93862a8a 100644
--- a/content/browser/indexed_db/indexed_db_callbacks.h
+++ b/content/browser/indexed_db/indexed_db_callbacks.h
@@ -13,7 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "base/threading/thread_checker.h"
#include "content/browser/indexed_db/indexed_db_database_error.h"
@@ -23,6 +23,10 @@
#include "content/common/indexed_db/indexed_db_key_path.h"
#include "url/origin.h"
+namespace base {
+class SequencedTaskRunner;
+}
+
namespace content {
class IndexedDBConnection;
class IndexedDBCursor;
@@ -32,6 +36,7 @@ struct IndexedDBDatabaseMetadata;
struct IndexedDBReturnValue;
struct IndexedDBValue;
+// Expected to be constructed on IO thread and called/deleted from IDB thread.
class CONTENT_EXPORT IndexedDBCallbacks
: public base::RefCounted<IndexedDBCallbacks> {
public:
@@ -40,9 +45,10 @@ class CONTENT_EXPORT IndexedDBCallbacks
IndexedDBValue* value);
IndexedDBCallbacks(
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host,
+ base::WeakPtr<IndexedDBDispatcherHost> dispatcher_host,
const url::Origin& origin,
- ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info);
+ ::indexed_db::mojom::CallbacksAssociatedPtrInfo callbacks_info,
+ scoped_refptr<base::SequencedTaskRunner> idb_runner);
virtual void OnError(const IndexedDBDatabaseError& error);
@@ -106,18 +112,19 @@ class CONTENT_EXPORT IndexedDBCallbacks
class IOThreadHelper;
- // Originally from IndexedDBCallbacks:
- scoped_refptr<IndexedDBDispatcherHost> dispatcher_host_;
+ // Stores if this callbacks object is complete and should not be called again.
+ bool complete_ = false;
- // IndexedDBDatabase callbacks ------------------------
- url::Origin origin_;
- bool database_sent_ = false;
+ // Depending on whether the database needs upgrading, we create connections in
+ // different spots. This stores if we've already created the connection so
+ // OnSuccess(Connection) doesn't create an extra one.
+ bool connection_created_ = false;
// Used to assert that OnSuccess is only called if there was no data loss.
blink::WebIDBDataLoss data_loss_;
// The "blocked" event should be sent at most once per request.
- bool sent_blocked_;
+ bool sent_blocked_ = false;
base::TimeTicks connection_open_start_time_;
std::unique_ptr<IOThreadHelper, BrowserThread::DeleteOnIOThread> io_helper_;
« no previous file with comments | « content/browser/indexed_db/database_impl.cc ('k') | content/browser/indexed_db/indexed_db_callbacks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698