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

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

Issue 2004343002: Remove unwanted copyToVector() uses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused typedef Created 4 years, 6 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698