Commit dbac4430 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Move the context in futures Core::doCallback

Summary: [Folly] Move the context in futures `Core::doCallback` to shrink code size and to improve runtime performance (fewer branches, fewer atomic RMWs, smaller code size).

Reviewed By: andriigrynenko

Differential Revision: D15073122

fbshipit-source-id: f1b5cb01ea9ccaa69ac5b42b01a8ee5fa1badb8a
parent 7fcc5ddc
......@@ -582,7 +582,7 @@ class Core final {
keepAlive = std::move(x)]() mutable {
auto cr = std::move(core_ref);
Core* const core = cr.getCore();
RequestContextScopeGuard rctx(core->context_);
RequestContextScopeGuard rctx(std::move(core->context_));
core->callback_(std::move(core->result_));
});
} catch (const std::exception& e) {
......@@ -591,7 +591,7 @@ class Core final {
ew = exception_wrapper(std::current_exception());
}
if (ew) {
RequestContextScopeGuard rctx(context_);
RequestContextScopeGuard rctx(std::move(context_));
result_ = Try<T>(std::move(ew));
callback_(std::move(result_));
}
......@@ -602,7 +602,7 @@ class Core final {
callback_.~Callback();
detachOne();
};
RequestContextScopeGuard rctx(context_);
RequestContextScopeGuard rctx(std::move(context_));
callback_(std::move(result_));
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment