diff options
author | Tyler Brock <tyler.brock@gmail.com> | 2015-02-06 14:29:45 -0500 |
---|---|---|
committer | Tyler Brock <tyler.brock@gmail.com> | 2015-02-06 16:37:35 -0500 |
commit | aa9980b8c02de71c6918fba4aba9f22dd10eed01 (patch) | |
tree | 3ade9078069c7e1317a8b31c2e1fc427977d7abe /src/mongo/db/background.cpp | |
parent | 3a7675bb6fa110a10be307db3201bfb348cf41cf (diff) | |
download | mongo-aa9980b8c02de71c6918fba4aba9f22dd10eed01.tar.gz |
SERVER-16940 Change pass-by-const-ref of StringData to pass-by-value
Diffstat (limited to 'src/mongo/db/background.cpp')
-rw-r--r-- | src/mongo/db/background.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/db/background.cpp b/src/mongo/db/background.cpp index 4d8b474e6c1..56336acd4ae 100644 --- a/src/mongo/db/background.cpp +++ b/src/mongo/db/background.cpp @@ -90,14 +90,14 @@ namespace { _noOpsInProg.wait(lk); } - void recordBeginAndInsert(BgInfoMap* bgiMap, const StringData& key) { + void recordBeginAndInsert(BgInfoMap* bgiMap, StringData key) { boost::shared_ptr<BgInfo>& bgInfo = bgiMap->get(key); if (!bgInfo) bgInfo.reset(new BgInfo); bgInfo->recordBegin(); } - void recordEndAndRemove(BgInfoMap* bgiMap, const StringData& key) { + void recordEndAndRemove(BgInfoMap* bgiMap, StringData key) { BgInfoMapIterator iter = bgiMap->find(key); fassert(17431, iter != bgiMap->end()); if (0 == iter->second->recordEnd()) { @@ -108,7 +108,7 @@ namespace { void awaitNoBgOps( boost::unique_lock<boost::mutex>& lk, BgInfoMap* bgiMap, - const StringData& key) { + StringData key) { boost::shared_ptr<BgInfo> bgInfo = mapFindWithDefault( *bgiMap, key, boost::shared_ptr<BgInfo>()); @@ -118,41 +118,41 @@ namespace { } } // namespace - bool BackgroundOperation::inProgForDb(const StringData& db) { + bool BackgroundOperation::inProgForDb(StringData db) { boost::mutex::scoped_lock lk(m); return dbsInProg.find(db) != dbsInProg.end(); } - bool BackgroundOperation::inProgForNs(const StringData& ns) { + bool BackgroundOperation::inProgForNs(StringData ns) { boost::mutex::scoped_lock lk(m); return nsInProg.find(ns) != nsInProg.end(); } - void BackgroundOperation::assertNoBgOpInProgForDb(const StringData& db) { + void BackgroundOperation::assertNoBgOpInProgForDb(StringData db) { uassert(ErrorCodes::BackgroundOperationInProgressForDatabase, mongoutils::str::stream() << "cannot perform operation: a background operation is currently running for " "database " << db, !inProgForDb(db)); } - void BackgroundOperation::assertNoBgOpInProgForNs(const StringData& ns) { + void BackgroundOperation::assertNoBgOpInProgForNs(StringData ns) { uassert(ErrorCodes::BackgroundOperationInProgressForNamespace, mongoutils::str::stream() << "cannot perform operation: a background operation is currently running for " "collection " << ns, !inProgForNs(ns)); } - void BackgroundOperation::awaitNoBgOpInProgForDb(const StringData& db) { + void BackgroundOperation::awaitNoBgOpInProgForDb(StringData db) { boost::unique_lock<boost::mutex> lk(m); awaitNoBgOps(lk, &dbsInProg, db); } - void BackgroundOperation::awaitNoBgOpInProgForNs(const StringData& ns) { + void BackgroundOperation::awaitNoBgOpInProgForNs(StringData ns) { boost::unique_lock<boost::mutex> lk(m); awaitNoBgOps(lk, &nsInProg, ns); } - BackgroundOperation::BackgroundOperation(const StringData& ns) : _ns(ns) { + BackgroundOperation::BackgroundOperation(StringData ns) : _ns(ns) { boost::mutex::scoped_lock lk(m); recordBeginAndInsert(&dbsInProg, _ns.db()); recordBeginAndInsert(&nsInProg, _ns.ns()); |