• Simon Zünd's avatar
    [inspector] Implement Async Stack Tagging API v2 · c53c20fe
    Simon Zünd authored
    This CL adds a new method to the `console` that is available
    when DevTools is open. In TypeScript notation the API is:
    
    ```
    namespace console {
      // Creates a new `Task` and associates the current async
      // stack trace with the created `Task`.
      scheduleTask(name: string): Task;
    }
    
    interface Task {
      // Executes an arbitrary payload and forwards the return value
      // back to the caller. Any async stack trace captured during
      // 'f' has the site of the corresponding `scheduleTask` as
      // its parent.
      run<T>(f: () => T): T;
    }
    ```
    
    The API is a saner user-facing API for our async stack trace
    mechanism:
      * scheduleAsyncTask corresponds to scheduleTask
      * startAsyncTask/stopAsyncTask are called implicitly before `f`
        is executed.
      * cancelAsyncTask is called implicitly when `Task` is GC'ed
    
    The API is behind the flag --experimental-async-stack-tagging-api
    
    Bug: chromium:1334585
    Change-Id: Ic6054279a108756caed6b4b5f2d1fe4a1bdbaf78
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3776678Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
    Reviewed-by: 's avatarKim-Anh Tran <kimanh@chromium.org>
    Commit-Queue: Simon Zünd <szuend@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#81881}
    c53c20fe