Index: src/wasm/wasm-result.h |
diff --git a/src/wasm/wasm-result.h b/src/wasm/wasm-result.h |
index e741de8e5e187e8a4fef4053f910128f61235e73..af929a500098e781f2a6e321a1a4cfd5167ab121 100644 |
--- a/src/wasm/wasm-result.h |
+++ b/src/wasm/wasm-result.h |
@@ -5,6 +5,8 @@ |
#ifndef V8_WASM_RESULT_H_ |
#define V8_WASM_RESULT_H_ |
+#include <memory> |
+ |
#include "src/base/compiler-specific.h" |
#include "src/base/smart-pointers.h" |
@@ -39,8 +41,12 @@ enum ErrorCode { |
// The overall result of decoding a function or a module. |
template <typename T> |
struct Result { |
- Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) { |
- error_msg.Reset(nullptr); |
+ Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) {} |
+ Result(Result&& other) { *this = std::move(other); } |
+ Result& operator=(Result&& other) { |
+ MoveFrom(other); |
+ val = other.val; |
+ return *this; |
} |
T val; |
@@ -48,19 +54,22 @@ struct Result { |
const byte* start; |
const byte* error_pc; |
const byte* error_pt; |
- base::SmartArrayPointer<char> error_msg; |
+ std::unique_ptr<char[]> error_msg; |
bool ok() const { return error_code == kSuccess; } |
bool failed() const { return error_code != kSuccess; } |
template <typename V> |
- void CopyFrom(Result<V>& that) { |
+ void MoveFrom(Result<V>& that) { |
error_code = that.error_code; |
start = that.start; |
error_pc = that.error_pc; |
error_pt = that.error_pt; |
- error_msg = that.error_msg; |
+ error_msg = std::move(that.error_msg); |
} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(Result); |
}; |
template <typename T> |