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 |
} |
); |
} |