OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * Copyright (C) 2012 Intel Inc. All rights reserved. | 3 * Copyright (C) 2012 Intel 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 are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 if (!suspended[i]->shouldBeSuspended()) { | 403 if (!suspended[i]->shouldBeSuspended()) { |
404 m_suspendedObservers.remove(suspended[i]); | 404 m_suspendedObservers.remove(suspended[i]); |
405 activateObserver(*suspended[i]); | 405 activateObserver(*suspended[i]); |
406 } | 406 } |
407 } | 407 } |
408 } | 408 } |
409 | 409 |
410 void PerformanceBase::deliverObservationsTimerFired(Timer<PerformanceBase>*) | 410 void PerformanceBase::deliverObservationsTimerFired(Timer<PerformanceBase>*) |
411 { | 411 { |
412 ASSERT(isMainThread()); | 412 ASSERT(isMainThread()); |
413 PerformanceObserverVector observers; | 413 PerformanceObservers observers; |
414 copyToVector(m_activeObservers, observers); | 414 m_activeObservers.swap(observers); |
415 m_activeObservers.clear(); | 415 for (const auto& observer : observers) { |
416 for (size_t i = 0; i < observers.size(); ++i) { | 416 if (observer->shouldBeSuspended()) |
417 if (observers[i]->shouldBeSuspended()) | 417 m_suspendedObservers.add(observer); |
418 m_suspendedObservers.add(observers[i]); | |
419 else | 418 else |
420 observers[i]->deliver(); | 419 observer->deliver(); |
421 } | 420 } |
422 } | 421 } |
423 | 422 |
424 // static | 423 // static |
425 double PerformanceBase::clampTimeResolution(double timeSeconds) | 424 double PerformanceBase::clampTimeResolution(double timeSeconds) |
426 { | 425 { |
427 const double resolutionSeconds = 0.000005; | 426 const double resolutionSeconds = 0.000005; |
428 return floor(timeSeconds / resolutionSeconds) * resolutionSeconds; | 427 return floor(timeSeconds / resolutionSeconds) * resolutionSeconds; |
429 } | 428 } |
430 | 429 |
(...skipping 17 matching lines...) Expand all Loading... |
448 visitor->trace(m_frameTimingBuffer); | 447 visitor->trace(m_frameTimingBuffer); |
449 visitor->trace(m_resourceTimingBuffer); | 448 visitor->trace(m_resourceTimingBuffer); |
450 visitor->trace(m_userTiming); | 449 visitor->trace(m_userTiming); |
451 visitor->trace(m_observers); | 450 visitor->trace(m_observers); |
452 visitor->trace(m_activeObservers); | 451 visitor->trace(m_activeObservers); |
453 visitor->trace(m_suspendedObservers); | 452 visitor->trace(m_suspendedObservers); |
454 EventTargetWithInlineData::trace(visitor); | 453 EventTargetWithInlineData::trace(visitor); |
455 } | 454 } |
456 | 455 |
457 } // namespace blink | 456 } // namespace blink |
OLD | NEW |