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

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

Issue 417573004: indexeddb: Removed use of dangling ptr in writeBlobToFileOnIOThread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also scoped LocalWriteClosure::task_runner_ Created 6 years, 5 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
Index: content/browser/indexed_db/indexed_db_backing_store.h
diff --git a/content/browser/indexed_db/indexed_db_backing_store.h b/content/browser/indexed_db/indexed_db_backing_store.h
index dd5c758c20a212f5276b9dc77729a90cb4f1d496..ffa6f3a29e9ee936f052cf1b662194eeedcd2bd3 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.h
+++ b/content/browser/indexed_db/indexed_db_backing_store.h
@@ -34,7 +34,7 @@
#include "webkit/browser/blob/blob_data_handle.h"
namespace base {
-class TaskRunner;
+class SequencedTaskRunner;
}
namespace fileapi {
@@ -67,7 +67,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
const GURL& origin_url() const { return origin_url_; }
IndexedDBFactory* factory() const { return indexed_db_factory_; }
- base::TaskRunner* task_runner() const { return task_runner_; }
+ base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); }
base::OneShotTimer<IndexedDBBackingStore>* close_timer() {
return &close_timer_;
}
@@ -83,7 +83,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
blink::WebIDBDataLoss* data_loss,
std::string* data_loss_message,
bool* disk_full,
- base::TaskRunner* task_runner,
+ base::SequencedTaskRunner* task_runner,
bool clean_journal,
leveldb::Status* status);
static scoped_refptr<IndexedDBBackingStore> Open(
@@ -95,17 +95,17 @@ class CONTENT_EXPORT IndexedDBBackingStore
std::string* data_loss_message,
bool* disk_full,
LevelDBFactory* leveldb_factory,
- base::TaskRunner* task_runner,
+ base::SequencedTaskRunner* task_runner,
bool clean_journal,
leveldb::Status* status);
static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
const GURL& origin_url,
- base::TaskRunner* task_runner,
+ base::SequencedTaskRunner* task_runner,
leveldb::Status* status);
static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
const GURL& origin_url,
LevelDBFactory* leveldb_factory,
- base::TaskRunner* task_runner,
+ base::SequencedTaskRunner* task_runner,
leveldb::Status* status);
void GrantChildProcessPermissions(int child_process_id);
@@ -175,8 +175,8 @@ class CONTENT_EXPORT IndexedDBBackingStore
virtual void Run(bool succeeded) = 0;
protected:
- virtual ~BlobWriteCallback() {}
friend class base::RefCounted<BlobWriteCallback>;
+ virtual ~BlobWriteCallback() {}
};
virtual leveldb::Status GetRecord(
@@ -459,7 +459,8 @@ class CONTENT_EXPORT IndexedDBBackingStore
base::Time last_modified_;
};
- class ChainedBlobWriter : public base::RefCounted<ChainedBlobWriter> {
+ class ChainedBlobWriter
+ : public base::RefCountedThreadSafe<ChainedBlobWriter> {
public:
virtual void set_delegate(
scoped_ptr<fileapi::FileWriterDelegate> delegate) = 0;
@@ -471,8 +472,8 @@ class CONTENT_EXPORT IndexedDBBackingStore
virtual void Abort() = 0;
protected:
+ friend class base::RefCountedThreadSafe<ChainedBlobWriter>;
virtual ~ChainedBlobWriter() {}
- friend class base::RefCounted<ChainedBlobWriter>;
};
class ChainedBlobWriterImpl;
@@ -503,15 +504,15 @@ class CONTENT_EXPORT IndexedDBBackingStore
};
protected:
+ friend class base::RefCounted<IndexedDBBackingStore>;
IndexedDBBackingStore(IndexedDBFactory* indexed_db_factory,
const GURL& origin_url,
const base::FilePath& blob_path,
net::URLRequestContext* request_context,
scoped_ptr<LevelDBDatabase> db,
scoped_ptr<LevelDBComparator> comparator,
- base::TaskRunner* task_runner);
+ base::SequencedTaskRunner* task_runner);
virtual ~IndexedDBBackingStore();
- friend class base::RefCounted<IndexedDBBackingStore>;
bool is_incognito() const { return !indexed_db_factory_; }
@@ -533,7 +534,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
net::URLRequestContext* request_context,
scoped_ptr<LevelDBDatabase> db,
scoped_ptr<LevelDBComparator> comparator,
- base::TaskRunner* task_runner,
+ base::SequencedTaskRunner* task_runner,
leveldb::Status* status);
static bool ReadCorruptionInfo(const base::FilePath& path_base,
@@ -568,7 +569,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
const std::string origin_identifier_;
net::URLRequestContext* request_context_;
- base::TaskRunner* task_runner_;
+ scoped_refptr<base::SequencedTaskRunner> task_runner_;
std::set<int> child_process_ids_granted_;
BlobChangeMap incognito_blob_map_;
base::OneShotTimer<IndexedDBBackingStore> journal_cleaning_timer_;

Powered by Google App Engine
This is Rietveld 408576698