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

Unified Diff: runtime/observatory/lib/src/elements/cpu_profile.dart

Issue 1283413002: Fix table cpu profile to work properly with non-dart functions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/elements/cpu_profile.dart
diff --git a/runtime/observatory/lib/src/elements/cpu_profile.dart b/runtime/observatory/lib/src/elements/cpu_profile.dart
index f7f035db0f816a75df6364a05030ca6252ae45a4..087daa5d50fa29c4f1600869cfff3a3112ac0411 100644
--- a/runtime/observatory/lib/src/elements/cpu_profile.dart
+++ b/runtime/observatory/lib/src/elements/cpu_profile.dart
@@ -869,15 +869,22 @@ class CpuProfileTableElement extends ObservatoryElement {
}
checkParameters() {
- var functionId = app.locationManager.uri.queryParameters['functionId'];
- if (functionId == null) {
- _focusOnFunction(null);
- return;
- }
if (isolate == null) {
return;
}
- isolate.getObject(functionId).then((func) => _focusOnFunction(func));
+ var functionId = app.locationManager.uri.queryParameters['functionId'];
+ var functionName =
+ app.locationManager.uri.queryParameters['functionName'];
+ if (functionId == '') {
+ // Fallback to searching by name.
+ _focusOnFunction(_findFunction(functionName));
+ } else {
+ if (functionId == null) {
+ _focusOnFunction(null);
+ return;
+ }
+ isolate.getObject(functionId).then((func) => _focusOnFunction(func));
+ }
}
_clearView() {
@@ -913,6 +920,8 @@ class CpuProfileTableElement extends ObservatoryElement {
tableBody.children[row].offsetHeight;
tableBody.children[row].scrollIntoView(ScrollAlignment.CENTER);
tableBody.children[row].classes.add('shake');
+ // Focus on clicked function.
+ _focusOnFunction(function);
}
_clearFocusedFunction() {
@@ -925,6 +934,15 @@ class CpuProfileTableElement extends ObservatoryElement {
focusedFunction = null;
}
+ ServiceFunction _findFunction(String functionName) {
+ for (var func in profile.functions) {
+ if (func.function.name == functionName) {
+ return func.function;
+ }
+ }
+ return null;
+ }
+
_focusOnFunction(ServiceFunction function) {
if (focusedFunction == function) {
// Do nothing.
@@ -962,7 +980,8 @@ class CpuProfileTableElement extends ObservatoryElement {
var function = row.values[NameSortedTable.FUNCTION_COLUMN];
app.locationManager.goReplacingParameters(
{
- 'functionId': function.id
+ 'functionId': function.id,
+ 'functionName': function.vmName
}
);
}

Powered by Google App Engine
This is Rietveld 408576698