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

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

Issue 261843004: More changes to support incognito mode in the IDB/Blob code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rolled in Josh's feedback. Created 6 years, 7 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 | content/browser/indexed_db/indexed_db_backing_store.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_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 386e296c3aacfbf544f413186dec4933f8b199fd..d56619e68ee96cdc3283e390dccebe9eb4b15599 100644
--- a/content/browser/indexed_db/indexed_db_backing_store.h
+++ b/content/browser/indexed_db/indexed_db_backing_store.h
@@ -107,7 +107,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
base::TaskRunner* task_runner);
static scoped_refptr<IndexedDBBackingStore> OpenInMemory(
const GURL& origin_url,
- LevelDBFactory* level_db_factory,
+ LevelDBFactory* leveldb_factory,
base::TaskRunner* task_runner);
void GrantChildProcessPermissions(int child_process_id);
@@ -357,6 +357,29 @@ class CONTENT_EXPORT IndexedDBBackingStore
indexed_db::CursorDirection,
leveldb::Status*);
+ class BlobChangeRecord {
+ public:
+ BlobChangeRecord(const std::string& key, int64 object_store_id);
+ ~BlobChangeRecord();
+ const std::string& key() const { return key_; }
+ int64 object_store_id() const { return object_store_id_; }
+ void SetBlobInfo(std::vector<IndexedDBBlobInfo>* blob_info);
+ std::vector<IndexedDBBlobInfo>& mutable_blob_info() { return blob_info_; }
+ const std::vector<IndexedDBBlobInfo>& blob_info() const {
+ return blob_info_;
+ }
+ void SetHandles(ScopedVector<webkit_blob::BlobDataHandle>* handles);
+ scoped_ptr<BlobChangeRecord> Clone() const;
+
+ private:
+ std::string key_;
+ int64 object_store_id_;
+ std::vector<IndexedDBBlobInfo> blob_info_;
+ ScopedVector<webkit_blob::BlobDataHandle> handles_;
+ DISALLOW_COPY_AND_ASSIGN(BlobChangeRecord);
+ };
+ typedef std::map<std::string, BlobChangeRecord*> BlobChangeMap;
+
class Transaction {
public:
explicit Transaction(IndexedDBBackingStore* backing_store);
@@ -424,24 +447,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
typedef std::vector<WriteDescriptor> WriteDescriptorVec;
private:
- class BlobChangeRecord {
- public:
- BlobChangeRecord(const std::string& key, int64 object_store_id);
- ~BlobChangeRecord();
- const std::string& key() const { return key_; }
- int64 object_store_id() const { return object_store_id_; }
- void SetBlobInfo(std::vector<IndexedDBBlobInfo>* blob_info);
- std::vector<IndexedDBBlobInfo>& mutable_blob_info() { return blob_info_; }
- void SetHandles(ScopedVector<webkit_blob::BlobDataHandle>* handles);
-
- private:
- std::string key_;
- int64 object_store_id_;
- std::vector<IndexedDBBlobInfo> blob_info_;
- ScopedVector<webkit_blob::BlobDataHandle> handles_;
- };
class BlobWriteCallbackWrapper;
- typedef std::map<std::string, BlobChangeRecord*> BlobChangeMap;
// The callback will be called eventually on success or failure.
void WriteNewBlobs(BlobEntryKeyValuePairVec& new_blob_entries,
@@ -451,6 +457,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
IndexedDBBackingStore* backing_store_;
scoped_refptr<LevelDBTransaction> transaction_;
BlobChangeMap blob_change_map_;
+ BlobChangeMap incognito_blob_map_;
int64 database_id_;
scoped_refptr<ChainedBlobWriter> chained_blob_writer_;
};
@@ -466,6 +473,8 @@ class CONTENT_EXPORT IndexedDBBackingStore
virtual ~IndexedDBBackingStore();
friend class base::RefCounted<IndexedDBBackingStore>;
+ bool is_incognito() const { return !indexed_db_factory_; }
+
virtual bool WriteBlobFile(
int64 database_id,
const Transaction::WriteDescriptor& descriptor,
@@ -518,6 +527,7 @@ class CONTENT_EXPORT IndexedDBBackingStore
net::URLRequestContext* request_context_;
base::TaskRunner* task_runner_;
std::set<int> child_process_ids_granted_;
+ BlobChangeMap incognito_blob_map_;
base::OneShotTimer<IndexedDBBackingStore> journal_cleaning_timer_;
scoped_ptr<LevelDBDatabase> db_;
« no previous file with comments | « no previous file | content/browser/indexed_db/indexed_db_backing_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698