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

Side by Side Diff: third_party/WebKit/Source/core/animation/WorkletAnimationController.cpp

Issue 2869183002: Initial implementation of WorkletAnimation (Closed)
Patch Set: Use CheckCanStartAnimationOnCompositor Created 3 years, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "core/animation/WorkletAnimationController.h"
6
7 #include "core/animation/WorkletAnimationBase.h"
8
9 namespace blink {
10
11 WorkletAnimationController::WorkletAnimationController() {}
12
13 WorkletAnimationController::~WorkletAnimationController() {}
14
15 void WorkletAnimationController::AttachAnimation(
16 WorkletAnimationBase& animation) {
17 DCHECK(!pending_animations_.Contains(&animation));
18 DCHECK(!compositor_animations_.Contains(&animation));
19 pending_animations_.insert(&animation);
20 }
21
22 void WorkletAnimationController::DetachAnimation(
23 WorkletAnimationBase& animation) {
24 DCHECK(pending_animations_.Contains(&animation) !=
25 compositor_animations_.Contains(&animation));
26 if (pending_animations_.Contains(&animation))
27 pending_animations_.erase(&animation);
28 else
29 compositor_animations_.erase(&animation);
30 }
31
32 void WorkletAnimationController::Update() {
33 HeapHashSet<Member<WorkletAnimationBase>> animations;
34 animations.swap(pending_animations_);
35 for (const auto& animation : animations) {
36 if (animation->StartOnCompositor()) {
37 compositor_animations_.insert(animation);
38 }
39 // TODO(smcgruer): On failure, warn user. Perhaps fire cancel event?
40 }
41 }
42
43 DEFINE_TRACE(WorkletAnimationController) {
44 visitor->Trace(pending_animations_);
45 visitor->Trace(compositor_animations_);
46 }
47
48 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698