| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 | 274 |
| 275 int ScriptExecutionContext::circularSequentialID() | 275 int ScriptExecutionContext::circularSequentialID() |
| 276 { | 276 { |
| 277 ++m_circularSequentialID; | 277 ++m_circularSequentialID; |
| 278 if (m_circularSequentialID <= 0) | 278 if (m_circularSequentialID <= 0) |
| 279 m_circularSequentialID = 1; | 279 m_circularSequentialID = 1; |
| 280 return m_circularSequentialID; | 280 return m_circularSequentialID; |
| 281 } | 281 } |
| 282 | 282 |
| 283 int ScriptExecutionContext::installNewTimeout(PassOwnPtr<ScheduledAction> action
, int timeout, bool singleShot) | 283 int ScriptExecutionContext::installNewTimeout(DOMTimer::TimerType timerType, Pas
sOwnPtr<ScheduledAction> action, int timeout) |
| 284 { | 284 { |
| 285 int timeoutID; | 285 int timeoutID; |
| 286 while (true) { | 286 while (true) { |
| 287 timeoutID = circularSequentialID(); | 287 timeoutID = circularSequentialID(); |
| 288 if (!m_timeouts.contains(timeoutID)) | 288 if (!m_timeouts.contains(timeoutID)) |
| 289 break; | 289 break; |
| 290 } | 290 } |
| 291 TimeoutMap::AddResult result = m_timeouts.add(timeoutID, DOMTimer::create(th
is, action, timeout, singleShot, timeoutID)); | 291 TimeoutMap::AddResult result = m_timeouts.add(timeoutID, DOMTimer::create(th
is, timerType, action, timeout, timeoutID)); |
| 292 ASSERT(result.isNewEntry); | 292 ASSERT(result.isNewEntry); |
| 293 DOMTimer* timer = result.iterator->value.get(); | 293 DOMTimer* timer = result.iterator->value.get(); |
| 294 | 294 |
| 295 timer->suspendIfNeeded(); | 295 timer->suspendIfNeeded(); |
| 296 | 296 |
| 297 return timer->timeoutID(); | 297 return timeoutID; |
| 298 } | 298 } |
| 299 | 299 |
| 300 void ScriptExecutionContext::removeTimeoutByID(int timeoutID) | 300 void ScriptExecutionContext::removeTimeoutByIDIfTypeMatches(DOMTimer::TimerType
timerType, int timeoutID) |
| 301 { | 301 { |
| 302 if (timeoutID <= 0) | 302 if (timeoutID <= 0) |
| 303 return; | 303 return; |
| 304 m_timeouts.remove(timeoutID); | 304 TimeoutMap::iterator iter = m_timeouts.find(timeoutID); |
| 305 if (iter != m_timeouts.end() && iter->value->timerType() == timerType) |
| 306 m_timeouts.remove(iter); |
| 305 } | 307 } |
| 306 | 308 |
| 307 PublicURLManager& ScriptExecutionContext::publicURLManager() | 309 PublicURLManager& ScriptExecutionContext::publicURLManager() |
| 308 { | 310 { |
| 309 if (!m_publicURLManager) | 311 if (!m_publicURLManager) |
| 310 m_publicURLManager = PublicURLManager::create(this); | 312 m_publicURLManager = PublicURLManager::create(this); |
| 311 return *m_publicURLManager; | 313 return *m_publicURLManager; |
| 312 } | 314 } |
| 313 | 315 |
| 314 void ScriptExecutionContext::didChangeTimerAlignmentInterval() | 316 void ScriptExecutionContext::didChangeTimerAlignmentInterval() |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 ScriptExecutionContext::Task::~Task() | 350 ScriptExecutionContext::Task::~Task() |
| 349 { | 351 { |
| 350 } | 352 } |
| 351 | 353 |
| 352 void ScriptExecutionContext::setDatabaseContext(DatabaseContext* databaseContext
) | 354 void ScriptExecutionContext::setDatabaseContext(DatabaseContext* databaseContext
) |
| 353 { | 355 { |
| 354 m_databaseContext = databaseContext; | 356 m_databaseContext = databaseContext; |
| 355 } | 357 } |
| 356 | 358 |
| 357 } // namespace WebCore | 359 } // namespace WebCore |
| OLD | NEW |