0
Files
src/gin/cppgc.cc
Michael Lippautz ca27947b66 Move cppgc platform initialization to gin
cppgc uses the same platform initialization mechanism as V8 which only
allows the platform to initialized once per process. Since multiple
users of cppgc may be running in the same process, centralize its
initialization in gin, following the regular v8 pattern.

Bug: 1056170
Change-Id: Iff35af900eab6e05a858203e13bab44c302cc7ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2844606
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#875699}
2021-04-23 16:13:52 +00:00

22 lines
540 B
C++

// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gin/public/cppgc.h"
#include "gin/public/v8_platform.h"
#include "v8/include/cppgc/platform.h"
namespace gin {
void InitializeCppgcFromV8Platform() {
static bool cppgc_is_initialized = false;
if (cppgc_is_initialized)
return;
cppgc::InitializeProcess(gin::V8Platform::Get()->GetPageAllocator());
cppgc_is_initialized = true;
}
} // namespace gin