From ace5884d71afb20a2cbf4e02ef9e3ff1ccaf5308 Mon Sep 17 00:00:00 2001 From: jiakai Date: Fri, 14 Jun 2019 21:02:15 +0800 Subject: [PATCH] Reuse tensorflow::MakeUnique Change-Id: If62f8399c8a885f287bba62ecd244ce98561ae64 --- .../core/distributed_runtime/partial_run_mgr.cc | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tensorflow/core/distributed_runtime/partial_run_mgr.cc b/tensorflow/core/distributed_runtime/partial_run_mgr.cc index c0dbabf9a21..f9f57ee5b13 100644 --- a/tensorflow/core/distributed_runtime/partial_run_mgr.cc +++ b/tensorflow/core/distributed_runtime/partial_run_mgr.cc @@ -15,16 +15,9 @@ limitations under the License. #include "tensorflow/core/distributed_runtime/partial_run_mgr.h" -namespace tensorflow { +#include "tensorflow/core/util/ptr_util.h" -namespace { -// TODO(suharshs): Move this to a common location to allow other part of the -// repo to use it. -template -std::unique_ptr MakeUnique(Args&&... args) { - return std::unique_ptr(new T(std::forward(args)...)); -} -} // namespace +namespace tensorflow { bool PartialRunMgr::FindOrCreate(int step_id, CancellationManager** cancellation_manager) { @@ -35,8 +28,8 @@ bool PartialRunMgr::FindOrCreate(int step_id, return false; } - std::unique_ptr partial_run = MakeUnique(); - partial_run->cancellation_manager = MakeUnique(); + std::unique_ptr partial_run = tensorflow::MakeUnique(); + partial_run->cancellation_manager = tensorflow::MakeUnique(); *cancellation_manager = partial_run->cancellation_manager.get(); step_id_to_partial_run_[step_id] = std::move(partial_run); return true;