| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 } | 345 } |
| 346 | 346 |
| 347 void PerformanceBase::registerPerformanceObserver(PerformanceObserver& observer) | 347 void PerformanceBase::registerPerformanceObserver(PerformanceObserver& observer) |
| 348 { | 348 { |
| 349 m_observerFilterOptions |= observer.filterOptions(); | 349 m_observerFilterOptions |= observer.filterOptions(); |
| 350 m_observers.add(&observer); | 350 m_observers.add(&observer); |
| 351 } | 351 } |
| 352 | 352 |
| 353 void PerformanceBase::unregisterPerformanceObserver(PerformanceObserver& oldObse
rver) | 353 void PerformanceBase::unregisterPerformanceObserver(PerformanceObserver& oldObse
rver) |
| 354 { | 354 { |
| 355 ASSERT(isMainThread()); |
| 356 // Deliver any pending observations on this observer before unregistering. |
| 357 if (m_activeObservers.contains(&oldObserver) && !oldObserver.shouldBeSuspend
ed()) { |
| 358 oldObserver.deliver(); |
| 359 m_activeObservers.remove(&oldObserver); |
| 360 } |
| 355 m_observers.remove(&oldObserver); | 361 m_observers.remove(&oldObserver); |
| 356 updatePerformanceObserverFilterOptions(); | 362 updatePerformanceObserverFilterOptions(); |
| 357 } | 363 } |
| 358 | 364 |
| 359 void PerformanceBase::updatePerformanceObserverFilterOptions() | 365 void PerformanceBase::updatePerformanceObserverFilterOptions() |
| 360 { | 366 { |
| 361 m_observerFilterOptions = PerformanceEntry::Invalid; | 367 m_observerFilterOptions = PerformanceEntry::Invalid; |
| 362 for (const auto& observer : m_observers) { | 368 for (const auto& observer : m_observers) { |
| 363 m_observerFilterOptions |= observer->filterOptions(); | 369 m_observerFilterOptions |= observer->filterOptions(); |
| 364 } | 370 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 visitor->trace(m_frameTimingBuffer); | 448 visitor->trace(m_frameTimingBuffer); |
| 443 visitor->trace(m_resourceTimingBuffer); | 449 visitor->trace(m_resourceTimingBuffer); |
| 444 visitor->trace(m_userTiming); | 450 visitor->trace(m_userTiming); |
| 445 visitor->trace(m_observers); | 451 visitor->trace(m_observers); |
| 446 visitor->trace(m_activeObservers); | 452 visitor->trace(m_activeObservers); |
| 447 visitor->trace(m_suspendedObservers); | 453 visitor->trace(m_suspendedObservers); |
| 448 EventTargetWithInlineData::trace(visitor); | 454 EventTargetWithInlineData::trace(visitor); |
| 449 } | 455 } |
| 450 | 456 |
| 451 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |