Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
runtime
ptrace_check.h
Go to the documentation of this file.
1
// Copyright 2013 The Flutter 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 FLUTTER_RUNTIME_PTRACE_CHECK_H_
6
#define FLUTTER_RUNTIME_PTRACE_CHECK_H_
7
8
#include "flutter/common/settings.h"
9
#include "flutter/fml/build_config.h"
10
11
namespace
flutter
{
12
13
#define TRACING_CHECKS_NECESSARY \
14
FML_OS_IOS && !TARGET_OS_SIMULATOR && \
15
(FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
16
17
enum class
TracingResult
{
18
kNotAttempted
,
19
kEnabled
,
20
kNotNecessary
=
kEnabled
,
21
kDisabled
,
22
};
23
24
#if TRACING_CHECKS_NECESSARY
25
bool
EnableTracingIfNecessaryImpl(
const
Settings& vm_settings);
26
TracingResult
GetTracingResultImpl();
27
#endif
// TRACING_CHECKS_NECESSARY
28
29
//------------------------------------------------------------------------------
30
/// @brief Enables tracing in the process so that JIT mode VMs may be
31
/// launched. Explicitly enabling tracing is not required on all
32
/// platforms. On platforms where it is not required, calling this
33
/// method will return true. If tracing is required but cannot be
34
/// enabled, it is the responsibility of the caller to display the
35
/// appropriate error message to the user as subsequent attempts to
36
/// launch the VM in JIT mode will cause process termination.
37
///
38
/// This method may be called multiple times and will return the
39
/// same result. There are no threading restrictions.
40
///
41
/// @param[in] vm_settings The settings used to launch the VM.
42
///
43
/// @return If tracing was enabled.
44
///
45
inline
bool
EnableTracingIfNecessary
(
const
Settings
& vm_settings) {
46
#if TRACING_CHECKS_NECESSARY
47
return
EnableTracingIfNecessaryImpl(vm_settings);
48
#else
// TRACING_CHECKS_NECESSARY
49
return
true
;
50
#endif
// TRACING_CHECKS_NECESSARY
51
}
52
53
//------------------------------------------------------------------------------
54
/// @brief Returns if a tracing check has been performed and its result. To
55
/// enable tracing, the Settings object used to launch the VM is
56
/// required. Components may want to display messages based on the
57
/// result of a previous tracing check without actually having the
58
/// settings object. This accessor can be used instead.
59
///
60
/// @return The tracing result.
61
///
62
inline
TracingResult
GetTracingResult
() {
63
#if TRACING_CHECKS_NECESSARY
64
return
GetTracingResultImpl();
65
#else
// TRACING_CHECKS_NECESSARY
66
return
TracingResult::kNotNecessary
;
67
#endif
// TRACING_CHECKS_NECESSARY
68
}
69
70
}
// namespace flutter
71
72
#endif
// FLUTTER_RUNTIME_PTRACE_CHECK_H_
flutter
Definition
asset_manager.cc:10
flutter::GetTracingResult
TracingResult GetTracingResult()
Returns if a tracing check has been performed and its result. To enable tracing, the Settings object ...
Definition
ptrace_check.h:62
flutter::EnableTracingIfNecessary
bool EnableTracingIfNecessary(const Settings &vm_settings)
Enables tracing in the process so that JIT mode VMs may be launched. Explicitly enabling tracing is n...
Definition
ptrace_check.h:45
flutter::TracingResult
TracingResult
Definition
ptrace_check.h:17
flutter::TracingResult::kNotNecessary
@ kNotNecessary
flutter::TracingResult::kDisabled
@ kDisabled
flutter::TracingResult::kNotAttempted
@ kNotAttempted
flutter::TracingResult::kEnabled
@ kEnabled
flutter::Settings
Definition
settings.h:104
Generated on Fri Apr 26 2024 06:14:18 for Flutter Engine by
1.9.8