Chromium Code Reviews| Index: src/wasm/wasm-result.h |
| diff --git a/src/wasm/wasm-result.h b/src/wasm/wasm-result.h |
| index e741de8e5e187e8a4fef4053f910128f61235e73..94f3cb6afa41cb439b73acca37fae48e7e694038 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" |
| @@ -40,7 +42,16 @@ enum ErrorCode { |
| template <typename T> |
| struct Result { |
| Result() : val(), error_code(kSuccess), start(nullptr), error_pc(nullptr) { |
| - error_msg.Reset(nullptr); |
| + error_msg.reset(nullptr); |
|
Igor Sheludko
2016/07/25 08:56:44
Not necessary. Default constructor already does th
jochen (gone - plz use gerrit)
2016/07/25 09:14:48
done
|
| + } |
| + Result(Result&& other) { |
| + CopyFrom(other); |
| + val = other.val; |
|
Igor Sheludko
2016/07/25 08:56:44
How about using std::move(*this, other) here and i
jochen (gone - plz use gerrit)
2016/07/25 09:14:48
done.
I didn't inline CopyFrom (now MoveFrom), as
|
| + } |
| + Result& operator=(Result&& other) { |
| + CopyFrom(other); |
| + val = other.val; |
| + return *this; |
| } |
| T val; |
| @@ -48,7 +59,7 @@ 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; } |
| @@ -59,8 +70,11 @@ struct Result { |
| start = that.start; |
| error_pc = that.error_pc; |
| error_pt = that.error_pt; |
| - error_msg = that.error_msg; |
| + error_msg.swap(that.error_msg); |
| } |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Result); |
| }; |
| template <typename T> |