Loading...
Searching...
No Matches
platform.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_PLATFORM_H_
6#define INCLUDE_CPPGC_PLATFORM_H_
7
8#include <memory>
9
11#include "v8-platform.h" // NOLINT(build/include_directory)
12#include "v8config.h" // NOLINT(build/include_directory)
13
14namespace cppgc {
15
16// TODO(v8:10346): Create separate includes for concepts that are not
17// V8-specific.
23using Task = v8::Task;
27
32 public:
33 virtual ~Platform() = default;
34
41
49 virtual double MonotonicallyIncreasingTime() = 0;
50
54 virtual std::shared_ptr<TaskRunner> GetForegroundTaskRunner() {
55 return GetForegroundTaskRunner(TaskPriority::kUserBlocking);
56 }
57
62 virtual std::shared_ptr<TaskRunner> GetForegroundTaskRunner(
63 TaskPriority priority) {
64 return nullptr;
65 }
66
126 virtual std::unique_ptr<JobHandle> PostJob(
127 TaskPriority priority, std::unique_ptr<JobTask> job_task) {
128 return nullptr;
129 }
130
137};
138
153V8_EXPORT void InitializeProcess(PageAllocator* page_allocator = nullptr,
154 size_t desired_heap_size = 0);
155
162
163namespace internal {
164
165V8_EXPORT void Fatal(const std::string& reason = std::string(),
167
168} // namespace internal
169
170} // namespace cppgc
171
172#endif // INCLUDE_CPPGC_PLATFORM_H_
Definition: platform.h:31
virtual std::shared_ptr< TaskRunner > GetForegroundTaskRunner(TaskPriority priority)
Definition: platform.h:62
virtual TracingController * GetTracingController()
virtual ~Platform()=default
virtual std::shared_ptr< TaskRunner > GetForegroundTaskRunner()
Definition: platform.h:54
virtual PageAllocator * GetPageAllocator()=0
virtual double MonotonicallyIncreasingTime()=0
virtual std::unique_ptr< JobHandle > PostJob(TaskPriority priority, std::unique_ptr< JobTask > job_task)
Definition: platform.h:126
Definition: v8-platform.h:62
Definition: v8-platform.h:206
Definition: v8-platform.h:241
Definition: v8-platform.h:300
Definition: v8-platform.h:455
Definition: v8-source-location.h:31
static constexpr SourceLocation Current()
Definition: v8-source-location.h:44
Definition: v8-platform.h:74
Definition: v8-platform.h:49
Definition: v8-platform.h:375
void Fatal(const std::string &reason=std::string(), const SourceLocation &=SourceLocation::Current())
Definition: allocation.h:38
void ShutdownProcess()
void InitializeProcess(PageAllocator *page_allocator=nullptr, size_t desired_heap_size=0)
TaskPriority
Definition: v8-platform.h:24
#define V8_EXPORT
Definition: v8config.h:793