settings.h 2.8 KB
Newer Older
A
Adam Barth 已提交
1 2 3 4
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
#ifndef FLUTTER_COMMON_SETTINGS_H_
#define FLUTTER_COMMON_SETTINGS_H_
A
Adam Barth 已提交
7

8
#include <fcntl.h>
9 10
#include <stdint.h>

11
#include <memory>
12
#include <string>
13
#include <vector>
14

15 16 17
#include "flutter/fml/unique_fd.h"
#include "lib/fxl/functional/closure.h"

A
Adam Barth 已提交
18 19
namespace blink {

20 21 22 23
using TaskObserverAdd =
    std::function<void(intptr_t /* key */, fxl::Closure /* callback */)>;
using TaskObserverRemove = std::function<void(intptr_t /* key */)>;

24
struct Settings {
25
  // VM settings
26
  std::string script_snapshot_path;
27
  std::string platform_kernel_path;
28

29 30 31 32
  std::string vm_snapshot_data_path;
  std::string vm_snapshot_instr_path;
  std::string isolate_snapshot_data_path;
  std::string isolate_snapshot_instr_path;
33

34
  std::string application_library_path;
35
  std::string application_kernel_asset;
36
  std::string application_kernel_list_asset;
37 38 39 40

  std::string main_dart_file_path;
  std::string packages_file_path;

41
  std::string temp_directory_path;
42
  std::vector<std::string> dart_flags;
43 44 45 46 47 48 49

  // Isolate settings
  bool start_paused = false;
  bool trace_skia = false;
  bool trace_startup = false;
  bool endless_trace_buffer = false;
  bool enable_dart_profiling = false;
50
  bool dart_non_checked_mode = false;
51 52 53 54 55 56
  // Used as the script URI in debug messages. Does not affect how the Dart code
  // is executed.
  std::string advisory_script_uri = "main.dart";
  // Used as the script entrypoint in debug messages. Does not affect how the
  // Dart code is executed.
  std::string advisory_script_entrypoint = "main";
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78

  // Observatory settings
  bool enable_observatory = false;
  // Port on target will be auto selected by the OS. A message will be printed
  // on the target with the port after it has been selected.
  uint32_t observatory_port = 0;
  bool ipv6 = false;

  // Font settings
  bool use_test_fonts = false;

  // Engine settings
  TaskObserverAdd task_observer_add;
  TaskObserverRemove task_observer_remove;
  // The main isolate is current when this callback is made. This is a good spot
  // to perform native Dart bindings for libraries not built in.
  fxl::Closure root_isolate_create_callback;
  // The isolate is not current and may have already been destroyed when this
  // call is made.
  fxl::Closure root_isolate_shutdown_callback;
  bool enable_software_rendering = false;
  bool skia_deterministic_rendering_on_cpu = false;
79
  bool verbose_logging = false;
80
  std::string log_tag = "flutter";
81 82 83 84 85 86 87
  std::string icu_data_path;

  // Assets settings
  fml::UniqueFD::element_type assets_dir =
      fml::UniqueFD::traits_type::InvalidValue();
  std::string assets_path;
  std::string flx_path;
A
Adam Barth 已提交
88

89
  std::string ToString() const;
A
Adam Barth 已提交
90 91
};

92
}  // namespace blink
A
Adam Barth 已提交
93

94
#endif  // FLUTTER_COMMON_SETTINGS_H_