nwangtw commented on a change in pull request #3282: WIP STREAMCOMP-2724: 
Stream Manager migrated to mainly use smart pointers instead of a manual memory 
management
URL: https://github.com/apache/incubator-heron/pull/3282#discussion_r291707470
 
 

 ##########
 File path: heron/instance/src/cpp/slave/slave.cpp
 ##########
 @@ -79,19 +80,22 @@ void Slave::InternalStart() {
   eventLoop_->loop();
 }
 
-void Slave::HandleGatewayData(google::protobuf::Message* msg) {
+void Slave::HandleGatewayData(unique_ptr<google::protobuf::Message> msg) {
   if (msg->GetTypeName() == pplan_typename_) {
     LOG(INFO) << "Slave Received a new pplan message from Gateway";
-    auto pplan = static_cast<proto::system::PhysicalPlan*>(msg);
-    HandleNewPhysicalPlan(pplan);
+    auto pplan = unique_ptr<proto::system::PhysicalPlan>(
+            static_cast<proto::system::PhysicalPlan*>(msg.release()));
+    HandleNewPhysicalPlan(std::move(pplan));
   } else {
-    auto tupleSet = static_cast<proto::system::HeronTupleSet2*>(msg);
-    HandleStMgrTuples(tupleSet);
+    auto tupleSet = unique_ptr<proto::system::HeronTupleSet2>(
+            static_cast<proto::system::HeronTupleSet2*>(msg.release()));
+    HandleStMgrTuples(std::move(tupleSet));
   }
 }
 
-void Slave::HandleNewPhysicalPlan(proto::system::PhysicalPlan* pplan) {
-  taskContext_->newPhysicalPlan(pplan);
+void Slave::HandleNewPhysicalPlan(unique_ptr<proto::system::PhysicalPlan> 
pplan) {
+  std::shared_ptr<proto::system::PhysicalPlan> newPplan = std::move(pplan);
 
 Review comment:
   kk. Thanks.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to