Skip to content

Commit

Permalink
Move the CreateMainThreadIsolate out of CreateMainThreadAndInitialize
Browse files Browse the repository at this point in the history
- Make creating the isolate explicit in the callers of the single
thread blink creation method. This allows us to remove the sky hook
in the v8_context_snapshot_generator to request the MainThreadIsolate.

Bug: 263412
Change-Id: Idc82515d7138c85db1482cd710be4ab62208064f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5074603
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Yuki Shiino <yukishiino@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1233338}
  • Loading branch information
dtapuska authored and Chromium LUCI CQ committed Dec 5, 2023
1 parent beb8489 commit e2e0f97
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions services/data_decoder/image_decoder_impl_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class BlinkInitializer : public blink::Platform {

mojo::BinderMap binders;
blink::CreateMainThreadAndInitialize(this, &binders);
blink::CreateMainThreadIsolate();
}

BlinkInitializer(const BlinkInitializer&) = delete;
Expand Down
4 changes: 3 additions & 1 deletion third_party/blink/public/web/blink.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ BLINK_EXPORT void Initialize(
// The same as above, but this only supports simple single-threaded execution
// environment. The main thread WebThread object is owned by Platform when this
// version is used. This version is mainly for tests and other components
// requiring only the simple environment.
// requiring only the simple environment. This does not create the
// `v8::Isolate`, callers should call `CreateMainThreadIsolate` after calling
// this method.
//
// When this version is used, your Platform implementation needs to follow
// a certain convention on CurrentThread(); see the comments at
Expand Down
1 change: 0 additions & 1 deletion third_party/blink/renderer/controller/blink_initializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,6 @@ void CreateMainThreadAndInitialize(Platform* platform,
DCHECK(binders);
Platform::CreateMainThreadAndInitialize(platform);
InitializeCommon(platform, binders);
V8Initializer::InitializeMainThread();
}

void InitializeWithoutIsolateForTesting(
Expand Down
4 changes: 2 additions & 2 deletions tools/v8_context_snapshot/v8_context_snapshot_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ int main(int argc, char** argv) {
SnapshotPlatform platform;
mojo::BinderMap binders;
blink::CreateMainThreadAndInitialize(&platform, &binders);
v8::StartupData blob =
blink::WebV8ContextSnapshot::TakeSnapshot(blink::MainThreadIsolate());
auto* isolate = blink::CreateMainThreadIsolate();
v8::StartupData blob = blink::WebV8ContextSnapshot::TakeSnapshot(isolate);

// Save the snapshot as a file. Filename is given in a command line option.
base::FilePath file_path =
Expand Down

0 comments on commit e2e0f97

Please sign in to comment.