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

Unified Diff: third_party/WebKit/Source/core/animation/WorkletAnimationController.cpp

Issue 2869183002: Initial implementation of WorkletAnimation (Closed)
Patch Set: Fix include for new v8 bindings path Created 3 years, 3 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/core/animation/WorkletAnimationController.cpp
diff --git a/third_party/WebKit/Source/core/animation/WorkletAnimationController.cpp b/third_party/WebKit/Source/core/animation/WorkletAnimationController.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..57c5127aee926083f37db5f5224f86ff3d68fa82
--- /dev/null
+++ b/third_party/WebKit/Source/core/animation/WorkletAnimationController.cpp
@@ -0,0 +1,49 @@
+// 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 "core/animation/WorkletAnimationController.h"
+
+#include "core/animation/WorkletAnimationBase.h"
+
+namespace blink {
+
+WorkletAnimationController::WorkletAnimationController() {}
+
+WorkletAnimationController::~WorkletAnimationController() {}
nhiroki 2017/09/08 03:58:22 = default; ?
smcgruer 2017/09/11 18:18:59 Done. Not familiar with our style here, but also m
+
+void WorkletAnimationController::AttachAnimation(
+ WorkletAnimationBase& animation) {
+ // TODO(smcgruer): Call NeedsCompositingUpdate on the relevant LocalFrameView.
+ DCHECK(!pending_animations_.Contains(&animation));
+ DCHECK(!compositor_animations_.Contains(&animation));
+ pending_animations_.insert(&animation);
+}
+
+void WorkletAnimationController::DetachAnimation(
+ WorkletAnimationBase& animation) {
+ DCHECK(pending_animations_.Contains(&animation) !=
+ compositor_animations_.Contains(&animation));
+ if (pending_animations_.Contains(&animation))
+ pending_animations_.erase(&animation);
+ else
+ compositor_animations_.erase(&animation);
+}
+
+void WorkletAnimationController::Update() {
+ HeapHashSet<Member<WorkletAnimationBase>> animations;
+ animations.swap(pending_animations_);
+ for (const auto& animation : animations) {
+ if (animation->StartOnCompositor()) {
+ compositor_animations_.insert(animation);
+ }
+ // TODO(smcgruer): On failure, warn user. Perhaps fire cancel event?
haraken 2017/09/08 01:11:23 Yeah, it doesn't look nice to silently ignore the
smcgruer 2017/09/11 18:19:00 Ack, plan to do so.
+ }
+}
+
+DEFINE_TRACE(WorkletAnimationController) {
+ visitor->Trace(pending_animations_);
+ visitor->Trace(compositor_animations_);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698