| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library function_ref_element; | 5 library function_ref_element; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'package:observatory/models.dart' as M | 9 import 'package:observatory/models.dart' as M |
| 10 show IsolateRef, FunctionRef, isSyntheticFunction, ClassRef, ObjectRef; | 10 show IsolateRef, FunctionRef, isSyntheticFunction, ClassRef, ObjectRef, |
| 11 getFunctionFullName; |
| 11 import 'package:observatory/src/elements/class_ref.dart'; | 12 import 'package:observatory/src/elements/class_ref.dart'; |
| 12 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
| 13 import 'package:observatory/src/elements/helpers/tag.dart'; | 14 import 'package:observatory/src/elements/helpers/tag.dart'; |
| 14 import 'package:observatory/src/elements/helpers/uris.dart'; | 15 import 'package:observatory/src/elements/helpers/uris.dart'; |
| 15 | 16 |
| 16 class FunctionRefElement extends HtmlElement implements Renderable { | 17 class FunctionRefElement extends HtmlElement implements Renderable { |
| 17 static const tag = const Tag<FunctionRefElement>('function-ref-wrapped'); | 18 static const tag = const Tag<FunctionRefElement>('function-ref-wrapped'); |
| 18 | 19 |
| 19 RenderingScheduler<FunctionRefElement> _r; | 20 RenderingScheduler<FunctionRefElement> _r; |
| 20 | 21 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 @override | 47 @override |
| 47 void attached() { | 48 void attached() { |
| 48 super.attached(); | 49 super.attached(); |
| 49 _r.enable(); | 50 _r.enable(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 @override | 53 @override |
| 53 void detached() { | 54 void detached() { |
| 54 super.detached(); | 55 super.detached(); |
| 55 children = []; | 56 children = []; |
| 57 title = ''; |
| 56 _r.disable(notify: true); | 58 _r.disable(notify: true); |
| 57 } | 59 } |
| 58 | 60 |
| 59 void render() { | 61 void render() { |
| 60 var content = <Element>[ | 62 var content = <Element>[ |
| 61 new AnchorElement(href: M.isSyntheticFunction(function.kind) ? null | 63 new AnchorElement(href: M.isSyntheticFunction(_function.kind) ? null |
| 62 : Uris.inspect(_isolate, object: _function)) | 64 : Uris.inspect(_isolate, object: _function)) |
| 63 ..text = _function.name | 65 ..text = _function.name |
| 64 ]; | 66 ]; |
| 65 if (qualified) { | 67 if (qualified) { |
| 66 M.ObjectRef owner = _function.dartOwner; | 68 M.ObjectRef owner = _function.dartOwner; |
| 67 while (owner is M.FunctionRef) { | 69 while (owner is M.FunctionRef) { |
| 68 M.FunctionRef function = (owner as M.FunctionRef); | 70 M.FunctionRef function = (owner as M.FunctionRef); |
| 69 content.addAll([ | 71 content.addAll([ |
| 70 new SpanElement()..text = '.', | 72 new SpanElement()..text = '.', |
| 71 new AnchorElement(href: M.isSyntheticFunction(function.kind) ? null | 73 new AnchorElement(href: M.isSyntheticFunction(function.kind) ? null |
| 72 : Uris.inspect(_isolate, object: function)) | 74 : Uris.inspect(_isolate, object: function)) |
| 73 ..text = function.name | 75 ..text = function.name |
| 74 ]); | 76 ]); |
| 75 owner = function.dartOwner; | 77 owner = function.dartOwner; |
| 76 } | 78 } |
| 77 if (owner is M.ClassRef) { | 79 if (owner is M.ClassRef) { |
| 78 content.addAll([ | 80 content.addAll([ |
| 79 new SpanElement()..text = '.', | 81 new SpanElement()..text = '.', |
| 80 new ClassRefElement(_isolate, owner, queue: _r.queue) | 82 new ClassRefElement(_isolate, owner, queue: _r.queue) |
| 81 ]); | 83 ]); |
| 82 } | 84 } |
| 83 } | 85 } |
| 84 children = content.reversed.toList(growable: false); | 86 children = content.reversed.toList(growable: false); |
| 87 title = M.getFunctionFullName(_function); |
| 85 } | 88 } |
| 86 } | 89 } |
| OLD | NEW |