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

Side by Side Diff: Source/core/wawwa/ListOfElements.cpp

Issue 491053004: Expose Web Animations API to Web Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES{
25
26 } LOSS OF USE,
27 * DATA, OR PROFITS{
28
29 } OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #include "config.h"
36 #include "core/wawwa/ListOfElements.h"
37
38 namespace blink {
39
40 ListOfElements::ListOfElements()
41 {
42 }
43
44 ProxyPlayer * ListOfElements::findDictProxyPlayers(String val)
45 {
46 return (ProxyPlayer *)m_dictProxyPlayers.get(val);
47 }
48
49 void ListOfElements::reportTime(String val, double time)
50 {
51 MockAnimationPlayer* hold = (MockAnimationPlayer *)m_dictMockAnimationPlayer s.get(val);
52 hold->m_workerGlobalScope->thread()->workerLoaderProxy().postTaskToWorkerGlo balScope(createCrossThreadTask(&MockAnimationPlayer::setStartTime, AllowCrossThr eadAccess(hold), time));
53 }
54
55 void ListOfElements::addtoMapMockAnimationPlayer(String id, MockAnimationPlayer * instance)
56 {
57 m_dictMockAnimationPlayers.add(id, instance);
58 }
59
60 void ListOfElements::execute(String action, String id, const Vector<ProxyKeyfram e> keyframes, const Timing timingInputDictionary)
61 {
62 ExceptionState* es = new ExceptionState(ExceptionState::UnknownContext, 0, 0 , v8::Handle<v8::Object>(), 0);
63 ProxyPlayer * hold = findDictProxyPlayers(id);
64 if (!hold) {
65 hold = new ProxyPlayer(id, keyframes, timingInputDictionary, *es, worker Vector[0]);
66 m_dictProxyPlayers.add(id, hold);
67 }
68 hold->execute(action, *es);
69 }
70
71 void ListOfElements::addToWorkerGlobalScopeVector(WorkerGlobalScope * instance)
72 {
73 workerGlobalScopeVector.append(instance);
74 }
75
76 void ListOfElements::addToWorkerVector(PassRefPtr<Worker> instance)
77 {
78 workerVector.append(instance);
79 }
80
81 void ListOfElements::checkForReport()
shans 2014/08/25 11:53:58 checkForReport should have a more descriptive name
82 {
83 for (HashMap<String, ProxyPlayer*>::iterator iter = m_dictProxyPlayers.begin (); iter != m_dictProxyPlayers.end(); ++iter) {
84 ProxyPlayer* instance = iter->value;
85 if (instance->animated && !instance->reported) {
86 instance->reportTime();
87 }
88 }
89 }
90
91
92 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698