Remove SimpleView.syncToolbarItems and use async variant instead

The ScriptOriginPlugin uses source mapping to resolve a UISourceCode to
a script in order to display a toolbar item for that script. As source
mapping will be asyncified the UISourceCodeFrame needs to provide its
toolbar items in an async way.

Luckily, UI.SimpleView has both a async and non-async version for
sub-classes to provide toolbar items. This CL replaces all uses of
the non-async version with the async version and removes the
non-async version from the interface alltogether.

[email protected]

Bug: chromium:1032016
Change-Id: Ifce141ccf17bbce3493cb5ffb16aa6874abfe413
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/1981624
Commit-Queue: Simon Zünd <[email protected]>
Reviewed-by: Sigurd Schneider <[email protected]>
diff --git a/front_end/resources/ResourcesPanel.js b/front_end/resources/ResourcesPanel.js
index 813cbce..50ef060 100644
--- a/front_end/resources/ResourcesPanel.js
+++ b/front_end/resources/ResourcesPanel.js
@@ -109,11 +109,12 @@
     this.visibleView = view;
 
     this._storageViewToolbar.removeToolbarItems();
-    const toolbarItems = (view instanceof UI.SimpleView && view.syncToolbarItems()) || [];
-    for (let i = 0; i < toolbarItems.length; ++i) {
-      this._storageViewToolbar.appendToolbarItem(toolbarItems[i]);
+    if (view instanceof UI.SimpleView) {
+      view.toolbarItems().then(items => {
+        items.map(item => this._storageViewToolbar.appendToolbarItem(item));
+        this._storageViewToolbar.element.classList.toggle('hidden', !items.length);
+      });
     }
-    this._storageViewToolbar.element.classList.toggle('hidden', !toolbarItems.length);
   }
 
   /**