OLD | NEW |
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 namespace dart { | 13 namespace dart { |
14 namespace bin { | 14 namespace bin { |
15 | 15 |
16 void Builtin::SetLoadPort(Dart_Port port) { | 16 void Builtin::SetLoadPort(Dart_Port port) { |
17 load_port_ = port; | 17 load_port_ = port; |
18 ASSERT(load_port_ != ILLEGAL_PORT); | 18 ASSERT(load_port_ != DART_ILLEGAL_PORT); |
19 Dart_Handle field_name = DartUtils::NewString("_loadPort"); | 19 Dart_Handle field_name = DartUtils::NewString("_loadPort"); |
20 ASSERT(!Dart_IsError(field_name)); | 20 ASSERT(!Dart_IsError(field_name)); |
21 Dart_Handle builtin_lib = | 21 Dart_Handle builtin_lib = |
22 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); | 22 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); |
23 ASSERT(!Dart_IsError(builtin_lib)); | 23 ASSERT(!Dart_IsError(builtin_lib)); |
24 Dart_Handle send_port = Dart_GetField(builtin_lib, field_name); | 24 Dart_Handle send_port = Dart_GetField(builtin_lib, field_name); |
25 ASSERT(!Dart_IsError(send_port)); | 25 ASSERT(!Dart_IsError(send_port)); |
26 if (!Dart_IsNull(send_port)) { | 26 if (!Dart_IsNull(send_port)) { |
27 // Already created and set. | 27 // Already created and set. |
28 return; | 28 return; |
29 } | 29 } |
30 send_port = Dart_NewSendPort(load_port_); | 30 send_port = Dart_NewSendPort(load_port_); |
31 ASSERT(!Dart_IsError(send_port)); | 31 ASSERT(!Dart_IsError(send_port)); |
32 Dart_Handle result = Dart_SetField(builtin_lib, field_name, send_port); | 32 Dart_Handle result = Dart_SetField(builtin_lib, field_name, send_port); |
33 ASSERT(!Dart_IsError(result)); | 33 ASSERT(!Dart_IsError(result)); |
34 } | 34 } |
35 | 35 |
36 } // namespace bin | 36 } // namespace bin |
37 } // namespace dart | 37 } // namespace dart |
OLD | NEW |