summaryrefslogtreecommitdiff
path: root/src/mongo/db/pipeline/expression_context.cpp
diff options
context:
space:
mode:
authorJacob Evans <jacob.evans@10gen.com>2020-05-12 15:55:02 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-05-16 01:30:05 +0000
commita7f769dd597e33e988832c43c99912c1d3139c9b (patch)
tree9366f0dfc75db2c9c92e2b101de17542ae573e89 /src/mongo/db/pipeline/expression_context.cpp
parent6b38c78843e7eb58dc344d88903727762d7d486d (diff)
downloadmongo-a7f769dd597e33e988832c43c99912c1d3139c9b.tar.gz
SERVER-47713 Change Expression code to remove intrusive ExpressionContext
Diffstat (limited to 'src/mongo/db/pipeline/expression_context.cpp')
-rw-r--r--src/mongo/db/pipeline/expression_context.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/src/mongo/db/pipeline/expression_context.cpp b/src/mongo/db/pipeline/expression_context.cpp
index a077071dca3..8625cf80903 100644
--- a/src/mongo/db/pipeline/expression_context.cpp
+++ b/src/mongo/db/pipeline/expression_context.cpp
@@ -36,7 +36,6 @@
#include "mongo/db/query/collation/collation_spec.h"
#include "mongo/db/query/collation/collator_factory_interface.h"
#include "mongo/util/intrusive_counter.h"
-#include "mongo/util/scopeguard.h"
namespace mongo {
@@ -126,16 +125,8 @@ ExpressionContext::ExpressionContext(
if (!isMapReduce) {
jsHeapLimitMB = internalQueryJavaScriptHeapSizeLimitMB.load();
}
- if (letParameters) {
- // TODO SERVER-47713: One possible fix is to change the interface of everything that needs
- // an expression context intrusive_ptr to take a raw ptr.
- auto intrusiveThis = boost::intrusive_ptr{this};
- ON_BLOCK_EXIT([&] {
- intrusiveThis.detach();
- unsafeRefDecRefCountTo(0u);
- });
- variables.seedVariablesWithLetParameters(intrusiveThis, *letParameters);
- }
+ if (letParameters)
+ variables.seedVariablesWithLetParameters(this, *letParameters);
}
ExpressionContext::ExpressionContext(OperationContext* opCtx,
@@ -160,16 +151,8 @@ ExpressionContext::ExpressionContext(OperationContext* opCtx,
}
jsHeapLimitMB = internalQueryJavaScriptHeapSizeLimitMB.load();
- if (letParameters) {
- // TODO SERVER-47713: One possible fix is to change the interface of everything that needs
- // an expression context intrusive_ptr to take a raw ptr.
- auto intrusiveThis = boost::intrusive_ptr{this};
- ON_BLOCK_EXIT([&] {
- intrusiveThis.detach();
- unsafeRefDecRefCountTo(0u);
- });
- variables.seedVariablesWithLetParameters(intrusiveThis, *letParameters);
- }
+ if (letParameters)
+ variables.seedVariablesWithLetParameters(this, *letParameters);
}
void ExpressionContext::checkForInterrupt() {
@@ -181,9 +164,8 @@ void ExpressionContext::checkForInterrupt() {
}
}
-ExpressionContext::CollatorStash::CollatorStash(
- const boost::intrusive_ptr<ExpressionContext>& expCtx,
- std::unique_ptr<CollatorInterface> newCollator)
+ExpressionContext::CollatorStash::CollatorStash(ExpressionContext* const expCtx,
+ std::unique_ptr<CollatorInterface> newCollator)
: _expCtx(expCtx), _originalCollator(std::move(_expCtx->_collator)) {
_expCtx->setCollator(std::move(newCollator));
}