Ignore:
Timestamp:
Feb 7, 2015, 6:28:48 PM (10 years ago)
Author:
Chris Dumez
Message:

Add Vector::removeFirstMatching() / removeAllMatching() methods taking lambda functions
https://bugs.webkit.org/show_bug.cgi?id=141321

Reviewed by Darin Adler.

Source/JavaScriptCore:

Use new Vector::removeFirstMatching() / removeAllMatching() methods.

Source/WebCore:

Use new Vector::removeFirstMatching() / removeAllMatching() methods.

Source/WebKit/win:

Use new Vector::removeFirstMatching() / removeAllMatching() methods.

Source/WebKit2:

Use new Vector::removeFirstMatching() / removeAllMatching() methods.

Source/WTF:

Add Vector::removeFirstMatching() / removeAllMatching() methods taking
lambda functions to match the element(s) to remove. This simplifies the
code a bit. Vector::removeAllMatching() is also more efficient than the
manual removal alternative.

  • wtf/Vector.h:

Tools:

Use new Vector::removeFirstMatching() / removeAllMatching() methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/profiler/ProfileNode.cpp

    r173262 r179791  
    7676        return;
    7777
    78     for (size_t i = 0; i < m_children.size(); ++i) {
    79         if (*node == m_children[i].get()) {
    80             m_children.remove(i);
    81             break;
    82         }
    83     }
     78    m_children.removeFirstMatching([node] (const RefPtr<ProfileNode>& current) {
     79        return *node == current.get();
     80    });
    8481
    8582#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.