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

Unified Diff: third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp

Issue 2828953002: [IndexedDB] Hold referenced to IDB::put blobs in the IDBRequest (Closed)
Patch Set: 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/IDBObjectStore.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
index 2022121aacc4b027b5b200a749a67e4ef3c6f685..7d9eca215848c614b4b1e83b87e054fa63e91579 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBObjectStore.cpp
@@ -43,7 +43,9 @@
#include "modules/indexeddb/IDBTracing.h"
#include "platform/Histogram.h"
#include "platform/SharedBuffer.h"
+#include "public/platform/Platform.h"
#include "public/platform/WebBlobInfo.h"
+#include "public/platform/WebBlobRegistry.h"
#include "public/platform/WebData.h"
#include "public/platform/WebVector.h"
#include "public/platform/modules/indexeddb/WebIDBKey.h"
@@ -506,6 +508,15 @@ IDBRequest* IDBObjectStore::put(ScriptState* script_state,
serialized_value->ToWireBytes(wire_bytes);
RefPtr<SharedBuffer> value_buffer = SharedBuffer::AdoptVector(wire_bytes);
+ // Add blob refs
+ blink::Platform* platform = blink::Platform::Current();
+ DCHECK(platform);
+ blink::WebBlobRegistry* registry = platform->GetBlobRegistry();
+ DCHECK(registry);
+ for (const WebBlobInfo& info : blob_info) {
+ registry->AddBlobDataRef(info.Uuid());
michaeln 2017/04/21 01:46:10 Manual refcounting always makes me a little uneasy
+ }
+
BackendDB()->Put(transaction_->Id(), Id(), WebData(value_buffer), blob_info,
key, static_cast<WebIDBPutMode>(put_mode),
request->CreateWebCallbacks().release(), index_ids,

Powered by Google App Engine
This is Rietveld 408576698