addMatchesTo() -> moveMatchesTo() (move is better than copy)
svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800650
This commit is contained in:
parent
2127d62ae6
commit
8418bb6fc7
@ -136,7 +136,7 @@ void AbstractRunner::performMatch( Plasma::SearchContext &globalContext )
|
|||||||
}
|
}
|
||||||
|
|
||||||
//If matches were not added, delete items on the heap
|
//If matches were not added, delete items on the heap
|
||||||
if (localContext.addMatchesTo(globalContext) &&
|
if (localContext.moveMatchesTo(globalContext) &&
|
||||||
slowed && runtime < fastEnoughTime) {
|
slowed && runtime < fastEnoughTime) {
|
||||||
++d->fastRuns;
|
++d->fastRuns;
|
||||||
|
|
||||||
|
@ -279,9 +279,9 @@ bool SearchContext::addMatch(const QString &term, SearchMatch *match)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SearchContext::addMatchesTo(SearchContext &other)
|
bool SearchContext::moveMatchesTo(SearchContext &other)
|
||||||
{
|
{
|
||||||
//NOTE: we have addMatchesTo instead of the more 'natural' addMatches
|
//NOTE: we have moveMatchesTo instead of the more 'natural' addMatches
|
||||||
// because we can get away with one write lock on the local object
|
// because we can get away with one write lock on the local object
|
||||||
// this way, otherwise we'd need to lock once for searchTerm, once
|
// this way, otherwise we'd need to lock once for searchTerm, once
|
||||||
// for matches() and again for clearMatches() (2 read, one write)
|
// for matches() and again for clearMatches() (2 read, one write)
|
||||||
|
@ -141,14 +141,14 @@ class PLASMA_EXPORT SearchContext : public QObject
|
|||||||
bool addMatch(const QString &term, SearchMatch *match);
|
bool addMatch(const QString &term, SearchMatch *match);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Takes the matches from this SearchContext and adds to them another.
|
* Takes the matches from this SearchContext and copies to them another.
|
||||||
* If successful, the matches are removed from this SearchContext and
|
* If successful, the matches are removed from this SearchContext and
|
||||||
* ownership passed to the other SearchContext
|
* ownership passed to the other SearchContext
|
||||||
*
|
*
|
||||||
* @arg other the SearchContext to add this object's Matches to
|
* @arg other the SearchContext to move this object's Matches to
|
||||||
* @return true if matches were added, false if matches were e.g. outdated
|
* @return true if matches were added, false if matches were e.g. outdated
|
||||||
*/
|
*/
|
||||||
bool addMatchesTo(SearchContext &other);
|
bool moveMatchesTo(SearchContext &other);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all available matches for the current search term.
|
* Retrieves all available matches for the current search term.
|
||||||
|
Loading…
Reference in New Issue
Block a user