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

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

Issue 491053004: Expose Web Animations API to Web Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Exposing the Web Animations API to Web Workers Created 6 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 /*
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/ProxyMap.h"
37
38 namespace blink {
39
40 ProxyMap::ProxyMap()
41 {
42 }
43
44 RemotePlayerProxy * ProxyMap::findDictRemotePlayerProxys(String val)
dstockwell 2014/08/29 01:05:44 Needs a better name. What is val?
nainar1 2014/08/29 06:01:39 Thats the key you want to search on
45 {
46 return (RemotePlayerProxy *)m_dictRemotePlayerProxys.get(val);
47 }
48
49 void ProxyMap::reportTime(String val, double time)
dstockwell 2014/08/29 01:05:44 Which time? Start, current time?
nainar1 2014/08/29 06:01:39 startTime
50 {
51 RemotePlayer* hold = (RemotePlayer *)m_dictRemotePlayers.get(val);
52 hold->m_workerGlobalScope->thread()->workerLoaderProxy().postTaskToWorkerGlo balScope(createCrossThreadTask(&RemotePlayer::setStartTime, AllowCrossThreadAcce ss(hold), time));
53 }
54
55 void ProxyMap::addtoMapRemotePlayer(String id, RemotePlayer* instance)
56 {
57 m_dictRemotePlayers.add(id, instance);
58 }
59
60 void ProxyMap::execute(ACTIONS action, String id, const Vector<ProxyKeyframe> ke yframes, const Timing timingInputDictionary)
61 {
62 ExceptionState* es = new ExceptionState(ExceptionState::UnknownContext, 0, 0 , v8::Handle<v8::Object>(), 0);
63 RemotePlayerProxy * hold = findDictRemotePlayerProxys(id);
64 if (!hold) {
65 hold = new RemotePlayerProxy(id, keyframes, timingInputDictionary, *es, workerVector[0]);
66 m_dictRemotePlayerProxys.add(id, hold);
67 }
68 hold->execute(action, *es);
69 }
70
71 void ProxyMap::addToWorkerGlobalScopeVector(WorkerGlobalScope * instance)
72 {
73 workerGlobalScopeVector.append(instance);
74 }
75
76 void ProxyMap::addToWorkerVector(PassRefPtr<Worker> instance)
77 {
78 workerVector.append(instance);
79 }
80
81 void ProxyMap::checkForReportStartTime()
82 {
83 for (HashMap<String, RemotePlayerProxy*>::iterator iter = m_dictRemotePlayer Proxys.begin(); iter != m_dictRemotePlayerProxys.end(); ++iter) {
84 RemotePlayerProxy* 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