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

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

Issue 2725063003: Migrate WTF::LinkedHashSet/ListHashSet/HashTable::remove() to ::erase() (Closed)
Patch Set: rebase Created 3 years, 9 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 updateLongTaskInstrumentation(); 499 updateLongTaskInstrumentation();
500 } 500 }
501 501
502 void PerformanceBase::unregisterPerformanceObserver( 502 void PerformanceBase::unregisterPerformanceObserver(
503 PerformanceObserver& oldObserver) { 503 PerformanceObserver& oldObserver) {
504 ASSERT(isMainThread()); 504 ASSERT(isMainThread());
505 // Deliver any pending observations on this observer before unregistering. 505 // Deliver any pending observations on this observer before unregistering.
506 if (m_activeObservers.contains(&oldObserver) && 506 if (m_activeObservers.contains(&oldObserver) &&
507 !oldObserver.shouldBeSuspended()) { 507 !oldObserver.shouldBeSuspended()) {
508 oldObserver.deliver(); 508 oldObserver.deliver();
509 m_activeObservers.remove(&oldObserver); 509 m_activeObservers.erase(&oldObserver);
510 } 510 }
511 m_observers.remove(&oldObserver); 511 m_observers.erase(&oldObserver);
512 updatePerformanceObserverFilterOptions(); 512 updatePerformanceObserverFilterOptions();
513 updateLongTaskInstrumentation(); 513 updateLongTaskInstrumentation();
514 } 514 }
515 515
516 void PerformanceBase::updatePerformanceObserverFilterOptions() { 516 void PerformanceBase::updatePerformanceObserverFilterOptions() {
517 m_observerFilterOptions = PerformanceEntry::Invalid; 517 m_observerFilterOptions = PerformanceEntry::Invalid;
518 for (const auto& observer : m_observers) { 518 for (const auto& observer : m_observers) {
519 m_observerFilterOptions |= observer->filterOptions(); 519 m_observerFilterOptions |= observer->filterOptions();
520 } 520 }
521 updateLongTaskInstrumentation(); 521 updateLongTaskInstrumentation();
(...skipping 20 matching lines...) Expand all
542 542
543 void PerformanceBase::resumeSuspendedObservers() { 543 void PerformanceBase::resumeSuspendedObservers() {
544 ASSERT(isMainThread()); 544 ASSERT(isMainThread());
545 if (m_suspendedObservers.isEmpty()) 545 if (m_suspendedObservers.isEmpty())
546 return; 546 return;
547 547
548 PerformanceObserverVector suspended; 548 PerformanceObserverVector suspended;
549 copyToVector(m_suspendedObservers, suspended); 549 copyToVector(m_suspendedObservers, suspended);
550 for (size_t i = 0; i < suspended.size(); ++i) { 550 for (size_t i = 0; i < suspended.size(); ++i) {
551 if (!suspended[i]->shouldBeSuspended()) { 551 if (!suspended[i]->shouldBeSuspended()) {
552 m_suspendedObservers.remove(suspended[i]); 552 m_suspendedObservers.erase(suspended[i]);
553 activateObserver(*suspended[i]); 553 activateObserver(*suspended[i]);
554 } 554 }
555 } 555 }
556 } 556 }
557 557
558 void PerformanceBase::deliverObservationsTimerFired(TimerBase*) { 558 void PerformanceBase::deliverObservationsTimerFired(TimerBase*) {
559 ASSERT(isMainThread()); 559 ASSERT(isMainThread());
560 PerformanceObservers observers; 560 PerformanceObservers observers;
561 m_activeObservers.swap(observers); 561 m_activeObservers.swap(observers);
562 for (const auto& observer : observers) { 562 for (const auto& observer : observers) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 visitor->trace(m_resourceTimingBuffer); 601 visitor->trace(m_resourceTimingBuffer);
602 visitor->trace(m_navigationTiming); 602 visitor->trace(m_navigationTiming);
603 visitor->trace(m_userTiming); 603 visitor->trace(m_userTiming);
604 visitor->trace(m_observers); 604 visitor->trace(m_observers);
605 visitor->trace(m_activeObservers); 605 visitor->trace(m_activeObservers);
606 visitor->trace(m_suspendedObservers); 606 visitor->trace(m_suspendedObservers);
607 EventTargetWithInlineData::trace(visitor); 607 EventTargetWithInlineData::trace(visitor);
608 } 608 }
609 609
610 } // namespace blink 610 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698