示例#1
0
void SetupCRT(const CommandLine& parsed_command_line) {
#if defined(OS_WIN)
#ifdef _CRTDBG_MAP_ALLOC
  _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
  _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
#else
  if (!parsed_command_line.HasSwitch(switches::kDisableBreakpad)) {
    _CrtSetReportMode(_CRT_ASSERT, 0);
  }
#endif

  // Enable the low fragmentation heap for the CRT heap. The heap is not changed
  // if the process is run under the debugger is enabled or if certain gflags
  // are set.
  bool use_lfh = false;
  if (parsed_command_line.HasSwitch(switches::kUseLowFragHeapCrt))
    use_lfh = parsed_command_line.GetSwitchValue(switches::kUseLowFragHeapCrt)
        != L"false";
  if (use_lfh) {
    void* crt_heap = reinterpret_cast<void*>(_get_heap_handle());
    ULONG enable_lfh = 2;
    HeapSetInformation(crt_heap, HeapCompatibilityInformation,
                       &enable_lfh, sizeof(enable_lfh));
  }
#endif
}
示例#2
0
	void CommandLine::CopySwitchesFrom(const CommandLine& source,
		const char* const switches[],
		size_t count) {
			for (size_t i = 0; i < count; ++i) {
				if (source.HasSwitch(switches[i]))
					AppendSwitchNative(switches[i], source.GetSwitchValueNative(switches[i]));
			}
	}
std::string WebEngineLibraryInfo::getApplicationLocale()
{
    CommandLine *parsedCommandLine = CommandLine::ForCurrentProcess();
    if (!parsedCommandLine->HasSwitch(switches::kLang))
        return QLocale().bcp47Name().toStdString();

    return parsedCommandLine->GetSwitchValueASCII(switches::kLang);
}