diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/exported')
8 files changed, 58 insertions, 517 deletions
diff --git a/chromium/third_party/blink/renderer/modules/exported/BUILD.gn b/chromium/third_party/blink/renderer/modules/exported/BUILD.gn index bfc6251ccf7..c034cde319a 100644 --- a/chromium/third_party/blink/renderer/modules/exported/BUILD.gn +++ b/chromium/third_party/blink/renderer/modules/exported/BUILD.gn @@ -5,7 +5,6 @@ import("//third_party/blink/renderer/modules/modules.gni") blink_modules_sources("exported") { sources = [ - "indexed_db_key_builder.cc", "web_apply_constraints_request.cc", "web_ax_context.cc", "web_ax_object.cc", @@ -14,9 +13,6 @@ blink_modules_sources("exported") { "web_dom_media_stream_track.cc", "web_embedded_worker_impl.cc", "web_embedded_worker_impl.h", - "web_idb_key.cc", - "web_idb_key_range.cc", - "web_idb_value.cc", "web_storage_event_dispatcher_impl.cc", "web_user_media_request.cc", ] diff --git a/chromium/third_party/blink/renderer/modules/exported/indexed_db_key_builder.cc b/chromium/third_party/blink/renderer/modules/exported/indexed_db_key_builder.cc deleted file mode 100644 index 8c2b8985925..00000000000 --- a/chromium/third_party/blink/renderer/modules/exported/indexed_db_key_builder.cc +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/public/platform/modules/indexeddb/indexed_db_key_builder.h" - -#include <stddef.h> - -#include <algorithm> -#include <string> -#include <utility> -#include <vector> - -#include "third_party/blink/public/common/indexeddb/indexeddb_key_range.h" -#include "third_party/blink/public/common/indexeddb/web_idb_types.h" -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key.h" -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key_path.h" -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key_range.h" -#include "third_party/blink/public/platform/web_string.h" -#include "third_party/blink/public/platform/web_vector.h" -#include "third_party/blink/renderer/modules/indexeddb/idb_key_range.h" - -namespace blink { - -namespace { - -IndexedDBKey::KeyArray CopyKeyArray(WebIDBKeyArrayView array) { - IndexedDBKey::KeyArray result; - const size_t array_size = array.size(); - result.reserve(array_size); - for (size_t i = 0; i < array_size; ++i) - result.emplace_back(IndexedDBKeyBuilder::Build(array[i])); - return result; -} - -std::vector<base::string16> CopyArray(const WebVector<WebString>& array) { - std::vector<base::string16> result; - result.reserve(array.size()); - for (const WebString& element : array) - result.emplace_back(element.Utf16()); - return result; -} - -} // anonymous namespace - -// static -IndexedDBKey IndexedDBKeyBuilder::Build(WebIDBKeyView key) { - switch (key.KeyType()) { - case kWebIDBKeyTypeArray: - return IndexedDBKey(CopyKeyArray(key.ArrayView())); - case kWebIDBKeyTypeBinary: { - const WebData data = key.Binary(); - std::string key_string; - key_string.reserve(data.size()); - - data.ForEachSegment([&key_string](const char* segment, - size_t segment_size, - size_t segment_offset) { - key_string.append(segment, segment_size); - return true; - }); - return IndexedDBKey(std::move(key_string)); - } - case kWebIDBKeyTypeString: - return IndexedDBKey(key.String().Utf16()); - case kWebIDBKeyTypeDate: - return IndexedDBKey(key.Date(), kWebIDBKeyTypeDate); - case kWebIDBKeyTypeNumber: - return IndexedDBKey(key.Number(), kWebIDBKeyTypeNumber); - case kWebIDBKeyTypeNull: - case kWebIDBKeyTypeInvalid: - return IndexedDBKey(key.KeyType()); - case kWebIDBKeyTypeMin: - NOTREACHED(); - return IndexedDBKey(); - } -} - -// static -WebIDBKey WebIDBKeyBuilder::Build(const WebIDBKeyView& key) { - switch (key.KeyType()) { - case kWebIDBKeyTypeArray: { - const WebIDBKeyArrayView& array = key.ArrayView(); - WebVector<WebIDBKey> web_idb_keys; - const size_t array_size = array.size(); - web_idb_keys.reserve(array_size); - for (size_t i = 0; i < array_size; ++i) - web_idb_keys.emplace_back(Build(array[i])); - return WebIDBKey::CreateArray(std::move(web_idb_keys)); - } - case kWebIDBKeyTypeBinary: { - const WebData data = key.Binary(); - return WebIDBKey::CreateBinary(data); - } - case kWebIDBKeyTypeString: - return WebIDBKey::CreateString(key.String()); - case kWebIDBKeyTypeDate: - return WebIDBKey::CreateDate(key.Date()); - case kWebIDBKeyTypeNumber: - return WebIDBKey::CreateNumber(key.Number()); - case kWebIDBKeyTypeInvalid: - return WebIDBKey::CreateInvalid(); - case kWebIDBKeyTypeNull: - return WebIDBKey::CreateNull(); - case kWebIDBKeyTypeMin: - NOTREACHED(); - return WebIDBKey::CreateInvalid(); - } -} - -// static -WebIDBKey WebIDBKeyBuilder::Build(const IndexedDBKey& key) { - switch (key.type()) { - case kWebIDBKeyTypeArray: { - const IndexedDBKey::KeyArray& array = key.array(); - WebVector<WebIDBKey> web_idb_keys; - web_idb_keys.reserve(array.size()); - for (const IndexedDBKey& array_element : array) - web_idb_keys.emplace_back(Build(array_element)); - return WebIDBKey::CreateArray(std::move(web_idb_keys)); - } - case kWebIDBKeyTypeBinary: { - const std::string& str = key.binary(); - const WebData& data = WebData(str.c_str(), str.length()); - return WebIDBKey::CreateBinary(data); - } - case kWebIDBKeyTypeString: - return WebIDBKey::CreateString(WebString::FromUTF16(key.string())); - case kWebIDBKeyTypeDate: - return WebIDBKey::CreateDate(key.date()); - case kWebIDBKeyTypeNumber: - return WebIDBKey::CreateNumber(key.number()); - case kWebIDBKeyTypeInvalid: - return WebIDBKey::CreateInvalid(); - case kWebIDBKeyTypeNull: - return WebIDBKey::CreateNull(); - case kWebIDBKeyTypeMin: - NOTREACHED(); - return WebIDBKey::CreateInvalid(); - } -} - -// static -IndexedDBKeyRange IndexedDBKeyRangeBuilder::Build( - const WebIDBKeyRange& key_range) { - return IndexedDBKeyRange(IndexedDBKeyBuilder::Build(key_range.Lower()), - IndexedDBKeyBuilder::Build(key_range.Upper()), - key_range.LowerOpen(), key_range.UpperOpen()); -} - -// static -IndexedDBKeyRange IndexedDBKeyRangeBuilder::Build(WebIDBKeyView key) { - return IndexedDBKeyRange(IndexedDBKeyBuilder::Build(key), - IndexedDBKeyBuilder::Build(key), - false /* lower_open */, false /* upper_open */); -} - -// static -WebIDBKeyRange WebIDBKeyRangeBuilder::Build(WebIDBKeyView key) { - return WebIDBKeyRange(WebIDBKeyBuilder::Build(key), - WebIDBKeyBuilder::Build(key), false /* lower_open */, - false /* upper_open */); -} - -// static -WebIDBKeyRange WebIDBKeyRangeBuilder::Build( - const IndexedDBKeyRange& key_range) { - return WebIDBKeyRange(WebIDBKeyBuilder::Build(key_range.lower()), - WebIDBKeyBuilder::Build(key_range.upper()), - key_range.lower_open(), key_range.upper_open()); -} - -// static -IndexedDBKeyPath IndexedDBKeyPathBuilder::Build(const WebIDBKeyPath& key_path) { - switch (key_path.KeyPathType()) { - case kWebIDBKeyPathTypeString: - return IndexedDBKeyPath(key_path.String().Utf16()); - case kWebIDBKeyPathTypeArray: - return IndexedDBKeyPath(CopyArray(key_path.Array())); - case kWebIDBKeyPathTypeNull: - return IndexedDBKeyPath(); - } -} - -// static -WebIDBKeyPath WebIDBKeyPathBuilder::Build(const IndexedDBKeyPath& key_path) { - switch (key_path.type()) { - case kWebIDBKeyPathTypeString: - return WebIDBKeyPath::Create(WebString::FromUTF16(key_path.string())); - case kWebIDBKeyPathTypeArray: { - WebVector<WebString> key_path_vector(key_path.array().size()); - for (const auto& item : key_path.array()) - key_path_vector.emplace_back(WebString::FromUTF16(item)); - return WebIDBKeyPath::Create(key_path_vector); - } - case kWebIDBKeyPathTypeNull: - return WebIDBKeyPath::CreateNull(); - } -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc index 4c2310dcaa8..ef79de3cb11 100644 --- a/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc +++ b/chromium/third_party/blink/renderer/modules/exported/web_ax_object.cc @@ -427,6 +427,13 @@ WebAXObject WebAXObject::AriaActiveDescendant() const { return WebAXObject(private_->ActiveDescendant()); } +WebAXObject WebAXObject::ErrorMessage() const { + if (IsDetached()) + return WebAXObject(); + + return WebAXObject(private_->ErrorMessage()); +} + ax::mojom::HasPopup WebAXObject::HasPopup() const { if (IsDetached()) return ax::mojom::HasPopup::kFalse; @@ -1096,7 +1103,7 @@ unsigned WebAXObject::AriaColumnIndex() const { if (IsDetached()) return 0; - return private_->IsTableCellLikeRole() ? private_->AriaColumnIndex() : 0; + return private_->AriaColumnIndex(); } int WebAXObject::AriaRowCount() const { @@ -1324,17 +1331,16 @@ void WebAXObject::GetWordBoundaries(WebVector<int>& starts, if (IsDetached()) return; - Vector<AXRange> word_boundaries; - private_->GetWordBoundaries(word_boundaries); - - WebVector<int> word_start_offsets(word_boundaries.size()); - WebVector<int> word_end_offsets(word_boundaries.size()); - for (wtf_size_t i = 0; i < word_boundaries.size(); ++i) { - DCHECK(word_boundaries[i].IsValid()); - DCHECK_EQ(word_boundaries[i].Start().ContainerObject(), - word_boundaries[i].End().ContainerObject()); - word_start_offsets[i] = word_boundaries[i].Start().TextOffset(); - word_end_offsets[i] = word_boundaries[i].End().TextOffset(); + Vector<int> src_starts; + Vector<int> src_ends; + private_->GetWordBoundaries(src_starts, src_ends); + DCHECK_EQ(src_starts.size(), src_ends.size()); + + WebVector<int> word_start_offsets(src_starts.size()); + WebVector<int> word_end_offsets(src_ends.size()); + for (wtf_size_t i = 0; i < src_starts.size(); ++i) { + word_start_offsets[i] = src_starts[i]; + word_end_offsets[i] = src_ends[i]; } starts.Swap(word_start_offsets); diff --git a/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc b/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc index 5bcb80cdff8..519d1b4627e 100644 --- a/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc +++ b/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.cc @@ -64,7 +64,9 @@ #include "third_party/blink/renderer/modules/service_worker/service_worker_thread.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h" -#include "third_party/blink/renderer/platform/loader/fetch/substitute_data.h" +#include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object_snapshot.h" +#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" +#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher_properties.h" #include "third_party/blink/renderer/platform/network/network_utils.h" #include "third_party/blink/renderer/platform/shared_buffer.h" #include "third_party/blink/renderer/platform/weborigin/kurl.h" @@ -177,11 +179,15 @@ void WebEmbeddedWorkerImpl::StartWorkerContext( pause_after_download_state_ = kDoPauseAfterDownload; devtools_worker_token_ = data.devtools_worker_token; - // |loader_factory| is null since all loads for new scripts go through - // ServiceWorkerNetworkProvider::script_loader_factory() rather than the - // shadow page's loader. This is different to shared workers, which use the - // script loader factory for the main script only, and the shadow page loader - // for importScripts(). + // S13nServiceWorker: |loader_factory| is null since all loads for new scripts + // go through ServiceWorkerNetworkProvider::script_loader_factory() rather + // than the shadow page's loader. This is different to shared workers, which + // use script_loader_factory() for the main script only, and the shadow page + // loader for importScripts(). + // + // Non-S13nServiceWorker: |loader_factory| is null since the main script load + // goes through the shadow page loader which uses the default loader that goes + // to ResourceDispatcherHost. shadow_page_ = std::make_unique<WorkerShadowPage>( this, nullptr /* loader_factory */, std::move(worker_start_data_.privacy_preferences)); @@ -245,16 +251,16 @@ void WebEmbeddedWorkerImpl::AddMessageToConsole( const WebConsoleMessage& message) { MessageLevel web_core_message_level; switch (message.level) { - case WebConsoleMessage::kLevelVerbose: + case mojom::ConsoleMessageLevel::kVerbose: web_core_message_level = kVerboseMessageLevel; break; - case WebConsoleMessage::kLevelInfo: + case mojom::ConsoleMessageLevel::kInfo: web_core_message_level = kInfoMessageLevel; break; - case WebConsoleMessage::kLevelWarning: + case mojom::ConsoleMessageLevel::kWarning: web_core_message_level = kWarningMessageLevel; break; - case WebConsoleMessage::kLevelError: + case mojom::ConsoleMessageLevel::kError: web_core_message_level = kErrorMessageLevel; break; default: @@ -316,12 +322,11 @@ void WebEmbeddedWorkerImpl::OnShadowPageInitialized() { DCHECK(!main_script_loader_); main_script_loader_ = MakeGarbageCollected<WorkerClassicScriptLoader>(); main_script_loader_->LoadTopLevelScriptAsynchronously( - *shadow_page_->GetDocument(), worker_start_data_.script_url, - mojom::RequestContextType::SERVICE_WORKER, + *shadow_page_->GetDocument(), shadow_page_->GetDocument()->Fetcher(), + worker_start_data_.script_url, mojom::RequestContextType::SERVICE_WORKER, network::mojom::FetchRequestMode::kSameOrigin, network::mojom::FetchCredentialsMode::kSameOrigin, - worker_start_data_.address_space, false /* is_nested_worker */, - base::OnceClosure(), + worker_start_data_.address_space, base::OnceClosure(), Bind(&WebEmbeddedWorkerImpl::OnScriptLoaderFinished, WTF::Unretained(this))); // Do nothing here since OnScriptLoaderFinished() might have been already @@ -389,7 +394,14 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() { std::unique_ptr<GlobalScopeCreationParams> global_scope_creation_params; String source_code; - std::unique_ptr<Vector<char>> cached_meta_data; + std::unique_ptr<Vector<uint8_t>> cached_meta_data; + + // TODO(nhiroki): Implement off-the-main-thread worker script fetch for + // service workers (https://crbug.com/835717). + const OffMainThreadWorkerScriptFetchOption off_main_thread_fetch_option = + worker_start_data_.script_type == mojom::ScriptType::kModule + ? OffMainThreadWorkerScriptFetchOption::kEnabled + : OffMainThreadWorkerScriptFetchOption::kDisabled; // |main_script_loader_| isn't created if the InstalledScriptsManager had the // script. @@ -405,7 +417,8 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() { } global_scope_creation_params = std::make_unique<GlobalScopeCreationParams>( worker_start_data_.script_url, worker_start_data_.script_type, - worker_start_data_.user_agent, std::move(web_worker_fetch_context), + off_main_thread_fetch_option, worker_start_data_.user_agent, + std::move(web_worker_fetch_context), content_security_policy ? content_security_policy->Headers() : Vector<CSPHeaderAndType>(), referrer_policy, starter_origin, starter_secure_context, @@ -424,12 +437,12 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() { // served by the installed scripts manager on the worker thread. global_scope_creation_params = std::make_unique<GlobalScopeCreationParams>( worker_start_data_.script_url, worker_start_data_.script_type, - worker_start_data_.user_agent, std::move(web_worker_fetch_context), - Vector<CSPHeaderAndType>(), network::mojom::ReferrerPolicy::kDefault, - starter_origin, starter_secure_context, starter_https_state, - worker_clients, worker_start_data_.address_space, - nullptr /* OriginTrialTokens */, devtools_worker_token_, - std::move(worker_settings), + off_main_thread_fetch_option, worker_start_data_.user_agent, + std::move(web_worker_fetch_context), Vector<CSPHeaderAndType>(), + network::mojom::ReferrerPolicy::kDefault, starter_origin, + starter_secure_context, starter_https_state, worker_clients, + worker_start_data_.address_space, nullptr /* OriginTrialTokens */, + devtools_worker_token_, std::move(worker_settings), static_cast<V8CacheOptions>(worker_start_data_.v8_cache_options), nullptr /* worklet_module_respones_map */, std::move(interface_provider_info_)); @@ -474,7 +487,10 @@ void WebEmbeddedWorkerImpl::StartWorkerThread() { // called navigator.ServiceWorker.register(). To do it, we need to make a // way to pass the settings object over mojo IPCs. auto* outside_settings_object = - document->CreateFetchClientSettingsObjectSnapshot(); + MakeGarbageCollected<FetchClientSettingsObjectSnapshot>( + document->Fetcher() + ->GetProperties() + .GetFetchClientSettingsObject()); network::mojom::FetchCredentialsMode credentials_mode = network::mojom::FetchCredentialsMode::kOmit; worker_thread_->ImportModuleScript(worker_start_data_.script_url, diff --git a/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h b/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h index 4c6dee13232..342b79cb4da 100644 --- a/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h +++ b/chromium/third_party/blink/renderer/modules/exported/web_embedded_worker_impl.h @@ -34,7 +34,7 @@ #include <memory> #include "services/service_manager/public/cpp/interface_provider.h" #include "services/service_manager/public/mojom/interface_provider.mojom-blink.h" -#include "third_party/blink/public/platform/modules/cache_storage/cache_storage.mojom-blink.h" +#include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-blink.h" #include "third_party/blink/public/web/web_embedded_worker.h" #include "third_party/blink/public/web/web_embedded_worker_start_data.h" #include "third_party/blink/renderer/core/exported/worker_shadow_page.h" diff --git a/chromium/third_party/blink/renderer/modules/exported/web_idb_key.cc b/chromium/third_party/blink/renderer/modules/exported/web_idb_key.cc deleted file mode 100644 index 2d0dbfd23e6..00000000000 --- a/chromium/third_party/blink/renderer/modules/exported/web_idb_key.cc +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key.h" - -#include "third_party/blink/renderer/modules/indexeddb/idb_key.h" -#include "third_party/blink/renderer/platform/wtf/std_lib_extras.h" - -namespace blink { - -size_t WebIDBKeyArrayView::size() const { - return private_->Array().size(); -} - -WebIDBKeyView WebIDBKeyArrayView::operator[](size_t index) const { - return WebIDBKeyView(private_->Array()[SafeCast<wtf_size_t>(index)].get()); -} - -WebIDBKeyType WebIDBKeyView::KeyType() const { - if (!private_) - return kWebIDBKeyTypeNull; - return static_cast<WebIDBKeyType>(private_->GetType()); -} - -bool WebIDBKeyView::IsValid() const { - if (!private_) - return false; - return private_->IsValid(); -} - -WebData WebIDBKeyView::Binary() const { - return private_->Binary(); -} - -WebString WebIDBKeyView::String() const { - return private_->GetString(); -} - -double WebIDBKeyView::Date() const { - return private_->Date(); -} - -double WebIDBKeyView::Number() const { - return private_->Number(); -} - -size_t WebIDBKeyView::SizeEstimate() const { - // TODO(cmp): Ensure |private_| can never be null. - // - // SizeEstimate() can be called when |private_| is null. That happens if and - // only if the |WebIDBKey| instance is created using WebIDBKey::CreateNull(). - // - // Eventually, WebIDBKey::CreateNull() will change so that case will lead to - // a non-null |private_|. At that time, this null check can change to a - // DCHECK that |private_| is not null and the special null case handling can - // be removed. - if (this->IsNull()) { - return IDBKey::kIDBKeyOverheadSize; - } - - return private_->SizeEstimate(); -} - -WebIDBKey WebIDBKey::CreateArray(WebVector<WebIDBKey> array) { - IDBKey::KeyArray keys; - keys.ReserveCapacity(SafeCast<wtf_size_t>(array.size())); - for (WebIDBKey& key : array) { - DCHECK(key.View().KeyType() != kWebIDBKeyTypeNull); - keys.emplace_back(key.ReleaseIdbKey()); - } - return WebIDBKey(IDBKey::CreateArray(std::move(keys))); -} - -WebIDBKey WebIDBKey::CreateBinary(const WebData& binary) { - return WebIDBKey(IDBKey::CreateBinary(binary)); -} - -WebIDBKey WebIDBKey::CreateString(const WebString& string) { - return WebIDBKey(IDBKey::CreateString(string)); -} - -WebIDBKey WebIDBKey::CreateDate(double date) { - return WebIDBKey(IDBKey::CreateDate(date)); -} - -WebIDBKey WebIDBKey::CreateNumber(double number) { - return WebIDBKey(IDBKey::CreateNumber(number)); -} - -WebIDBKey WebIDBKey::CreateInvalid() { - return WebIDBKey(IDBKey::CreateInvalid()); -} - -WebIDBKey::WebIDBKey() noexcept = default; - -WebIDBKey::WebIDBKey(WebIDBKey&&) noexcept = default; -WebIDBKey& WebIDBKey::operator=(WebIDBKey&&) noexcept = default; - -WebIDBKey::~WebIDBKey() noexcept = default; - -std::unique_ptr<IDBKey> WebIDBKey::ReleaseIdbKey() noexcept { - return std::move(private_); -} - -WebIDBKey::WebIDBKey(std::unique_ptr<IDBKey> idb_key) noexcept - : private_(std::move(idb_key)) {} -WebIDBKey& WebIDBKey::operator=(std::unique_ptr<IDBKey> idb_key) noexcept { - private_ = std::move(idb_key); - return *this; -} - -WebIDBKey::WebIDBKey(const WebIDBKey& rkey) - : private_(IDBKey::Clone(rkey.private_)) {} -WebIDBKey& WebIDBKey::operator=(const WebIDBKey& rkey) { - private_ = IDBKey::Clone(rkey.private_); - return *this; -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/modules/exported/web_idb_key_range.cc b/chromium/third_party/blink/renderer/modules/exported/web_idb_key_range.cc deleted file mode 100644 index 0cdee1eb9b2..00000000000 --- a/chromium/third_party/blink/renderer/modules/exported/web_idb_key_range.cc +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2011 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key_range.h" - -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key.h" -#include "third_party/blink/renderer/modules/indexeddb/idb_key.h" -#include "third_party/blink/renderer/modules/indexeddb/idb_key_range.h" - -namespace blink { - -void WebIDBKeyRange::Assign(const WebIDBKeyRange& other) { - private_ = other.private_; -} - -void WebIDBKeyRange::Assign(WebIDBKey lower, - WebIDBKey upper, - bool lower_open, - bool upper_open) { - if (!lower.View().IsValid() && !upper.View().IsValid()) { - private_.Reset(); - } else { - private_ = IDBKeyRange::Create(lower.ReleaseIdbKey(), upper.ReleaseIdbKey(), - lower_open ? IDBKeyRange::kLowerBoundOpen - : IDBKeyRange::kLowerBoundClosed, - upper_open ? IDBKeyRange::kUpperBoundOpen - : IDBKeyRange::kUpperBoundClosed); - } -} - -void WebIDBKeyRange::Reset() { - private_.Reset(); -} - -WebIDBKeyView WebIDBKeyRange::Lower() const { - if (!private_.Get()) - return WebIDBKeyView(nullptr); - return WebIDBKeyView(private_->Lower()); -} - -WebIDBKeyView WebIDBKeyRange::Upper() const { - if (!private_.Get()) - return WebIDBKeyView(nullptr); - return WebIDBKeyView(private_->Upper()); -} - -bool WebIDBKeyRange::LowerOpen() const { - return private_.Get() && private_->lowerOpen(); -} - -bool WebIDBKeyRange::UpperOpen() const { - return private_.Get() && private_->upperOpen(); -} - -} // namespace blink diff --git a/chromium/third_party/blink/renderer/modules/exported/web_idb_value.cc b/chromium/third_party/blink/renderer/modules/exported/web_idb_value.cc deleted file mode 100644 index 11ea6453954..00000000000 --- a/chromium/third_party/blink/renderer/modules/exported/web_idb_value.cc +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2017 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_value.h" - -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key.h" -#include "third_party/blink/public/platform/modules/indexeddb/web_idb_key_path.h" -#include "third_party/blink/public/platform/web_blob_info.h" -#include "third_party/blink/public/platform/web_data.h" -#include "third_party/blink/public/platform/web_vector.h" -#include "third_party/blink/renderer/modules/indexeddb/idb_key.h" -#include "third_party/blink/renderer/modules/indexeddb/idb_key_path.h" -#include "third_party/blink/renderer/modules/indexeddb/idb_value.h" - -namespace blink { - -WebIDBValue::WebIDBValue(const WebData& data, - const WebVector<WebBlobInfo>& blob_info) - : private_(IDBValue::Create(data, blob_info)) { -#if DCHECK_IS_ON() - private_->SetIsOwnedByWebIDBValue(true); -#endif // DCHECK_IS_ON() -} - -WebIDBValue::WebIDBValue(WebIDBValue&&) noexcept = default; -WebIDBValue& WebIDBValue::operator=(WebIDBValue&&) noexcept = default; - -WebIDBValue::~WebIDBValue() noexcept = default; - -void WebIDBValue::SetInjectedPrimaryKey(WebIDBKey primary_key, - const WebIDBKeyPath& primary_key_path) { - private_->SetInjectedPrimaryKey(primary_key.ReleaseIdbKey(), - IDBKeyPath(primary_key_path)); -} - -WebVector<WebBlobInfo> WebIDBValue::BlobInfoForTesting() const { - 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() - -void WebIDBValue::ReleaseIdbValueOwnership() { - private_->SetIsOwnedByWebIDBValue(false); -} - -#endif // DCHECK_IS_ON() - -} // namespace blink |