This patch combine three patch which is related to "--gcov" flag.
[platform/framework/web/chromium-efl.git] / gin / cppgc.cc
1 // Copyright 2021 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "gin/public/cppgc.h"
6
7 #include "base/check_op.h"
8 #include "gin/public/v8_platform.h"
9 #include "v8/include/cppgc/platform.h"
10
11 namespace gin {
12
13 namespace {
14
15 int g_init_count = 0;
16
17 }  // namespace
18
19 void InitializeCppgcFromV8Platform() {
20   DCHECK_GE(g_init_count, 0);
21   if (g_init_count++ > 0)
22     return;
23
24   cppgc::InitializeProcess(gin::V8Platform::Get()->GetPageAllocator());
25 }
26
27 void MaybeShutdownCppgc() {
28   DCHECK_GT(g_init_count, 0);
29   if (--g_init_count > 0)
30     return;
31
32   cppgc::ShutdownProcess();
33 }
34
35 }  // namespace gin