[debugger] Log timings of language extension plugin methods.

This is a (temporary) measure to gain a better understanding of the
timing of the various language plugin methods, and how these affect the
overall experience. By adding this to the frontend itself (the log
messages will only show up in DevTools on DevTools), we also gain the
ability to ask partners / other developers to look at them in case of
performance issues.

Bug: chromium:1083146
Change-Id: I444c48f20be72c0f2b57f7dc821a772e97c5e86f
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2579919
Auto-Submit: Benedikt Meurer <[email protected]>
Commit-Queue: Philip Pfaffe <[email protected]>
Reviewed-by: Philip Pfaffe <[email protected]>
diff --git a/front_end/extensions/ExtensionAPI.js b/front_end/extensions/ExtensionAPI.js
index 07a28e5..5c6fa8f 100644
--- a/front_end/extensions/ExtensionAPI.js
+++ b/front_end/extensions/ExtensionAPI.js
@@ -392,9 +392,11 @@
       const port = channel.port1;
       this._plugins.set(plugin, port);
       port.onmessage = ({data: {requestId, method, parameters}}) => {
+        console.time(`${requestId}: ${method}`);
         dispatchMethodCall(method, parameters)
             .then(result => port.postMessage({requestId, result}))
-            .catch(error => port.postMessage({requestId, error: {message: error.message}}));
+            .catch(error => port.postMessage({requestId, error: {message: error.message}}))
+            .finally(() => console.timeEnd(`${requestId}: ${method}`));
       };
 
       /**