diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-17 14:59:12 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-04-17 13:18:03 +0000 |
commit | 1b05827804eaf047779b597718c03e7d38344261 (patch) | |
tree | 5d0e42fb2b8bbbcded2416d756a9f7edc89bf633 /chromium/third_party/blink | |
parent | 31ccca0778db85c159634478b4ec7997f6704860 (diff) | |
download | qtwebengine-chromium-1b05827804eaf047779b597718c03e7d38344261.tar.gz |
BASELINE: Update Chromium to 80.0.3987.163
Change-Id: Iba07657949e6bee521813d3d6cf071e1f40f2501
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/third_party/blink')
14 files changed, 74 insertions, 44 deletions
diff --git a/chromium/third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom b/chromium/third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom index 7c6ca2eff2e..831bfa8ec59 100644 --- a/chromium/third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom +++ b/chromium/third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom @@ -14,7 +14,6 @@ import "third_party/blink/public/mojom/worker/dedicated_worker_host.mojom"; import "third_party/blink/public/mojom/worker/worker_main_script_load_params.mojom"; import "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom"; import "third_party/blink/public/mojom/service_worker/service_worker_provider.mojom"; -import "url/mojom/origin.mojom"; import "url/mojom/url.mojom"; // The name of the InterfaceProviderSpec in service manifests used by the @@ -74,11 +73,7 @@ interface DedicatedWorkerHostFactory { // // Creates a new DedicatedWorkerHost, and requests |browser_interface_broker| // to provide the worker access to mojo interfaces. - // |origin| must either be - // unique or match the origin of the creating context (Document or - // DedicatedWorkerGlobalScope). CreateWorkerHost( - url.mojom.Origin origin, pending_receiver<blink.mojom.BrowserInterfaceBroker> browser_interface_broker, pending_receiver<DedicatedWorkerHost> host); @@ -90,14 +85,11 @@ interface DedicatedWorkerHostFactory { // Creates a new DedicatedWorkerHost, and requests to start top-level worker // script loading for |script_url| using |credentials_mode| and // |outside_fetch_client_settings_object|. - // |origin| must either be unique or match the origin of the creating context - // (Document or DedicatedWorkerGlobalScope). // |blob_url_token| should be non-null when |script_url| is a blob URL. // |client| is used for notifying the renderer process of results of worker // host creation and script loading. CreateWorkerHostAndStartScriptLoad( url.mojom.Url script_url, - url.mojom.Origin origin, network.mojom.CredentialsMode credentials_mode, blink.mojom.FetchClientSettingsObject outside_fetch_client_settings_object, diff --git a/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h b/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h index f3a7c6c90b7..c86f5429654 100644 --- a/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h +++ b/chromium/third_party/blink/public/platform/web_dedicated_worker_host_factory_client.h @@ -19,7 +19,6 @@ class SingleThreadTaskRunner; namespace blink { -class WebSecurityOrigin; class WebURL; class WebWorkerFetchContext; @@ -32,17 +31,11 @@ class WebDedicatedWorkerHostFactoryClient { // Requests the creation of DedicatedWorkerHost in the browser process. // For non-PlzDedicatedWorker. This will be removed once PlzDedicatedWorker is // enabled by default. - virtual void CreateWorkerHostDeprecated( - const blink::WebSecurityOrigin& script_origin) = 0; + virtual void CreateWorkerHostDeprecated() = 0; // For PlzDedicatedWorker. - // |fetch_client_security_origin| is intentionally separated from - // |fetch_client_settings_object| as it shouldn't be passed from renderer - // process from the security perspective. virtual void CreateWorkerHost( const blink::WebURL& script_url, - const blink::WebSecurityOrigin& script_origin, network::mojom::CredentialsMode credentials_mode, - const blink::WebSecurityOrigin& fetch_client_security_origin, const blink::WebFetchClientSettingsObject& fetch_client_settings_object, mojo::ScopedMessagePipeHandle blob_url_token) = 0; diff --git a/chromium/third_party/blink/renderer/core/workers/dedicated_worker.cc b/chromium/third_party/blink/renderer/core/workers/dedicated_worker.cc index 35af0a0dc06..19da6821016 100644 --- a/chromium/third_party/blink/renderer/core/workers/dedicated_worker.cc +++ b/chromium/third_party/blink/renderer/core/workers/dedicated_worker.cc @@ -246,18 +246,14 @@ void DedicatedWorker::Start() { factory_client_->CreateWorkerHost( script_request_url_, - WebSecurityOrigin(GetExecutionContext()->GetSecurityOrigin()), credentials_mode, - WebSecurityOrigin( - outside_fetch_client_settings_object_->GetSecurityOrigin()), WebFetchClientSettingsObject(*outside_fetch_client_settings_object_), blob_url_token.PassPipe()); // Continue in OnScriptLoadStarted() or OnScriptLoadStartFailed(). return; } - factory_client_->CreateWorkerHostDeprecated( - WebSecurityOrigin(GetExecutionContext()->GetSecurityOrigin())); + factory_client_->CreateWorkerHostDeprecated(); if (options_->type() == "classic") { // Legacy code path (to be deprecated, see https://crbug.com/835717): diff --git a/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc index 9594f5fe1c2..8e9c4c60163 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.cc @@ -250,7 +250,7 @@ void AudioScheduledSourceHandler::Finish() { PostCrossThreadTask( *task_runner_, FROM_HERE, CrossThreadBindOnce(&AudioScheduledSourceHandler::NotifyEnded, - WrapRefCounted(this))); + AsWeakPtr())); } void AudioScheduledSourceHandler::NotifyEnded() { diff --git a/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.h b/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.h index 2fdb9bac867..d526a776c4c 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.h +++ b/chromium/third_party/blink/renderer/modules/webaudio/audio_scheduled_source_node.h @@ -30,6 +30,7 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_AUDIO_SCHEDULED_SOURCE_NODE_H_ #include <atomic> +#include "base/memory/weak_ptr.h" #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" #include "third_party/blink/renderer/modules/webaudio/audio_node.h" @@ -38,7 +39,9 @@ namespace blink { class BaseAudioContext; class AudioBus; -class AudioScheduledSourceHandler : public AudioHandler { +class AudioScheduledSourceHandler + : public AudioHandler, + public base::SupportsWeakPtr<AudioScheduledSourceHandler> { public: // These are the possible states an AudioScheduledSourceNode can be in: // diff --git a/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.cc index 0da688b3725..34f2c6d63eb 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.cc @@ -181,6 +181,12 @@ void BaseAudioContext::Uninitialize() { DCHECK_EQ(resume_resolvers_.size(), 0u); } +void BaseAudioContext::Dispose() { + // BaseAudioContext is going away, so remove the context from the orphan + // handlers. + GetDeferredTaskHandler().ClearContextFromOrphanHandlers(); +} + void BaseAudioContext::ContextLifecycleStateChanged( mojom::FrameLifecycleState state) { // Don't need to do anything for an offline context. diff --git a/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.h b/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.h index d6e4fe5e25f..a99b2dddad4 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.h +++ b/chromium/third_party/blink/renderer/modules/webaudio/base_audio_context.h @@ -96,6 +96,7 @@ class MODULES_EXPORT BaseAudioContext public InspectorHelperMixin { USING_GARBAGE_COLLECTED_MIXIN(BaseAudioContext); DEFINE_WRAPPERTYPEINFO(); + USING_PRE_FINALIZER(BaseAudioContext, Dispose); public: // The state of an audio context. On creation, the state is Suspended. The @@ -115,6 +116,8 @@ class MODULES_EXPORT BaseAudioContext return dest ? dest->GetAudioDestinationHandler().IsInitialized() : false; } + void Dispose(); + // Document notification void ContextLifecycleStateChanged(mojom::FrameLifecycleState) override; void ContextDestroyed(ExecutionContext*) override; diff --git a/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.cc index a7444a1774b..f0cf1ae8610 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.cc @@ -88,7 +88,7 @@ void BiquadFilterHandler::Process(uint32_t frames_to_process) { PostCrossThreadTask( *task_runner_, FROM_HERE, CrossThreadBindOnce(&BiquadFilterHandler::NotifyBadState, - WrapRefCounted(this))); + AsWeakPtr())); } } } diff --git a/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.h b/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.h index 318e0d2edce..07c0c455ecb 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.h +++ b/chromium/third_party/blink/renderer/modules/webaudio/biquad_filter_node.h @@ -26,6 +26,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_FILTER_NODE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_BIQUAD_FILTER_NODE_H_ +#include "base/memory/weak_ptr.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" #include "third_party/blink/renderer/modules/webaudio/audio_basic_processor_handler.h" @@ -38,7 +39,8 @@ class BaseAudioContext; class AudioParam; class BiquadFilterOptions; -class BiquadFilterHandler : public AudioBasicProcessorHandler { +class BiquadFilterHandler : public AudioBasicProcessorHandler, + public base::SupportsWeakPtr<BiquadFilterHandler> { public: static scoped_refptr<BiquadFilterHandler> Create(AudioNode&, float sample_rate, diff --git a/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc b/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc index 9fd38f0dde7..2afb5cf60f7 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.cc @@ -77,9 +77,9 @@ void DeferredTaskHandler::BreakConnections() { // connection. wtf_size_t size = finished_source_handlers_.size(); if (size > 0) { - for (auto* finished : finished_source_handlers_) { - active_source_handlers_.erase(finished); + for (auto finished : finished_source_handlers_) { finished->BreakConnectionWithLock(); + active_source_handlers_.erase(finished); } finished_source_handlers_.clear(); } @@ -132,6 +132,7 @@ void DeferredTaskHandler::HandleDirtyAudioNodeOutputs() { void DeferredTaskHandler::AddAutomaticPullNode( scoped_refptr<AudioHandler> node) { + DCHECK(IsAudioThread()); AssertGraphOwner(); if (!automatic_pull_handlers_.Contains(node)) { @@ -151,11 +152,16 @@ void DeferredTaskHandler::RemoveAutomaticPullNode(AudioHandler* node) { } void DeferredTaskHandler::UpdateAutomaticPullNodes() { + DCHECK(IsAudioThread()); AssertGraphOwner(); if (automatic_pull_handlers_need_updating_) { - CopyToVector(automatic_pull_handlers_, rendering_automatic_pull_handlers_); - automatic_pull_handlers_need_updating_ = false; + MutexTryLocker try_locker(automatic_pull_handlers_lock_); + if (try_locker.Locked()) { + CopyToVector(automatic_pull_handlers_, + rendering_automatic_pull_handlers_); + automatic_pull_handlers_need_updating_ = false; + } } } @@ -163,9 +169,12 @@ void DeferredTaskHandler::ProcessAutomaticPullNodes( uint32_t frames_to_process) { DCHECK(IsAudioThread()); - for (unsigned i = 0; i < rendering_automatic_pull_handlers_.size(); ++i) { - rendering_automatic_pull_handlers_[i]->ProcessIfNecessary( - frames_to_process); + MutexTryLocker try_locker(automatic_pull_handlers_lock_); + if (try_locker.Locked()) { + for (auto& rendering_automatic_pull_handler : + rendering_automatic_pull_handlers_) { + rendering_automatic_pull_handler->ProcessIfNecessary(frames_to_process); + } } } @@ -293,10 +302,7 @@ void DeferredTaskHandler::HandleDeferredTasks() { } void DeferredTaskHandler::ContextWillBeDestroyed() { - for (auto& handler : rendering_orphan_handlers_) - handler->ClearContext(); - for (auto& handler : deletable_orphan_handlers_) - handler->ClearContext(); + ClearContextFromOrphanHandlers(); ClearHandlersToBeDeleted(); // Some handlers might live because of their cross thread tasks. } @@ -350,15 +356,34 @@ void DeferredTaskHandler::DeleteHandlersOnMainThread() { void DeferredTaskHandler::ClearHandlersToBeDeleted() { DCHECK(IsMainThread()); + + { + MutexLocker locker(automatic_pull_handlers_lock_); + rendering_automatic_pull_handlers_.clear(); + } + GraphAutoLocker locker(*this); tail_processing_handlers_.clear(); rendering_orphan_handlers_.clear(); deletable_orphan_handlers_.clear(); automatic_pull_handlers_.clear(); - rendering_automatic_pull_handlers_.clear(); + finished_source_handlers_.clear(); active_source_handlers_.clear(); } +void DeferredTaskHandler::ClearContextFromOrphanHandlers() { + DCHECK(IsMainThread()); + + // |rendering_orphan_handlers_| and |deletable_orphan_handlers_| can + // be modified on the audio thread. + GraphAutoLocker locker(*this); + + for (auto& handler : rendering_orphan_handlers_) + handler->ClearContext(); + for (auto& handler : deletable_orphan_handlers_) + handler->ClearContext(); +} + void DeferredTaskHandler::SetAudioThreadToCurrentThread() { DCHECK(!IsMainThread()); audio_thread_.store(CurrentThread(), std::memory_order_relaxed); diff --git a/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h b/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h index 0ede5f5b5da..7d13eeb1a58 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h +++ b/chromium/third_party/blink/renderer/modules/webaudio/deferred_task_handler.h @@ -109,6 +109,9 @@ class MODULES_EXPORT DeferredTaskHandler final void RequestToDeleteHandlersOnMainThread(); void ClearHandlersToBeDeleted(); + // Clear the context from the rendering and deletable orphan handlers. + void ClearContextFromOrphanHandlers(); + bool AcceptsTailProcessing() const { return accepts_tail_processing_; } void StopAcceptingTailProcessing() { accepts_tail_processing_ = false; } @@ -188,7 +191,7 @@ class MODULES_EXPORT DeferredTaskHandler final return &active_source_handlers_; } - Vector<AudioHandler*>* GetFinishedSourceHandlers() { + Vector<scoped_refptr<AudioHandler>>* GetFinishedSourceHandlers() { return &finished_source_handlers_; } @@ -257,12 +260,17 @@ class MODULES_EXPORT DeferredTaskHandler final // connection and elements here are removed from |active_source_handlers_|. // // This must be accessed only from the audio thread. - Vector<AudioHandler*> finished_source_handlers_; + Vector<scoped_refptr<AudioHandler>> finished_source_handlers_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; // Graph locking. RecursiveMutex context_graph_mutex_; + + // Protects |rendering_automatic_pull_handlers| when updating, processing, and + // clearing. (See crbug.com/1061018) + mutable Mutex automatic_pull_handlers_lock_; + std::atomic<base::PlatformThreadId> audio_thread_; }; diff --git a/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc index c20271248b4..7606049afa3 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.cc @@ -104,9 +104,9 @@ void IIRFilterHandler::Process(uint32_t frames_to_process) { if (HasNonFiniteOutput()) { did_warn_bad_filter_state_ = true; - PostCrossThreadTask(*task_runner_, FROM_HERE, - CrossThreadBindOnce(&IIRFilterHandler::NotifyBadState, - WrapRefCounted(this))); + PostCrossThreadTask( + *task_runner_, FROM_HERE, + CrossThreadBindOnce(&IIRFilterHandler::NotifyBadState, AsWeakPtr())); } } } diff --git a/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.h b/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.h index 76266a88c15..cc2c09b6d9d 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.h +++ b/chromium/third_party/blink/renderer/modules/webaudio/iir_filter_node.h @@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_IIR_FILTER_NODE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_IIR_FILTER_NODE_H_ +#include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "third_party/blink/renderer/core/typed_arrays/array_buffer_view_helpers.h" #include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" @@ -18,7 +19,8 @@ class BaseAudioContext; class ExceptionState; class IIRFilterOptions; -class IIRFilterHandler : public AudioBasicProcessorHandler { +class IIRFilterHandler : public AudioBasicProcessorHandler, + public base::SupportsWeakPtr<IIRFilterHandler> { public: static scoped_refptr<IIRFilterHandler> Create( AudioNode&, diff --git a/chromium/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/chromium/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc index f5c04766b8a..4e518f9dfbb 100644 --- a/chromium/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/chromium/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc @@ -7542,7 +7542,7 @@ void WebGLRenderingContextBase::PrintGLErrorToConsole(const String& message) { void WebGLRenderingContextBase::PrintWarningToConsole(const String& message) { blink::ExecutionContext* context = Host()->GetTopExecutionContext(); - if (context) { + if (context && !context->IsContextDestroyed()) { context->AddConsoleMessage( ConsoleMessage::Create(mojom::ConsoleMessageSource::kRendering, mojom::ConsoleMessageLevel::kWarning, message)); |