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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 | 269 |
270 static const char* CanonicalizeUri(Thread* thread, | 270 static const char* CanonicalizeUri(Thread* thread, |
271 const Library& library, | 271 const Library& library, |
272 const String& uri, | 272 const String& uri, |
273 char** error) { | 273 char** error) { |
274 const char* result = NULL; | 274 const char* result = NULL; |
275 Zone* zone = thread->zone(); | 275 Zone* zone = thread->zone(); |
276 Isolate* isolate = thread->isolate(); | 276 Isolate* isolate = thread->isolate(); |
277 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 277 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
278 if (handler != NULL) { | 278 if (handler != NULL) { |
| 279 TransitionVMToNative transition(thread); |
279 Dart_EnterScope(); | 280 Dart_EnterScope(); |
280 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, | 281 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, |
281 Api::NewHandle(thread, library.raw()), | 282 Api::NewHandle(thread, library.raw()), |
282 Api::NewHandle(thread, uri.raw())); | 283 Api::NewHandle(thread, uri.raw())); |
283 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); | 284 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); |
284 if (obj.IsString()) { | 285 if (obj.IsString()) { |
285 result = String2UTF8(String::Cast(obj)); | 286 result = String2UTF8(String::Cast(obj)); |
286 } else if (obj.IsError()) { | 287 } else if (obj.IsError()) { |
287 Error& error_obj = Error::Handle(); | 288 Error& error_obj = Error::Handle(); |
288 error_obj ^= obj.raw(); | 289 error_obj ^= obj.raw(); |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 MessageWriter writer(&data, &allocator, false); | 425 MessageWriter writer(&data, &allocator, false); |
425 writer.WriteMessage(msg); | 426 writer.WriteMessage(msg); |
426 | 427 |
427 PortMap::PostMessage(new Message(port.Id(), | 428 PortMap::PostMessage(new Message(port.Id(), |
428 data, writer.BytesWritten(), | 429 data, writer.BytesWritten(), |
429 Message::kOOBPriority)); | 430 Message::kOOBPriority)); |
430 return Object::null(); | 431 return Object::null(); |
431 } | 432 } |
432 | 433 |
433 } // namespace dart | 434 } // namespace dart |
OLD | NEW |