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

Side by Side Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 1945953002: Fix an edge case where early disconnect() can omit delivering of observation. crbug/607324 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add missing CORE_EXPORT to PerformanceObserver class Created 4 years, 7 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) 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
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
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/core.gypi ('k') | third_party/WebKit/Source/core/timing/PerformanceBaseTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698