V8  latest master commit
V8 is Google's open source JavaScript engine
heap.h
Go to the documentation of this file.
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 #ifndef INCLUDE_CPPGC_HEAP_H_
6 #define INCLUDE_CPPGC_HEAP_H_
7 
8 #include <memory>
9 #include <vector>
10 
11 #include "cppgc/common.h"
12 #include "cppgc/custom-space.h"
13 #include "v8config.h" // NOLINT(build/include_directory)
14 
15 namespace cppgc {
16 namespace internal {
17 class Heap;
18 } // namespace internal
19 
20 class V8_EXPORT Heap {
21  public:
26 
27  struct HeapOptions {
28  static HeapOptions Default() { return {}; }
29 
35  std::vector<std::unique_ptr<CustomSpaceBase>> custom_spaces;
36  };
37 
38  static std::unique_ptr<Heap> Create(HeapOptions = HeapOptions::Default());
39 
40  virtual ~Heap() = default;
41 
51  void ForceGarbageCollectionSlow(
52  const char* source, const char* reason,
53  StackState stack_state = StackState::kMayContainHeapPointers);
54 
55  private:
56  Heap() = default;
57 
58  friend class internal::Heap;
59 };
60 
61 } // namespace cppgc
62 
63 #endif // INCLUDE_CPPGC_HEAP_H_
cppgc::Heap::HeapOptions::custom_spaces
std::vector< std::unique_ptr< CustomSpaceBase > > custom_spaces
Definition: heap.h:35
cppgc::Heap::HeapOptions::Default
static HeapOptions Default()
Definition: heap.h:28
custom-space.h
cppgc
Definition: allocation.h:18
v8config.h
V8_EXPORT
#define V8_EXPORT
Definition: v8config.h:467
cppgc::Heap
Definition: heap.h:20
cppgc::EmbedderStackState
EmbedderStackState
Definition: common.h:14
cppgc::Heap::HeapOptions
Definition: heap.h:27
common.h