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

Side by Side Diff: Source/core/workers/WorkerGlobalScope.cpp

Issue 19494002: Distinguish actions registered with setTimeout() and setInterval(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix test, and add a new test. Created 7 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
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 return m_navigator.get(); 174 return m_navigator.get();
175 } 175 }
176 176
177 void WorkerGlobalScope::postTask(PassOwnPtr<Task> task) 177 void WorkerGlobalScope::postTask(PassOwnPtr<Task> task)
178 { 178 {
179 thread()->runLoop().postTask(task); 179 thread()->runLoop().postTask(task);
180 } 180 }
181 181
182 int WorkerGlobalScope::setTimeout(PassOwnPtr<ScheduledAction> action, int timeou t) 182 int WorkerGlobalScope::setTimeout(PassOwnPtr<ScheduledAction> action, int timeou t)
183 { 183 {
184 return DOMTimer::install(scriptExecutionContext(), action, timeout, true); 184 return DOMTimer::install(scriptExecutionContext(), DOMTimer::TimerTypeTimeou t, action, timeout);
185 } 185 }
186 186
187 void WorkerGlobalScope::clearTimeout(int timeoutID) 187 void WorkerGlobalScope::clearTimeout(int timeoutID)
188 { 188 {
189 DOMTimer::removeByID(scriptExecutionContext(), timeoutID); 189 DOMTimer::removeByIDIfTypeMatches(scriptExecutionContext(), DOMTimer::TimerT ypeTimeout, timeoutID);
190 } 190 }
191 191
192 void WorkerGlobalScope::clearInspector() 192 void WorkerGlobalScope::clearInspector()
193 { 193 {
194 m_workerInspectorController.clear(); 194 m_workerInspectorController.clear();
195 } 195 }
196 196
197 int WorkerGlobalScope::setInterval(PassOwnPtr<ScheduledAction> action, int timeo ut) 197 int WorkerGlobalScope::setInterval(PassOwnPtr<ScheduledAction> action, int timeo ut)
198 { 198 {
199 return DOMTimer::install(scriptExecutionContext(), action, timeout, false); 199 return DOMTimer::install(scriptExecutionContext(), DOMTimer::TimerTypeInterv al, action, timeout);
200 } 200 }
201 201
202 void WorkerGlobalScope::clearInterval(int timeoutID) 202 void WorkerGlobalScope::clearInterval(int timeoutID)
203 { 203 {
204 DOMTimer::removeByID(scriptExecutionContext(), timeoutID); 204 DOMTimer::removeByIDIfTypeMatches(scriptExecutionContext(), DOMTimer::TimerT ypeInterval, timeoutID);
205 } 205 }
206 206
207 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionCode& ec) 207 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionCode& ec)
208 { 208 {
209 ASSERT(contentSecurityPolicy()); 209 ASSERT(contentSecurityPolicy());
210 ec = 0; 210 ec = 0;
211 Vector<String>::const_iterator urlsEnd = urls.end(); 211 Vector<String>::const_iterator urlsEnd = urls.end();
212 Vector<KURL> completedURLs; 212 Vector<KURL> completedURLs;
213 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) { 213 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it) {
214 const KURL& url = scriptExecutionContext()->completeURL(*it); 214 const KURL& url = scriptExecutionContext()->completeURL(*it);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 iter = m_workerObservers.begin(); 348 iter = m_workerObservers.begin();
349 } 349 }
350 } 350 }
351 351
352 WorkerEventQueue* WorkerGlobalScope::eventQueue() const 352 WorkerEventQueue* WorkerGlobalScope::eventQueue() const
353 { 353 {
354 return m_eventQueue.get(); 354 return m_eventQueue.get();
355 } 355 }
356 356
357 } // namespace WebCore 357 } // namespace WebCore
OLDNEW
« Source/core/page/DOMTimer.cpp ('K') | « Source/core/page/DOMWindow.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698