Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Unified Diff: src/wasm/wasm-result.h

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: even less redness Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698