Commit cd8b2fb8 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

WebIDBValue: Stop inlining ReleaseIdbValue()'s implementation

This fixes the libstdc++ build after 86293fce ("IndexedDB: Move
content/renderer/indexed_db/ to Blink, take 2"):

    In file included from /usr/include/c++/8/memory:80,
                     from ../../mojo/public/cpp/system/buffer.h:17,
                     from ../../mojo/public/cpp/system/core.h:8,
                     from ../../mojo/public/cpp/bindings/lib/bindings_internal.h:16,
                     from ../../mojo/public/cpp/bindings/lib/array_internal.h:18,
                     from ../../mojo/public/cpp/bindings/array_data_view.h:10,
                     from gen/third_party/blink/public/mojom/indexeddb/indexeddb.mojom-shared.h:17,
                     from ../../third_party/blink/public/common/indexeddb/web_idb_types.h:29,
                     from ../../third_party/blink/renderer/modules/indexeddb/indexed_db_dispatcher.h:12,
                     from ../../third_party/blink/renderer/modules/indexeddb/indexed_db_dispatcher.cc:5:
    /usr/include/c++/8/bits/unique_ptr.h: In instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with _Tp = blink::IDBValue]’:
    /usr/include/c++/8/bits/unique_ptr.h:274:17:   required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp = blink::IDBValue; _Dp = std::default_delete<blink::IDBValue>]’
    ../../third_party/blink/public/platform/modules/indexeddb/web_idb_value.h:49:30:   required from here
    /usr/include/c++/8/bits/unique_ptr.h:79:16: error: invalid application of ‘sizeof’ to incomplete type ‘blink::IDBValue’
      static_assert(sizeof(_Tp)>0,
                    ^~~~~~~~~~~

libstdc++'s std::unique_ptr implementation has a few static_asserts in the
destructor, one of which requires that the type passed to unique_ptr is
fully declared at the time.

indexed_db_dispatcher.cc is now in Blink, and it ends up indirectly
including web_idb_value.h, and now WebIDBValue::ReleaseIdbValue()'s call to
std::move() triggers that assert.

Since we cannot include idb_value.h in web_idb_value.h without triggering
checkdeps, move the implementation to web_idb_value.cc instead.

Bug: 819294
Change-Id: I5fdcfab3fa83729863b5f825568780a0ccb0d96f
Reviewed-on: https://chromium-review.googlesource.com/c/1352251Reviewed-by: default avatarVictor Costan <pwnall@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612115}
parent b6eb8c6d
...@@ -42,12 +42,7 @@ class WebIDBValue { ...@@ -42,12 +42,7 @@ class WebIDBValue {
// TODO(pwnall): When Onion Soup-ing IndexedDB, ReleaseIDBValue() should // TODO(pwnall): When Onion Soup-ing IndexedDB, ReleaseIDBValue() should
// take a v8::Isolate, and all the ownership tracking logic // take a v8::Isolate, and all the ownership tracking logic
// can be deleted. // can be deleted.
std::unique_ptr<IDBValue> ReleaseIdbValue() noexcept { BLINK_EXPORT std::unique_ptr<IDBValue> ReleaseIdbValue() noexcept;
#if DCHECK_IS_ON()
ReleaseIdbValueOwnership();
#endif // DCHECK_IS_ON()
return std::move(private_);
}
#endif // INSIDE_BLINK #endif // INSIDE_BLINK
private: private:
......
...@@ -38,6 +38,13 @@ WebVector<WebBlobInfo> WebIDBValue::BlobInfoForTesting() const { ...@@ -38,6 +38,13 @@ WebVector<WebBlobInfo> WebIDBValue::BlobInfoForTesting() const {
return private_->BlobInfo(); return private_->BlobInfo();
} }
std::unique_ptr<IDBValue> WebIDBValue::ReleaseIdbValue() noexcept {
#if DCHECK_IS_ON()
ReleaseIdbValueOwnership();
#endif // DCHECK_IS_ON()
return std::move(private_);
}
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
void WebIDBValue::ReleaseIdbValueOwnership() { void WebIDBValue::ReleaseIdbValueOwnership() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment