blob: 693106afea1eef11fea77a313fd6e01b6bd1e24f [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:html';
import 'dart:async';
import 'package:observatory/models.dart' as M
show IsolateRef, SingleTargetCacheRef;
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
import 'package:observatory/src/elements/helpers/custom_element.dart';
import 'package:observatory/src/elements/helpers/uris.dart';
class SingleTargetCacheRefElement extends CustomElement implements Renderable {
late RenderingScheduler<SingleTargetCacheRefElement> _r;
Stream<RenderedEvent<SingleTargetCacheRefElement>> get onRendered =>
late M.IsolateRef _isolate;
late M.SingleTargetCacheRef _singleTargetCache;
M.IsolateRef get isolate => _isolate;
M.SingleTargetCacheRef get singleTargetCache => _singleTargetCache;
factory SingleTargetCacheRefElement(
M.IsolateRef isolate, M.SingleTargetCacheRef singleTargetCache,
{RenderingQueue? queue}) {
assert(isolate != null);
assert(singleTargetCache != null);
SingleTargetCacheRefElement e = new SingleTargetCacheRefElement.created();
e._r = new RenderingScheduler<SingleTargetCacheRefElement>(e, queue: queue);
e._isolate = isolate;
e._singleTargetCache = singleTargetCache;
return e;
: super.created('singletargetcache-ref');
void attached() {
void detached() {
_r.disable(notify: true);
children = <Element>[];
void render() {
children = <Element>[
new AnchorElement(
href: Uris.inspect(_isolate, object: _singleTargetCache))
..children = <Element>[
new SpanElement()
..classes = ['emphasize']
..text = 'SingleTargetCache',
new SpanElement()..text = ' (${!.name})'