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

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

Issue 2084573002: Upgrade Wasm JS API, step 1 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Separate test refactorings Created 4 years, 6 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.cc
diff --git a/src/wasm/wasm-result.cc b/src/wasm/wasm-result.cc
index 0f5529fe385fc1a427930b6a562c1c73ede46ba4..30268ac8ad52d4ee03ee3b80e99393283e77d2f7 100644
--- a/src/wasm/wasm-result.cc
+++ b/src/wasm/wasm-result.cc
@@ -28,11 +28,10 @@ std::ostream& operator<<(std::ostream& os, const ErrorCode& error_code) {
}
void ErrorThrower::Error(const char* format, ...) {
- // only report the first error.
- if (error_ || isolate_->has_pending_exception()) return;
- error_ = true;
- char buffer[256];
+ // Only report the first error.
+ if (error()) return;
+ char buffer[256];
va_list arguments;
va_start(arguments, format);
base::OS::VSNPrintF(buffer, 255, format, arguments);
@@ -44,8 +43,13 @@ void ErrorThrower::Error(const char* format, ...) {
}
str << buffer;
- isolate_->ScheduleThrow(
- *isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str()));
+ message_ = isolate_->factory()->NewStringFromAsciiChecked(str.str().c_str());
+}
+
+ErrorThrower::~ErrorThrower() {
+ if (error() && !isolate_->has_pending_exception()) {
+ isolate_->ScheduleThrow(*message_);
+ }
}
} // namespace wasm
} // namespace internal

Powered by Google App Engine
This is Rietveld 408576698