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

Side by Side Diff: runtime/bin/builtin_common.cc

Issue 1998963003: Rework standalone to use a synchronous loader that does not invoke Dart code (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/bin/builtin_impl_sources.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "bin/builtin.h" 9 #include "bin/builtin.h"
10 #include "bin/dartutils.h" 10 #include "bin/dartutils.h"
11 #include "bin/platform.h" 11 #include "bin/platform.h"
12 12
13 // Return the error from the containing function if handle is in error handle. 13 // Return the error from the containing function if handle is in error handle.
14 #define RETURN_IF_ERROR(handle) \ 14 #define RETURN_IF_ERROR(handle) \
15 { \ 15 { \
16 Dart_Handle __handle = handle; \ 16 Dart_Handle __handle = handle; \
17 if (Dart_IsError((__handle))) { \ 17 if (Dart_IsError((__handle))) { \
18 return __handle; \ 18 return __handle; \
19 } \ 19 } \
20 } 20 }
21 21
22 namespace dart { 22 namespace dart {
23 namespace bin { 23 namespace bin {
24 24
25 Dart_Handle Builtin::SetLoadPort(Dart_Port port) { 25 Dart_Handle Builtin::SetLoadPort(Dart_Port port) {
26 Dart_Handle builtin_lib =
27 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
28 RETURN_IF_ERROR(builtin_lib);
29 // Set the _isolateId field.
30 Dart_Handle result = Dart_SetField(builtin_lib,
31 DartUtils::NewString("_isolateId"),
32 Dart_NewInteger(Dart_GetMainPortId()));
33 RETURN_IF_ERROR(result);
26 load_port_ = port; 34 load_port_ = port;
27 ASSERT(load_port_ != ILLEGAL_PORT); 35 ASSERT(load_port_ != ILLEGAL_PORT);
28 Dart_Handle field_name = DartUtils::NewString("_loadPort"); 36 Dart_Handle field_name = DartUtils::NewString("_loadPort");
29 RETURN_IF_ERROR(field_name); 37 RETURN_IF_ERROR(field_name);
30 Dart_Handle builtin_lib =
31 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
32 RETURN_IF_ERROR(builtin_lib);
33 Dart_Handle send_port = Dart_GetField(builtin_lib, field_name); 38 Dart_Handle send_port = Dart_GetField(builtin_lib, field_name);
34 RETURN_IF_ERROR(send_port); 39 RETURN_IF_ERROR(send_port);
35 if (!Dart_IsNull(send_port)) { 40 if (!Dart_IsNull(send_port)) {
36 // Already created and set. 41 // Already created and set.
37 return Dart_True(); 42 return Dart_True();
38 } 43 }
39 send_port = Dart_NewSendPort(load_port_); 44 send_port = Dart_NewSendPort(load_port_);
40 RETURN_IF_ERROR(send_port); 45 RETURN_IF_ERROR(send_port);
41 Dart_Handle result = Dart_SetField(builtin_lib, field_name, send_port); 46 result = Dart_SetField(builtin_lib, field_name, send_port);
42 RETURN_IF_ERROR(result); 47 RETURN_IF_ERROR(result);
43 return Dart_True(); 48 return Dart_True();
44 } 49 }
45 50
46 } // namespace bin 51 } // namespace bin
47 } // namespace dart 52 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/bin/builtin.dart ('k') | runtime/bin/builtin_impl_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698