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

Side by Side Diff: runtime/bin/vmservice/observatory/lib/src/elements/observatory_element.dart

Issue 514833003: Add a new Sentinel type for sentinel responses. (They are not Null). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js, fix tests Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
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 observatory_element; 5 library observatory_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'package:observatory/app.dart'; 9 import 'package:observatory/app.dart';
10 import 'package:polymer/polymer.dart'; 10 import 'package:polymer/polymer.dart';
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 String formatTimePrecise(double time) => Utils.formatTimePrecise(time); 98 String formatTimePrecise(double time) => Utils.formatTimePrecise(time);
99 99
100 String formatTime(double time) => Utils.formatTime(time); 100 String formatTime(double time) => Utils.formatTime(time);
101 101
102 String formatSeconds(double x) => Utils.formatSeconds(x); 102 String formatSeconds(double x) => Utils.formatSeconds(x);
103 103
104 104
105 String formatSize(int bytes) => Utils.formatSize(bytes); 105 String formatSize(int bytes) => Utils.formatSize(bytes);
106 106
107 String fileAndLine(Map frame) { 107 String fileAndLine(Map frame) {
108 var file = frame['script']['user_name']; 108 var file = frame['script'].name;
109 var shortFile = file.substring(file.lastIndexOf('/') + 1); 109 var shortFile = file.substring(file.lastIndexOf('/') + 1);
110 return "${shortFile}:${frame['line']}"; 110 return "${shortFile}:${frame['line']}";
111 } 111 }
112 112
113 int parseInt(String value) => int.parse(value); 113 int parseInt(String value) => int.parse(value);
114 114
115 bool isNull(ref) { 115 bool isNull(ref) {
116 return ref != null && ref.serviceType == 'Null' && ref.id == 'objects/null'; 116 return ref != null && ref.serviceType == 'Null';
117 } 117 }
118 118
119 bool isPsuedoNull(ref) { 119 bool isSentinel(ref) {
120 return ref != null && ref.serviceType == 'Null' && ref.id != 'objects/null'; 120 return ref != null && ref.serviceType == 'Sentinel';
121 } 121 }
122 122
123 bool isError(ref) { 123 bool isError(ref) {
124 return ref != null && ref.serviceType == 'Error'; 124 return ref != null && ref.serviceType == 'Error';
125 } 125 }
126 126
127 bool isInt(ref) { 127 bool isInt(ref) {
128 return ref != null && (ref.serviceType == 'Smi' || 128 return ref != null && (ref.serviceType == 'Smi' ||
129 ref.serviceType == 'Mint' || 129 ref.serviceType == 'Mint' ||
130 ref.serviceType == 'Bigint'); 130 ref.serviceType == 'Bigint');
(...skipping 20 matching lines...) Expand all
151 ref.serviceType == 'Array'); 151 ref.serviceType == 'Array');
152 } 152 }
153 153
154 bool isType(ref) { 154 bool isType(ref) {
155 return ref != null && (ref.serviceType == 'Type'); 155 return ref != null && (ref.serviceType == 'Type');
156 } 156 }
157 157
158 bool isUnexpected(ref) { 158 bool isUnexpected(ref) {
159 if (ref == null) return false; 159 if (ref == null) return false;
160 return (!['Null', 160 return (!['Null',
161 'Sentinel',
161 'Smi', 162 'Smi',
162 'Mint', 163 'Mint',
163 'Bigint', 164 'Bigint',
164 'Bool', 165 'Bool',
165 'String', 166 'String',
166 'Double', 167 'Double',
167 'Instance', 168 'Instance',
168 'GrowableObjectArray', 169 'GrowableObjectArray',
169 'Array', 170 'Array',
170 'Type', 171 'Type',
171 'Error'].contains(ref.serviceType)); 172 'Error'].contains(ref.serviceType));
172 } 173 }
173 } 174 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/lib/src/elements/instance_view.html ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698