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

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: Including <string> to make "git cl lint" happy 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..be088ba2f33fa9280f2b54b454a39c9fdb7d6553 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.h
+++ b/content/browser/indexed_db/indexed_db_backing_store.h
@@ -15,6 +15,7 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/sequenced_task_runner.h"
michaeln 2014/07/24 00:20:23 would a fwrd decl work in here?
cmumford 2014/07/24 18:18:26 If I change task_runner() to return a SequencedTas
#include "base/strings/string_piece.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
@@ -33,10 +34,6 @@
#include "url/gurl.h"
#include "webkit/browser/blob/blob_data_handle.h"
-namespace base {
-class TaskRunner;
-}
-
namespace fileapi {
class FileWriterDelegate;
}
@@ -83,7 +80,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 +92,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 +172,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 +456,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 +469,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 +501,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 +531,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 +566,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
const std::string origin_identifier_;
net::URLRequestContext* request_context_;
- base::TaskRunner* task_runner_;
+ base::SequencedTaskRunner* task_runner_;
michaeln 2014/07/24 00:20:24 huh... i'm surprised this is not a scoped_refptr<T
cmumford 2014/07/24 18:18:26 Not in indexed_db_context_impl.h either.
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