stuartmorgan 41ce791926
[macos] Allow engine flags via environment vars (#21468)
Replaces the (temporary) compile-time option to pass engine switches
with the ability to pass them temporarily at runtime via environment
variables. This moves the recently-added code for doing this on Windows
to a shared location for use by all desktop embeddings.

This is enabled only for debug/profile to avoid potential issues with
tampering with released applications, but if there is a need for that in
the future it could be added (potentially with a whitelist, as is
currently used for Dart VM flags).

Temporarily adds a way to enable mirrors as a compile time option,
as is already provided in the Linux embedding, to provide a migration
path for the one remaining known need for compile-time options
that has been raised in flutter/flutter#38569.
2020-09-29 09:36:30 -07:00

32 lines
1.1 KiB
C++

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_SHELL_PLATFORM_COMMON_CPP_ENGINE_SWITCHES_H_
#define FLUTTER_SHELL_PLATFORM_COMMON_CPP_ENGINE_SWITCHES_H_
#include <string>
#include <vector>
namespace flutter {
// Returns an array of engine switches suitable to pass to the embedder API
// in FlutterProjectArgs, based on parsing variables from the environment in
// the form:
// FLUTTER_ENGINE_SWITCHES=<count>
// FLUTTER_ENGINE_SWITCH_1=...
// FLUTTER_ENGINE_SWITCH_2=...
// ...
// Values should match those in shell/common/switches.h
//
// The returned array does not include the initial dummy argument expected by
// the embedder API, so command_line_argv should not be set directly from it.
//
// In release mode, not all switches from the environment will necessarily be
// returned. See the implementation for details.
std::vector<std::string> GetSwitchesFromEnvironment();
} // namespace flutter
#endif // FLUTTER_SHELL_PLATFORM_COMMON_CPP_ENGINE_SWITCHES_H_