perfetto-ui: Highlight flamegraph focused nodes

Bug:151236702
Change-Id: Ic504e483e5b2095ad78fe134980efb691d331430
diff --git a/ui/src/controller/heap_profile_controller.ts b/ui/src/controller/heap_profile_controller.ts
index 09092d4..0f99db3 100644
--- a/ui/src/controller/heap_profile_controller.ts
+++ b/ui/src/controller/heap_profile_controller.ts
@@ -216,15 +216,16 @@
       // id, name, parent_id, depth, total_size
       const tableName =
           await this.prepareViewsAndTables(ts, upid, type, focusRegex);
-      currentData =
-          await this.getFlamegraphDataFromTables(tableName, viewingOption);
+      currentData = await this.getFlamegraphDataFromTables(
+          tableName, viewingOption, focusRegex);
       this.flamegraphDatasets.set(key, currentData);
     }
     return currentData;
   }
 
   async getFlamegraphDataFromTables(
-      tableName: string, viewingOption = DEFAULT_VIEWING_OPTION) {
+      tableName: string, viewingOption = DEFAULT_VIEWING_OPTION,
+      focusRegex: string) {
     let orderBy = '';
     let sizeIndex = 4;
     let selfIndex = 9;
@@ -280,6 +281,8 @@
       const totalSize = +callsites.columns[sizeIndex].longValues![i];
       const mapping = callsites.columns[8].stringValues![i];
       const selfSize = +callsites.columns[selfIndex].longValues![i];
+      const highlighted = focusRegex !== '' &&
+          name.toLocaleLowerCase().includes(focusRegex.toLocaleLowerCase());
       const parentId =
           hashToindex.has(+parentHash) ? hashToindex.get(+parentHash)! : -1;
       if (depth === maxDepth - 1) {
@@ -297,7 +300,8 @@
         name,
         selfSize,
         mapping,
-        merged: false
+        merged: false,
+        highlighted
       });
     }
     return flamegraphData;