You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2020/01/08 15:57:26 UTC
[mesos] 02/02: Constructed `HttpEvent` from owning instead of raw
pointers.
This is an automated email from the ASF dual-hosted git repository.
bennoe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git
commit 9c0689fbd55a04a70c01555f6b0d893e5fb2ab51
Author: Benjamin Bannier <bb...@apache.org>
AuthorDate: Mon Dec 2 13:44:40 2019 +0100
Constructed `HttpEvent` from owning instead of raw pointers.
Review: https://reviews.apache.org/r/71853
---
3rdparty/libprocess/include/process/event.hpp | 8 ++++----
3rdparty/libprocess/src/process.cpp | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/3rdparty/libprocess/include/process/event.hpp b/3rdparty/libprocess/include/process/event.hpp
index 6d7f812..af4d6b7 100644
--- a/3rdparty/libprocess/include/process/event.hpp
+++ b/3rdparty/libprocess/include/process/event.hpp
@@ -142,10 +142,10 @@ struct MessageEvent : Event
struct HttpEvent : Event
{
HttpEvent(
- http::Request* _request,
- Promise<http::Response>* _response)
- : request(_request),
- response(_response) {}
+ std::unique_ptr<http::Request>&& _request,
+ std::unique_ptr<Promise<http::Response>>&& _response)
+ : request(std::move(_request)),
+ response(std::move(_response)) {}
HttpEvent(HttpEvent&&) = default;
HttpEvent(const HttpEvent&) = delete;
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 1de6da2..4ae5de3 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -2760,9 +2760,7 @@ void ProcessManager::handle(
}
if (use(receiver)) {
- // The promise is created here but its ownership is passed
- // into the HttpEvent created below.
- Promise<Response>* promise(new Promise<Response>());
+ std::unique_ptr<Promise<Response>> promise(new Promise<Response>());
PID<HttpProxy> proxy = socket_manager->proxy(socket);
@@ -2772,7 +2770,9 @@ void ProcessManager::handle(
// TODO(benh): Use the sender PID in order to capture
// happens-before timing relationships for testing.
- deliver(receiver, new HttpEvent(request, promise));
+ deliver(
+ receiver,
+ new HttpEvent(std::unique_ptr<Request>(request), std::move(promise)));
return;
}