• Yuta Kitamura's avatar
    Let Platform own main thread in simple use cases. · 840ab30d
    Yuta Kitamura authored
    Currently, the main thread WebThread is owned by the embedder. We'd
    like to shift the ownership to Platform, so that we can stop exposing
    WebThread to embedders.
    
    As a first step, this patch introduces a new initialization method
    Platform::CreateMainThreadAndInitialize(), which is parallel to
    Platform::Initialize(). It is targeted to tests or other use cases
    which only require a simple execution environment of Blink. Currently,
    each embedder implements its own WebThread, but I'd like to unify
    those and remove them from non-Blink code eventually.
    
    The new CreateMainThreadAndInitialize() lets Platform own the main
    thread WebThread object, unlike Initialize(). Currently, Platform
    needs to handle two different cases: main thread owned or not owned,
    but this is only temporary, and they will eventually converge to the
    "owned" case.
    
    As a test bed, v8_context_snapshot_generator is migrated to the
    new initialization method.
    
    Bug: 826203
    Change-Id: I14436509f420a5d73f2ce64722f41da5756fa45b
    Reviewed-on: https://chromium-review.googlesource.com/1163560
    Commit-Queue: Yuta Kitamura <yutak@chromium.org>
    Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
    Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#581136}
    840ab30d
platform.h 27.8 KB