Commit 53ec58b2 authored by Majid Valipour's avatar Majid Valipour Committed by Commit Bot

[animation-worklet] remove unnecessary proxy client abstraction

There is no longer a need for AnimationWorkletProxyClient to be split
across core/ and modules/.

This patch combines the abstract interface and its single concrete impl into
a single class.

Other changes:
 - remove unnecessary include in ChromClient

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Icc49dc26de20b1059cb8be0aaa72fb39b87e2730
Reviewed-on: https://chromium-review.googlesource.com/1237147Reviewed-by: default avatarSandra Sun <sunyunjia@chromium.org>
Reviewed-by: default avatarRobert Flack <flackr@chromium.org>
Commit-Queue: Majid Valipour <majidvp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593650}
parent 711a00d3
......@@ -12,8 +12,6 @@ blink_core_sources("dom") {
"abort_controller.h",
"abort_signal.cc",
"abort_signal.h",
"animation_worklet_proxy_client.cc",
"animation_worklet_proxy_client.h",
"attr.cc",
"attr.h",
"attribute.h",
......
// Copyright 2016 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/renderer/core/dom/animation_worklet_proxy_client.h"
namespace blink {
AnimationWorkletProxyClient* AnimationWorkletProxyClient::From(
WorkerClients* clients) {
return Supplement<WorkerClients>::From<AnimationWorkletProxyClient>(clients);
}
const char AnimationWorkletProxyClient::kSupplementName[] =
"AnimationWorkletProxyClient";
void ProvideAnimationWorkletProxyClientTo(WorkerClients* clients,
AnimationWorkletProxyClient* client) {
clients->ProvideSupplement(client);
}
} // namespace blink
// 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.
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ANIMATION_WORKLET_PROXY_CLIENT_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ANIMATION_WORKLET_PROXY_CLIENT_H_
#include "base/macros.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/workers/worker_clients.h"
namespace blink {
class WorkletGlobalScope;
class CORE_EXPORT AnimationWorkletProxyClient
: public Supplement<WorkerClients> {
public:
static const char kSupplementName[];
AnimationWorkletProxyClient() = default;
static AnimationWorkletProxyClient* From(WorkerClients*);
virtual void SetGlobalScope(WorkletGlobalScope*) = 0;
virtual void Dispose() = 0;
DISALLOW_COPY_AND_ASSIGN(AnimationWorkletProxyClient);
};
CORE_EXPORT void ProvideAnimationWorkletProxyClientTo(
WorkerClients*,
AnimationWorkletProxyClient*);
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_CORE_DOM_ANIMATION_WORKLET_PROXY_CLIENT_H_
......@@ -33,7 +33,6 @@
#include "third_party/blink/public/platform/web_layer_tree_view.h"
#include "third_party/blink/renderer/core/accessibility/ax_object_cache.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/frame/sandbox_flags.h"
#include "third_party/blink/renderer/core/html/forms/popup_menu.h"
#include "third_party/blink/renderer/core/inspector/console_types.h"
......
......@@ -12,8 +12,8 @@ blink_modules_sources("animationworklet") {
"animation_worklet_global_scope.h",
"animation_worklet_messaging_proxy.cc",
"animation_worklet_messaging_proxy.h",
"animation_worklet_proxy_client_impl.cc",
"animation_worklet_proxy_client_impl.h",
"animation_worklet_proxy_client.cc",
"animation_worklet_proxy_client.h",
"animation_worklet_thread.cc",
"animation_worklet_thread.h",
"animator.cc",
......
......@@ -6,12 +6,11 @@
#include "base/atomic_sequence_num.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/page/chrome_client.h"
#include "third_party/blink/renderer/core/workers/worker_clients.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_messaging_proxy.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client_impl.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_thread.h"
base::AtomicSequenceNumber g_next_worklet_id;
......@@ -41,7 +40,7 @@ WorkletGlobalScopeProxy* AnimationWorklet::CreateGlobalScope() {
Document* document = ToDocument(GetExecutionContext());
AnimationWorkletProxyClient* proxy_client =
AnimationWorkletProxyClientImpl::FromDocument(document, scope_id_);
AnimationWorkletProxyClient::FromDocument(document, scope_id_);
WorkerClients* worker_clients = WorkerClients::Create();
ProvideAnimationWorkletProxyClientTo(worker_clients, proxy_client);
......
......@@ -7,8 +7,8 @@
#include "third_party/blink/renderer/bindings/core/v8/serialization/serialized_script_value.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_object_parser.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/workers/global_scope_creation_params.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/modules/animationworklet/worklet_animation_options.h"
#include "third_party/blink/renderer/platform/bindings/exception_state.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding_macros.h"
......
......@@ -12,7 +12,6 @@
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_cache_options.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include "third_party/blink/renderer/core/script/script.h"
......@@ -21,6 +20,7 @@
#include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h"
#include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_thread.h"
#include "third_party/blink/renderer/modules/animationworklet/animator.h"
#include "third_party/blink/renderer/modules/animationworklet/animator_definition.h"
......@@ -36,17 +36,14 @@
namespace blink {
namespace {
class MockAnimationWorkletProxyClient
: public GarbageCollected<MockAnimationWorkletProxyClient>,
public AnimationWorkletProxyClient {
USING_GARBAGE_COLLECTED_MIXIN(MockAnimationWorkletProxyClient);
class MockAnimationWorkletProxyClient : public AnimationWorkletProxyClient {
public:
MockAnimationWorkletProxyClient() : did_set_global_scope_(false) {}
MockAnimationWorkletProxyClient()
: AnimationWorkletProxyClient(0, nullptr, nullptr, nullptr, nullptr),
did_set_global_scope_(false) {}
void SetGlobalScope(WorkletGlobalScope*) override {
did_set_global_scope_ = true;
}
void Dispose() override {}
bool did_set_global_scope() { return did_set_global_scope_; }
private:
......
......@@ -6,8 +6,8 @@
#define THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_MESSAGING_PROXY_H_
#include <memory>
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/workers/threaded_worklet_messaging_proxy.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
namespace blink {
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client_impl.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/animation/worklet_animation_controller.h"
#include "third_party/blink/renderer/core/dom/document.h"
......@@ -14,7 +14,10 @@
namespace blink {
AnimationWorkletProxyClientImpl::AnimationWorkletProxyClientImpl(
const char AnimationWorkletProxyClient::kSupplementName[] =
"AnimationWorkletProxyClient";
AnimationWorkletProxyClient::AnimationWorkletProxyClient(
int scope_id,
base::WeakPtr<AnimationWorkletMutatorDispatcherImpl>
compositor_mutator_dispatcher,
......@@ -30,12 +33,12 @@ AnimationWorkletProxyClientImpl::AnimationWorkletProxyClientImpl(
std::move(main_thread_mutator_runner));
}
void AnimationWorkletProxyClientImpl::Trace(blink::Visitor* visitor) {
AnimationWorkletProxyClient::Trace(visitor);
void AnimationWorkletProxyClient::Trace(blink::Visitor* visitor) {
Supplement<WorkerClients>::Trace(visitor);
AnimationWorkletMutator::Trace(visitor);
}
void AnimationWorkletProxyClientImpl::SetGlobalScope(
void AnimationWorkletProxyClient::SetGlobalScope(
WorkletGlobalScope* global_scope) {
DCHECK(global_scope);
DCHECK(global_scope->IsContextThread());
......@@ -60,7 +63,7 @@ void AnimationWorkletProxyClientImpl::SetGlobalScope(
}
}
void AnimationWorkletProxyClientImpl::Dispose() {
void AnimationWorkletProxyClient::Dispose() {
if (state_ == RunState::kWorking) {
// At worklet scope termination break the reference to the clients if it is
// still alive.
......@@ -78,7 +81,7 @@ void AnimationWorkletProxyClientImpl::Dispose() {
DCHECK(global_scope_->IsContextThread());
// At worklet scope termination break the reference cycle between
// AnimationWorkletGlobalScope and AnimationWorkletProxyClientImpl.
// AnimationWorkletGlobalScope and AnimationWorkletProxyClient.
global_scope_ = nullptr;
}
......@@ -88,7 +91,7 @@ void AnimationWorkletProxyClientImpl::Dispose() {
state_ = RunState::kDisposed;
}
std::unique_ptr<AnimationWorkletOutput> AnimationWorkletProxyClientImpl::Mutate(
std::unique_ptr<AnimationWorkletOutput> AnimationWorkletProxyClient::Mutate(
std::unique_ptr<AnimationWorkletInput> input) {
DCHECK(input);
#if DCHECK_IS_ON()
......@@ -108,7 +111,7 @@ std::unique_ptr<AnimationWorkletOutput> AnimationWorkletProxyClientImpl::Mutate(
}
// static
AnimationWorkletProxyClientImpl* AnimationWorkletProxyClientImpl::FromDocument(
AnimationWorkletProxyClient* AnimationWorkletProxyClient::FromDocument(
Document* document,
int scope_id) {
WebLocalFrameImpl* local_frame =
......@@ -126,11 +129,21 @@ AnimationWorkletProxyClientImpl* AnimationWorkletProxyClientImpl::FromDocument(
document->GetWorkletAnimationController()
.EnsureMainThreadMutatorDispatcher(&main_thread_host_queue);
return new AnimationWorkletProxyClientImpl(
return new AnimationWorkletProxyClient(
scope_id, std::move(compositor_mutator_dispatcher),
std::move(compositor_host_queue),
std::move(main_thread_mutator_dispatcher),
std::move(main_thread_host_queue));
}
AnimationWorkletProxyClient* AnimationWorkletProxyClient::From(
WorkerClients* clients) {
return Supplement<WorkerClients>::From<AnimationWorkletProxyClient>(clients);
}
void ProvideAnimationWorkletProxyClientTo(WorkerClients* clients,
AnimationWorkletProxyClient* client) {
clients->ProvideSupplement(client);
}
} // namespace blink
// Copyright 2016 The Chromium Authors. All rights reserved.
// 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.
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_PROXY_CLIENT_IMPL_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_PROXY_CLIENT_IMPL_H_
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_PROXY_CLIENT_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_PROXY_CLIENT_H_
#include "base/macros.h"
#include "base/single_thread_task_runner.h"
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/workers/worker_clients.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope.h"
#include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/blink/renderer/platform/graphics/animation_worklet_mutator.h"
#include "third_party/blink/renderer/platform/wtf/noncopyable.h"
namespace blink {
......@@ -19,23 +19,25 @@ class Document;
class WorkletGlobalScope;
// Mediates between animation worklet global scope and its associated
// dispatchers. An AnimationWorkletProxyClientImpl is associated with a single
// dispatchers. An AnimationWorkletProxyClient is associated with a single
// global scope and up to two dispatchers representing main and compositor
// threads.
//
// This is constructed on the main thread but it is used in the worklet backing
// thread.
class MODULES_EXPORT AnimationWorkletProxyClientImpl final
: public GarbageCollectedFinalized<AnimationWorkletProxyClientImpl>,
public AnimationWorkletProxyClient,
class MODULES_EXPORT AnimationWorkletProxyClient
: public GarbageCollectedFinalized<AnimationWorkletProxyClient>,
public Supplement<WorkerClients>,
public AnimationWorkletMutator {
WTF_MAKE_NONCOPYABLE(AnimationWorkletProxyClientImpl);
USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClientImpl);
USING_GARBAGE_COLLECTED_MIXIN(AnimationWorkletProxyClient);
DISALLOW_COPY_AND_ASSIGN(AnimationWorkletProxyClient);
public:
static const char kSupplementName[];
// This client is hooked to the given |mutatee|, on the given
// |mutatee_runner|.
explicit AnimationWorkletProxyClientImpl(
explicit AnimationWorkletProxyClient(
int scope_id,
base::WeakPtr<AnimationWorkletMutatorDispatcherImpl> compositor_mutatee,
scoped_refptr<base::SingleThreadTaskRunner> compositor_mutatee_runner,
......@@ -43,9 +45,8 @@ class MODULES_EXPORT AnimationWorkletProxyClientImpl final
scoped_refptr<base::SingleThreadTaskRunner> main_thread_mutatee_runner);
void Trace(blink::Visitor*) override;
// AnimationWorkletProxyClient:
void SetGlobalScope(WorkletGlobalScope*) override;
void Dispose() override;
virtual void SetGlobalScope(WorkletGlobalScope*);
void Dispose();
// AnimationWorkletMutator:
// These methods are invoked on the animation worklet thread.
......@@ -53,7 +54,8 @@ class MODULES_EXPORT AnimationWorkletProxyClientImpl final
std::unique_ptr<AnimationWorkletOutput> Mutate(
std::unique_ptr<AnimationWorkletInput> input) override;
static AnimationWorkletProxyClientImpl* FromDocument(Document*, int scope_id);
static AnimationWorkletProxyClient* FromDocument(Document*, int scope_id);
static AnimationWorkletProxyClient* From(WorkerClients*);
private:
const int scope_id_;
......@@ -74,6 +76,10 @@ class MODULES_EXPORT AnimationWorkletProxyClientImpl final
enum RunState { kUninitialized, kWorking, kDisposed } state_;
};
void MODULES_EXPORT
ProvideAnimationWorkletProxyClientTo(WorkerClients*,
AnimationWorkletProxyClient*);
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_PROXY_CLIENT_IMPL_H_
#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_ANIMATIONWORKLET_ANIMATION_WORKLET_PROXY_CLIENT_H_
......@@ -13,7 +13,6 @@
#include "third_party/blink/renderer/bindings/core/v8/source_location.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
#include "third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.h"
#include "third_party/blink/renderer/core/dom/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h"
#include "third_party/blink/renderer/core/script/script.h"
......@@ -25,6 +24,7 @@
#include "third_party/blink/renderer/core/workers/worker_or_worklet_global_scope.h"
#include "third_party/blink/renderer/core/workers/worker_reporting_proxy.h"
#include "third_party/blink/renderer/core/workers/worklet_module_responses_map.h"
#include "third_party/blink/renderer/modules/animationworklet/animation_worklet_proxy_client.h"
#include "third_party/blink/renderer/platform/cross_thread_functional.h"
#include "third_party/blink/renderer/platform/loader/fetch/access_control_status.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_loader_options.h"
......@@ -48,15 +48,11 @@ class AnimationWorkletTestPlatform : public TestingPlatformSupport {
}
};
class TestAnimationWorkletProxyClient
: public GarbageCollected<TestAnimationWorkletProxyClient>,
public AnimationWorkletProxyClient {
USING_GARBAGE_COLLECTED_MIXIN(TestAnimationWorkletProxyClient);
class TestAnimationWorkletProxyClient : public AnimationWorkletProxyClient {
public:
TestAnimationWorkletProxyClient() = default;
TestAnimationWorkletProxyClient()
: AnimationWorkletProxyClient(0, nullptr, nullptr, nullptr, nullptr){};
void SetGlobalScope(WorkletGlobalScope*) override {}
void Dispose() override {}
};
} // namespace
......
......@@ -78,7 +78,7 @@ class PLATFORM_EXPORT AnimationWorkletMutatorDispatcherImpl final
DISALLOW_COPY_AND_ASSIGN(AutoSignal);
};
// The AnimationWorkletProxyClientImpls are also owned by the WorkerClients
// The AnimationWorkletProxyClients are also owned by the WorkerClients
// dictionary.
AnimationWorkletMutatorToTaskRunnerMap mutator_map_;
......
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