From 7733b8743193845ee5e6728bddc7ce14352b06af Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Wed, 25 Apr 2018 15:18:27 -0700 Subject: [PATCH] Don't copy things on Dictionary::Set --- native_mate/converter.h | 2 +- native_mate/dictionary.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/native_mate/converter.h b/native_mate/converter.h index 07c01d6529..0574a8f386 100644 --- a/native_mate/converter.h +++ b/native_mate/converter.h @@ -343,7 +343,7 @@ struct ToV8Traits { template bool TryConvertToV8(v8::Isolate* isolate, - T input, + const T& input, v8::Local* output) { return ToV8Traits::TryConvertToV8(isolate, input, output); } diff --git a/native_mate/dictionary.h b/native_mate/dictionary.h index 5a56a9e06b..9e80cb99ac 100644 --- a/native_mate/dictionary.h +++ b/native_mate/dictionary.h @@ -69,7 +69,7 @@ class Dictionary { } template - bool Set(const base::StringPiece& key, T val) { + bool Set(const base::StringPiece& key, const T& val) { v8::Local v8_value; if (!TryConvertToV8(isolate_, val, &v8_value)) return false;