OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_native_api.h" | 5 #include "include/dart_native_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 280 |
281 static const char* CanonicalizeUri(Thread* thread, | 281 static const char* CanonicalizeUri(Thread* thread, |
282 const Library& library, | 282 const Library& library, |
283 const String& uri, | 283 const String& uri, |
284 char** error) { | 284 char** error) { |
285 const char* result = NULL; | 285 const char* result = NULL; |
286 Zone* zone = thread->zone(); | 286 Zone* zone = thread->zone(); |
287 Isolate* isolate = thread->isolate(); | 287 Isolate* isolate = thread->isolate(); |
288 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 288 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
289 if (handler != NULL) { | 289 if (handler != NULL) { |
| 290 TransitionVMToNative transition(thread); |
290 Dart_EnterScope(); | 291 Dart_EnterScope(); |
291 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, | 292 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, |
292 Api::NewHandle(thread, library.raw()), | 293 Api::NewHandle(thread, library.raw()), |
293 Api::NewHandle(thread, uri.raw())); | 294 Api::NewHandle(thread, uri.raw())); |
294 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); | 295 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); |
295 if (obj.IsString()) { | 296 if (obj.IsString()) { |
296 result = String2UTF8(String::Cast(obj)); | 297 result = String2UTF8(String::Cast(obj)); |
297 } else if (obj.IsError()) { | 298 } else if (obj.IsError()) { |
298 Error& error_obj = Error::Handle(); | 299 Error& error_obj = Error::Handle(); |
299 error_obj ^= obj.raw(); | 300 error_obj ^= obj.raw(); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 MessageWriter writer(&data, &allocator, false); | 445 MessageWriter writer(&data, &allocator, false); |
445 writer.WriteMessage(msg); | 446 writer.WriteMessage(msg); |
446 | 447 |
447 PortMap::PostMessage(new Message(port.Id(), | 448 PortMap::PostMessage(new Message(port.Id(), |
448 data, writer.BytesWritten(), | 449 data, writer.BytesWritten(), |
449 Message::kOOBPriority)); | 450 Message::kOOBPriority)); |
450 return Object::null(); | 451 return Object::null(); |
451 } | 452 } |
452 | 453 |
453 } // namespace dart | 454 } // namespace dart |
OLD | NEW |