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

Unified Diff: runtime/bin/builtin_common.cc

Issue 1275353005: VM thread shutdown. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merge Created 5 years, 3 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 | « runtime/bin/builtin.h ('k') | runtime/bin/dartutils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/builtin_common.cc
diff --git a/runtime/bin/builtin_common.cc b/runtime/bin/builtin_common.cc
index da754a5222d0d4842e7764b36fc5848f0c3be614..678e48b7163fac199fded9d936144649417ac2a6 100644
--- a/runtime/bin/builtin_common.cc
+++ b/runtime/bin/builtin_common.cc
@@ -10,27 +10,37 @@
#include "bin/dartutils.h"
#include "bin/platform.h"
+// Return the error from the containing function if handle is in error handle.
+#define RETURN_IF_ERROR(handle) \
+ { \
+ Dart_Handle __handle = handle; \
+ if (Dart_IsError((__handle))) { \
+ return __handle; \
+ } \
+ }
+
namespace dart {
namespace bin {
-void Builtin::SetLoadPort(Dart_Port port) {
+Dart_Handle Builtin::SetLoadPort(Dart_Port port) {
load_port_ = port;
ASSERT(load_port_ != ILLEGAL_PORT);
Dart_Handle field_name = DartUtils::NewString("_loadPort");
- ASSERT(!Dart_IsError(field_name));
+ RETURN_IF_ERROR(field_name);
Dart_Handle builtin_lib =
Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
- ASSERT(!Dart_IsError(builtin_lib));
+ RETURN_IF_ERROR(builtin_lib);
Dart_Handle send_port = Dart_GetField(builtin_lib, field_name);
- ASSERT(!Dart_IsError(send_port));
+ RETURN_IF_ERROR(send_port);
if (!Dart_IsNull(send_port)) {
// Already created and set.
- return;
+ return Dart_True();
}
send_port = Dart_NewSendPort(load_port_);
- ASSERT(!Dart_IsError(send_port));
+ RETURN_IF_ERROR(send_port);
Dart_Handle result = Dart_SetField(builtin_lib, field_name, send_port);
- ASSERT(!Dart_IsError(result));
+ RETURN_IF_ERROR(result);
+ return Dart_True();
}
} // namespace bin
« no previous file with comments | « runtime/bin/builtin.h ('k') | runtime/bin/dartutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698