• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 the V8 project authors. All rights reserved.
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 "include/cppgc/internal/pointer-policies.h"
6 
7 #include "include/cppgc/internal/persistent-node.h"
8 #include "src/base/macros.h"
9 #include "src/heap/cppgc/heap-page.h"
10 #include "src/heap/cppgc/heap.h"
11 
12 namespace cppgc {
13 namespace internal {
14 
EnabledCheckingPolicy()15 EnabledCheckingPolicy::EnabledCheckingPolicy() {
16   USE(impl_);
17   // TODO(chromium:1056170): Save creating heap state.
18 }
19 
CheckPointer(const void * ptr)20 void EnabledCheckingPolicy::CheckPointer(const void* ptr) {
21   // TODO(chromium:1056170): Provide implementation.
22 }
23 
GetPersistentRegion(void * object)24 PersistentRegion& StrongPersistentPolicy::GetPersistentRegion(void* object) {
25   auto* heap = BasePage::FromPayload(object)->heap();
26   return heap->GetStrongPersistentRegion();
27 }
28 
GetPersistentRegion(void * object)29 PersistentRegion& WeakPersistentPolicy::GetPersistentRegion(void* object) {
30   auto* heap = BasePage::FromPayload(object)->heap();
31   return heap->GetWeakPersistentRegion();
32 }
33 
GetPersistentRegion(void * object)34 PersistentRegion& StrongCrossThreadPersistentPolicy::GetPersistentRegion(
35     void* object) {
36   auto* heap = BasePage::FromPayload(object)->heap();
37   return heap->GetStrongCrossThreadPersistentRegion();
38 }
39 
GetPersistentRegion(void * object)40 PersistentRegion& WeakCrossThreadPersistentPolicy::GetPersistentRegion(
41     void* object) {
42   auto* heap = BasePage::FromPayload(object)->heap();
43   return heap->GetWeakCrossThreadPersistentRegion();
44 }
45 
46 }  // namespace internal
47 }  // namespace cppgc
48