Skip to content

Commit f963de6

Browse files
committed
Delegating constructor
Converted the constructor with the default values into a delegating constructor
1 parent bc4a214 commit f963de6

File tree

1 file changed

+10
-32
lines changed

1 file changed

+10
-32
lines changed

framework/util/page_guard_manager.cpp

+10-32
Original file line numberDiff line numberDiff line change
@@ -216,36 +216,14 @@ void PageGuardManager::InitializeSystemExceptionContext(void)
216216
}
217217

218218
PageGuardManager::PageGuardManager() :
219-
exception_handler_(nullptr), exception_handler_count_(0), system_page_size_(util::platform::GetSystemPageSize()),
220-
system_page_pot_shift_(GetSystemPagePotShift()), enable_copy_on_map_(kDefaultEnableCopyOnMap),
221-
enable_separate_read_(kDefaultEnableSeparateRead), unblock_sigsegv_(kDefaultUnblockSIGSEGV),
222-
enable_signal_handler_watcher_(kDefaultEnableSignalHandlerWatcher),
223-
signal_handler_watcher_max_restores_(kDefaultSignalHandlerWatcherMaxRestores),
224-
enable_read_write_same_page_(kDefaultEnableReadWriteSamePage), protection_mode_(kDefaultMemoryProtMode)
225-
{
226-
if (kUserFaultFdMode == protection_mode_ && !USERFAULTFD_SUPPORTED)
227-
{
228-
GFXRECON_LOG_WARNING(
229-
"Kernel does not support all features for userfaultfd memory tracking mode. Falling back to mprotect mode.");
230-
231-
protection_mode_ = kMProtectMode;
232-
}
233-
234-
if (kMProtectMode == protection_mode_)
235-
{
236-
InitializeSystemExceptionContext();
237-
}
238-
else
239-
{
240-
if (!InitializeUserFaultFd())
241-
{
242-
GFXRECON_LOG_ERROR("Userfaultfd initialization failed. Falling back to mprotect memory tracking mode.");
243-
244-
protection_mode_ = kMProtectMode;
245-
InitializeSystemExceptionContext();
246-
}
247-
}
248-
}
219+
PageGuardManager(kDefaultEnableCopyOnMap,
220+
kDefaultEnableSeparateRead,
221+
kDefaultUnblockSIGSEGV,
222+
kDefaultEnableSignalHandlerWatcher,
223+
kDefaultSignalHandlerWatcherMaxRestores,
224+
kDefaultEnableReadWriteSamePage,
225+
kDefaultMemoryProtMode)
226+
{}
249227

250228
PageGuardManager::PageGuardManager(bool enable_copy_on_map,
251229
bool enable_separate_read,
@@ -264,8 +242,8 @@ PageGuardManager::PageGuardManager(bool enable_copy_on_map,
264242
{
265243
if (kUserFaultFdMode == protection_mode_ && !USERFAULTFD_SUPPORTED)
266244
{
267-
GFXRECON_LOG_WARNING(
268-
"Kernel does not support all features for userfaultfd memory tracking mode. Falling back to mprotect mode.");
245+
GFXRECON_LOG_WARNING("Kernel does not support all features for userfaultfd memory tracking mode. Falling back "
246+
"to mprotect mode.");
269247

270248
protection_mode_ = kMProtectMode;
271249
}

0 commit comments

Comments
 (0)