Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: runtime/lib/mirrors.cc

Issue 1259893006: Hack around dart:io being loaded into non-service isolates in Dartium. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: thread api Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/lib/mirrors/io_html_mutual_exclusion_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "lib/mirrors.h" 5 #include "lib/mirrors.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bootstrap_natives.h" 8 #include "vm/bootstrap_natives.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 args.SetAt(4, Bool::Get(cls.is_abstract())); 366 args.SetAt(4, Bool::Get(cls.is_abstract()));
367 args.SetAt(5, Bool::Get(cls.IsGeneric())); 367 args.SetAt(5, Bool::Get(cls.IsGeneric()));
368 args.SetAt(6, Bool::Get(cls.is_mixin_app_alias())); 368 args.SetAt(6, Bool::Get(cls.is_mixin_app_alias()));
369 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration); 369 args.SetAt(7, cls.NumTypeParameters() == 0 ? Bool::False() : is_declaration);
370 args.SetAt(8, Bool::Get(cls.is_enum_class())); 370 args.SetAt(8, Bool::Get(cls.is_enum_class()));
371 return CreateMirror(Symbols::_LocalClassMirror(), args); 371 return CreateMirror(Symbols::_LocalClassMirror(), args);
372 } 372 }
373 373
374 374
375 static RawInstance* CreateLibraryMirror(const Library& lib) { 375 static RawInstance* CreateLibraryMirror(const Library& lib) {
376 Thread* thread = Thread::Current();
377 Zone* zone = thread->zone();
376 ASSERT(!lib.IsNull()); 378 ASSERT(!lib.IsNull());
377 const Array& args = Array::Handle(Array::New(3)); 379 const Array& args = Array::Handle(zone, Array::New(3));
378 args.SetAt(0, MirrorReference::Handle(MirrorReference::New(lib))); 380 args.SetAt(0, MirrorReference::Handle(zone, MirrorReference::New(lib)));
379 String& str = String::Handle(); 381 String& str = String::Handle(zone);
380 str = lib.name(); 382 str = lib.name();
381 args.SetAt(1, str); 383 args.SetAt(1, str);
382 str = lib.url(); 384 str = lib.url();
383 if (str.Equals("dart:_builtin") || str.Equals("dart:_blink")) { 385 if (str.Equals("dart:_builtin") || str.Equals("dart:_blink")) {
384 // Censored library (grumble). 386 // Censored library (grumble).
385 return Instance::null(); 387 return Instance::null();
386 } 388 }
389 if (str.Equals("dart:io")) {
390 // Hack around dart:io being loaded into non-service isolates in Dartium.
391 Isolate* isolate = thread->isolate();
392 const GrowableObjectArray& libraries = GrowableObjectArray::Handle(
393 zone, isolate->object_store()->libraries());
394 Library& other_lib = Library::Handle(zone);
395 String& other_uri = String::Handle(zone);
396 for (intptr_t i = 0; i < libraries.Length(); i++) {
397 other_lib ^= libraries.At(i);
398 other_uri = other_lib.url();
399 if (other_uri.Equals("dart:html")) {
400 return Instance::null();
401 }
402 }
403 }
387 args.SetAt(2, str); 404 args.SetAt(2, str);
388 return CreateMirror(Symbols::_LocalLibraryMirror(), args); 405 return CreateMirror(Symbols::_LocalLibraryMirror(), args);
389 } 406 }
390 407
391 408
392 static RawInstance* CreateCombinatorMirror(const Object& identifiers, 409 static RawInstance* CreateCombinatorMirror(const Object& identifiers,
393 bool is_show) { 410 bool is_show) {
394 const Array& args = Array::Handle(Array::New(2)); 411 const Array& args = Array::Handle(Array::New(2));
395 args.SetAt(0, identifiers); 412 args.SetAt(0, identifiers);
396 args.SetAt(1, Bool::Get(is_show)); 413 args.SetAt(1, Bool::Get(is_show));
(...skipping 1683 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 } 2097 }
2081 2098
2082 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { 2099 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) {
2083 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); 2100 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0));
2084 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); 2101 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1));
2085 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); 2102 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw();
2086 } 2103 }
2087 2104
2088 2105
2089 } // namespace dart 2106 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | tests/lib/mirrors/io_html_mutual_exclusion_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698