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

Unified Diff: src/wasm/decoder.h

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates 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
« no previous file with comments | « src/string-stream.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/decoder.h
diff --git a/src/wasm/decoder.h b/src/wasm/decoder.h
index 32e3b61f9759198b5da87e1975a0fd856e0a4bc4..9891b8130869d9d19090f297581f891996374539 100644
--- a/src/wasm/decoder.h
+++ b/src/wasm/decoder.h
@@ -5,6 +5,8 @@
#ifndef V8_WASM_DECODER_H_
#define V8_WASM_DECODER_H_
+#include <memory>
+
#include "src/base/compiler-specific.h"
#include "src/base/smart-pointers.h"
#include "src/flags.h"
@@ -247,7 +249,7 @@ class Decoder {
va_start(arguments, format);
base::OS::VSNPrintF(buffer, kMaxErrorMsg - 1, format, arguments);
va_end(arguments);
- error_msg_.Reset(buffer);
+ error_msg_.reset(buffer);
error_pc_ = pc;
error_pt_ = pt;
onFirstError();
@@ -280,7 +282,7 @@ class Decoder {
result.error_pc = error_pc_;
result.error_pt = error_pt_;
// transfer ownership of the error to the result.
- result.error_msg.Reset(error_msg_.Detach());
+ result.error_msg.reset(error_msg_.release());
} else {
result.error_code = kSuccess;
}
@@ -296,11 +298,11 @@ class Decoder {
end_ = end;
error_pc_ = nullptr;
error_pt_ = nullptr;
- error_msg_.Reset(nullptr);
+ error_msg_.reset();
}
bool ok() const { return error_pc_ == nullptr; }
- bool failed() const { return !error_msg_.is_empty(); }
+ bool failed() const { return !!error_msg_; }
bool more() const { return pc_ < limit_; }
const byte* start() { return start_; }
@@ -314,7 +316,7 @@ class Decoder {
const byte* end_;
const byte* error_pc_;
const byte* error_pt_;
- base::SmartArrayPointer<char> error_msg_;
+ std::unique_ptr<char[]> error_msg_;
private:
template <typename IntType, bool is_signed>
« no previous file with comments | « src/string-stream.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698