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

Side by Side 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 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() {}
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
14
15 void WorkletAnimationController::AttachAnimation(
16 WorkletAnimationBase& animation) {
17 // TODO(smcgruer): Call NeedsCompositingUpdate on the relevant LocalFrameView.
18 DCHECK(!pending_animations_.Contains(&animation));
19 DCHECK(!compositor_animations_.Contains(&animation));
20 pending_animations_.insert(&animation);
21 }
22
23 void WorkletAnimationController::DetachAnimation(
24 WorkletAnimationBase& animation) {
25 DCHECK(pending_animations_.Contains(&animation) !=
26 compositor_animations_.Contains(&animation));
27 if (pending_animations_.Contains(&animation))
28 pending_animations_.erase(&animation);
29 else
30 compositor_animations_.erase(&animation);
31 }
32
33 void WorkletAnimationController::Update() {
34 HeapHashSet<Member<WorkletAnimationBase>> animations;
35 animations.swap(pending_animations_);
36 for (const auto& animation : animations) {
37 if (animation->StartOnCompositor()) {
38 compositor_animations_.insert(animation);
39 }
40 // 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.
41 }
42 }
43
44 DEFINE_TRACE(WorkletAnimationController) {
45 visitor->Trace(pending_animations_);
46 visitor->Trace(compositor_animations_);
47 }
48
49 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698