From 1d10bc671e223faa82e354d38be970a39bf4637d Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Wed, 6 Mar 2019 10:34:47 +0000 Subject: [PATCH] Move rather than copy large structures when calling methods Change-Id: Icb268526353c33afb47d312c0f242c2bf5ba3c3b --- dali-toolkit/internal/feedback/feedback-style.cpp | 10 +++++----- dali-toolkit/internal/feedback/feedback-style.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dali-toolkit/internal/feedback/feedback-style.cpp b/dali-toolkit/internal/feedback/feedback-style.cpp index b3d867c..4375a29 100644 --- a/dali-toolkit/internal/feedback/feedback-style.cpp +++ b/dali-toolkit/internal/feedback/feedback-style.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -307,7 +307,7 @@ void FeedbackStyle::LoadFromString( const string& data ) if( signalFeedbackInfo.mHasHapticFeedbackInfo || signalFeedbackInfo.mHasSoundFeedbackInfo ) { - AddSignalInfo( themeInfo, signalFeedbackInfo ); + AddSignalInfo( themeInfo, std::move( signalFeedbackInfo ) ); } } } @@ -320,10 +320,10 @@ void FeedbackStyle::LoadFromString( const string& data ) } // LoadFromString() -void FeedbackStyle::AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo signalInfo ) +void FeedbackStyle::AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo&& signalInfo ) { bool updated = false; - std::vector::iterator iter; + SignalFeedbackInfoContainer::iterator iter; // If info exists for the signal then update it, else add new for( iter = styleInfo.mSignalFeedbackInfoList.begin(); iter != styleInfo.mSignalFeedbackInfoList.end(); ++iter ) @@ -344,7 +344,7 @@ void FeedbackStyle::AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackI if( !updated ) { - styleInfo.mSignalFeedbackInfoList.push_back( signalInfo ); + styleInfo.mSignalFeedbackInfoList.emplace_back( std::move( signalInfo ) ); } } diff --git a/dali-toolkit/internal/feedback/feedback-style.h b/dali-toolkit/internal/feedback/feedback-style.h index bf6ea3f..3693369 100644 --- a/dali-toolkit/internal/feedback/feedback-style.h +++ b/dali-toolkit/internal/feedback/feedback-style.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_FEEDBACK_STYLE_H__ /* - * Copyright (c) 2014 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -121,7 +121,7 @@ private: * @param [in] styleInfo The information will be stored here. * @param [in] signalInfo The information to add. */ - void AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo signalInfo ); + void AddSignalInfo( FeedbackStyleInfo& styleInfo, SignalFeedbackInfo&& signalInfo ); /** * Map a pattern string to feedback pattern ID. -- 2.7.4