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" |
(...skipping 22 matching lines...) Expand all Loading... | |
33 Dart_Handle send_port = Dart_GetField(builtin_lib, field_name); | 33 Dart_Handle send_port = Dart_GetField(builtin_lib, field_name); |
34 RETURN_IF_ERROR(send_port); | 34 RETURN_IF_ERROR(send_port); |
35 if (!Dart_IsNull(send_port)) { | 35 if (!Dart_IsNull(send_port)) { |
36 // Already created and set. | 36 // Already created and set. |
37 return Dart_True(); | 37 return Dart_True(); |
38 } | 38 } |
39 send_port = Dart_NewSendPort(load_port_); | 39 send_port = Dart_NewSendPort(load_port_); |
40 RETURN_IF_ERROR(send_port); | 40 RETURN_IF_ERROR(send_port); |
41 Dart_Handle result = Dart_SetField(builtin_lib, field_name, send_port); | 41 Dart_Handle result = Dart_SetField(builtin_lib, field_name, send_port); |
42 RETURN_IF_ERROR(result); | 42 RETURN_IF_ERROR(result); |
43 // Also set the _isolateId field. | |
44 result = Dart_SetField(builtin_lib, | |
45 DartUtils::NewString("_isolateId"), | |
46 Dart_NewInteger(Dart_GetMainPortId())); | |
47 RETURN_IF_ERROR(result); | |
turnidge
2016/06/03 17:50:24
Would be nice if the function failed on a second c
Cutch
2016/06/03 22:07:32
Done.
| |
43 return Dart_True(); | 48 return Dart_True(); |
44 } | 49 } |
45 | 50 |
46 } // namespace bin | 51 } // namespace bin |
47 } // namespace dart | 52 } // namespace dart |
OLD | NEW |