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

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

Issue 2869183002: Initial implementation of WorkletAnimation (Closed)
Patch Set: Address reviewer comments 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() = default;
12
13 WorkletAnimationController::~WorkletAnimationController() = default;
14
15 void WorkletAnimationController::AttachAnimation(
16 WorkletAnimationBase& animation) {
nhiroki 2017/09/12 00:10:36 DCHECK(IsMainThread()) here and in other functions
smcgruer 2017/09/12 15:46:02 Done.
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?
41 }
42 }
43
44 DEFINE_TRACE(WorkletAnimationController) {
45 visitor->Trace(pending_animations_);
46 visitor->Trace(compositor_animations_);
47 }
48
49 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/animation/WorkletAnimationController.h ('k') | third_party/WebKit/Source/core/dom/Document.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698