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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 const Library& library, | 266 const Library& library, |
267 const String& uri, | 267 const String& uri, |
268 char** error) { | 268 char** error) { |
269 char* result = NULL; | 269 char* result = NULL; |
270 Zone* zone = thread->zone(); | 270 Zone* zone = thread->zone(); |
271 Isolate* isolate = thread->isolate(); | 271 Isolate* isolate = thread->isolate(); |
272 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); | 272 Dart_LibraryTagHandler handler = isolate->library_tag_handler(); |
273 if (handler != NULL) { | 273 if (handler != NULL) { |
274 Dart_EnterScope(); | 274 Dart_EnterScope(); |
275 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, | 275 Dart_Handle handle = handler(Dart_kCanonicalizeUrl, |
276 Api::NewHandle(isolate, library.raw()), | 276 Api::NewHandle(thread, library.raw()), |
277 Api::NewHandle(isolate, uri.raw())); | 277 Api::NewHandle(thread, uri.raw())); |
278 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); | 278 const Object& obj = Object::Handle(Api::UnwrapHandle(handle)); |
279 if (obj.IsString()) { | 279 if (obj.IsString()) { |
280 result = String2UTF8(String::Cast(obj)); | 280 result = String2UTF8(String::Cast(obj)); |
281 } else if (obj.IsError()) { | 281 } else if (obj.IsError()) { |
282 Error& error_obj = Error::Handle(); | 282 Error& error_obj = Error::Handle(); |
283 error_obj ^= obj.raw(); | 283 error_obj ^= obj.raw(); |
284 *error = zone->PrintToString("Unable to canonicalize uri '%s': %s", | 284 *error = zone->PrintToString("Unable to canonicalize uri '%s': %s", |
285 uri.ToCString(), error_obj.ToErrorCString()); | 285 uri.ToCString(), error_obj.ToErrorCString()); |
286 } else { | 286 } else { |
287 *error = zone->PrintToString("Unable to canonicalize uri '%s': " | 287 *error = zone->PrintToString("Unable to canonicalize uri '%s': " |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 MessageWriter writer(&data, &allocator, false); | 412 MessageWriter writer(&data, &allocator, false); |
413 writer.WriteMessage(msg); | 413 writer.WriteMessage(msg); |
414 | 414 |
415 PortMap::PostMessage(new Message(port.Id(), | 415 PortMap::PostMessage(new Message(port.Id(), |
416 data, writer.BytesWritten(), | 416 data, writer.BytesWritten(), |
417 Message::kOOBPriority)); | 417 Message::kOOBPriority)); |
418 return Object::null(); | 418 return Object::null(); |
419 } | 419 } |
420 | 420 |
421 } // namespace dart | 421 } // namespace dart |
OLD | NEW |