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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBRequest.h

Issue 2822453003: Wrap large IndexedDB values into Blobs before writing to LevelDB. (Closed)
Patch Set: Fixed compilation errors on Windows and no-DCHECKs. 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
Index: third_party/WebKit/Source/modules/indexeddb/IDBRequest.h
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h
index 7a52cdae05087f05406296abce6fbc3a34a07261..bc5c2dfdf8692886311e36ecee21217a41e7e17c 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBRequest.h
@@ -40,6 +40,7 @@
#include "modules/ModulesExport.h"
#include "modules/indexeddb/IDBAny.h"
#include "modules/indexeddb/IDBTransaction.h"
+#include "modules/indexeddb/IDBValueWrapper.h"
#include "modules/indexeddb/IndexedDB.h"
#include "platform/bindings/ActiveScriptWrappable.h"
#include "platform/bindings/ScriptState.h"
@@ -98,13 +99,23 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
void SetPendingCursor(IDBCursor*);
void Abort();
+ void QueueResult(DOMException*);
+ void QueueResult(IDBKey*);
+ void QueueResult(std::unique_ptr<WebIDBCursor>,
+ IDBKey*,
+ IDBKey* primary_key,
+ PassRefPtr<IDBValue>);
+ void QueueResult(PassRefPtr<IDBValue>);
+ void QueueResult(const Vector<RefPtr<IDBValue>>&);
+ void QueueResult(IDBKey*, IDBKey* primary_key, PassRefPtr<IDBValue>);
+
virtual void OnError(DOMException*);
jsbell 2017/05/05 00:29:37 WDYT about making most of the OnXXXX methods prote
pwnall 2017/05/11 23:54:23 Done. Can't say no to de-virtualizing :)
+ virtual void OnSuccess(IDBKey*);
virtual void OnSuccess(const Vector<String>&);
virtual void OnSuccess(std::unique_ptr<WebIDBCursor>,
IDBKey*,
IDBKey* primary_key,
PassRefPtr<IDBValue>);
- virtual void OnSuccess(IDBKey*);
virtual void OnSuccess(PassRefPtr<IDBValue>);
virtual void OnSuccess(const Vector<RefPtr<IDBValue>>&);
virtual void OnSuccess(int64_t);
@@ -125,6 +136,10 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
NOTREACHED();
}
+ inline void ExtractOutgoingBlobHandlesFrom(IDBValueWrapper* value_wrapper) {
dmurph 2017/05/04 22:27:07 I'd prefer we don't include and depend on the valu
pwnall 2017/05/11 23:54:23 Done.
+ value_wrapper->ExtractBlobDataHandles(&outgoing_blob_handles_);
+ }
+
// ScriptWrappable
bool HasPendingActivity() const final;
@@ -143,11 +158,6 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
IDBCursor* GetResultCursor() const;
- void StorePutOperationBlobs(
- HashMap<String, RefPtr<BlobDataHandle>> blob_handles) {
- transit_blob_handles_ = std::move(blob_handles);
- }
-
protected:
IDBRequest(ScriptState*, IDBAny* source, IDBTransaction*);
void EnqueueEvent(Event*);
@@ -159,7 +169,10 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
// EventTarget
DispatchEventResult DispatchEventInternal(Event*) override;
+ // Can be nullptr for requests that are not associated with a transaction,
+ // i.e. delete requests and unsuccessful open requests.
jsbell 2017/05/05 00:29:37 And completed open requests, IIRC?
pwnall 2017/05/11 23:54:23 Done. Case added. The "i.e." there was intended t
Member<IDBTransaction> transaction_;
+
ReadyState ready_state_ = PENDING;
bool request_aborted_ = false; // May be aborted by transaction then receive
// async onsuccess; ignore vs. assert.
@@ -175,8 +188,6 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
void AckReceivedBlobs(const IDBValue*);
void AckReceivedBlobs(const Vector<RefPtr<IDBValue>>&);
- void ClearPutOperationBlobs() { transit_blob_handles_.clear(); }
dmurph 2017/05/04 22:27:07 Requests can take forever for a GC, so please try
pwnall 2017/05/11 23:54:23 I think I was doing that. See the "outgoing_blob_h
-
Member<IDBAny> source_;
Member<IDBAny> result_;
Member<DOMException> error_;
@@ -196,7 +207,8 @@ class MODULES_EXPORT IDBRequest : public EventTargetWithInlineData,
Member<IDBKey> cursor_primary_key_;
RefPtr<IDBValue> cursor_value_;
- HashMap<String, RefPtr<BlobDataHandle>> transit_blob_handles_;
dmurph 2017/05/04 22:27:07 Any reason for the name change? I like 'transit' b
pwnall 2017/05/11 23:54:23 Done. (switched it back) "transit" seemed generic
+ // Keeps blobs alive while they are sent to the browser process.
+ Vector<RefPtr<BlobDataHandle>> outgoing_blob_handles_;
bool did_fire_upgrade_needed_event_ = false;
bool prevent_propagation_ = false;

Powered by Google App Engine
This is Rietveld 408576698