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

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

Issue 1963293002: Replacing Indexed DB Chromium IPC with Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring after Passing URLRequestContextGetter. Created 4 years, 4 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/IDBValue.cpp
diff --git a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
index 241f49a578e6d8aadbbc32c2e4e1f3ddc25abefa..9cdb1f1546d42c285be9991ed531c885272f3e73 100644
--- a/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
+++ b/third_party/WebKit/Source/modules/indexeddb/IDBValue.cpp
@@ -4,18 +4,24 @@
#include "modules/indexeddb/IDBValue.h"
+#include "modules/indexeddb/IDBMojoUtil.h"
#include "platform/blob/BlobData.h"
#include "public/platform/WebBlobInfo.h"
-#include "public/platform/modules/indexeddb/WebIDBValue.h"
#include "wtf/PtrUtil.h"
namespace blink {
IDBValue::IDBValue() = default;
-IDBValue::IDBValue(const WebIDBValue& value)
- : IDBValue(value.data, value.webBlobInfo, value.primaryKey, value.keyPath)
+IDBValue::IDBValue(indexed_db::mojom::blink::ValuePtr value)
+ : m_data(createData(value->data))
+ , m_blobData(new Vector<RefPtr<BlobDataHandle>>())
+ , m_blobInfo(new Vector<WebBlobInfo>(value->data.size()))
+ , m_primaryKey(createKey(value->primary_key))
+ , m_keyPath(createKeyPath(value->key_path))
{
+ WebIDBValue webValue = createValue(value);
+ setBlobData(webValue.webBlobInfo);
}
IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, const WebVector<WebBlobInfo>& webBlobInfo, IDBKey* primaryKey, const IDBKeyPath& keyPath)
@@ -25,10 +31,7 @@ IDBValue::IDBValue(PassRefPtr<SharedBuffer> data, const WebVector<WebBlobInfo>&
, m_primaryKey(primaryKey && primaryKey->isValid() ? primaryKey : nullptr)
, m_keyPath(keyPath)
{
- for (size_t i = 0; i < webBlobInfo.size(); ++i) {
- const WebBlobInfo& info = (*m_blobInfo)[i] = webBlobInfo[i];
- m_blobData->append(BlobDataHandle::create(info.uuid(), info.type(), info.size()));
- }
+ setBlobData(webBlobInfo);
}
IDBValue::IDBValue(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath& keyPath)
@@ -46,14 +49,22 @@ IDBValue::IDBValue(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath&
IDBValue::~IDBValue() {}
+void IDBValue::setBlobData(const WebVector<WebBlobInfo>& webBlobInfo)
+{
+ for (size_t i = 0; i < webBlobInfo.size(); ++i) {
+ const WebBlobInfo& info = (*m_blobInfo)[i] = webBlobInfo[i];
+ m_blobData->append(BlobDataHandle::create(info.uuid(), info.type(), info.size()));
+ }
+}
+
PassRefPtr<IDBValue> IDBValue::create()
{
return adoptRef(new IDBValue());
}
-PassRefPtr<IDBValue> IDBValue::create(const WebIDBValue& value)
+PassRefPtr<IDBValue> IDBValue::create(indexed_db::mojom::blink::ValuePtr value)
{
- return adoptRef(new IDBValue(value));
+ return adoptRef(new IDBValue(std::move(value)));
}
PassRefPtr<IDBValue> IDBValue::create(const IDBValue* value, IDBKey* primaryKey, const IDBKeyPath& keyPath)

Powered by Google App Engine
This is Rietveld 408576698