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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 static const char* CanonicalizeUri(Thread* thread, | 292 static const char* CanonicalizeUri(Thread* thread, |
293 const Library& library, | 293 const Library& library, |
294 const String& uri, | 294 const String& uri, |
295 char** error) { | 295 char** error) { |
296 const char* result = NULL; | 296 const char* result = NULL; |
297 Zone* zone = thread->zone(); | 297 Zone* zone = thread->zone(); |
298 Isolate* isolate = thread->isolate(); | 298 Isolate* isolate = thread->isolate(); |
299 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 299 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
300 if (handler != NULL) { | 300 if (handler != NULL) { |
| 301 TransitionVMToNative transition(thread); |
301 Dart_EnterScope(); | 302 Dart_EnterScope(); |
302 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, | 303 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, |
303 Api::NewHandle(thread, library.raw()), | 304 Api::NewHandle(thread, library.raw()), |
304 Api::NewHandle(thread, uri.raw())); | 305 Api::NewHandle(thread, uri.raw())); |
305 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); | 306 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); |
306 if (obj.IsString()) { | 307 if (obj.IsString()) { |
307 result = String2UTF8(String::Cast(obj)); | 308 result = String2UTF8(String::Cast(obj)); |
308 } else if (obj.IsError()) { | 309 } else if (obj.IsError()) { |
309 Error& error_obj = Error::Handle(); | 310 Error& error_obj = Error::Handle(); |
310 error_obj ^= obj.raw(); | 311 error_obj ^= obj.raw(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 MessageWriter writer(&data, &allocator, false); | 446 MessageWriter writer(&data, &allocator, false); |
446 writer.WriteMessage(msg); | 447 writer.WriteMessage(msg); |
447 | 448 |
448 PortMap::PostMessage(new Message(port.Id(), | 449 PortMap::PostMessage(new Message(port.Id(), |
449 data, writer.BytesWritten(), | 450 data, writer.BytesWritten(), |
450 Message::kOOBPriority)); | 451 Message::kOOBPriority)); |
451 return Object::null(); | 452 return Object::null(); |
452 } | 453 } |
453 | 454 |
454 } // namespace dart | 455 } // namespace dart |
OLD | NEW |