Flutter Engine
The Flutter Engine
vmservice_object.cc
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#include "vmservice_object.h"
6
7#include <dirent.h>
8#include <fuchsia/io/cpp/fidl.h>
9#include <zircon/status.h>
10
11#include <cerrno>
12#include <string>
13
14#include "flutter/fml/logging.h"
15
16namespace {
17
18bool ReadDirContents(const std::string& path, std::vector<std::string>* out) {
19 out->clear();
20 DIR* dir = opendir(path.c_str());
21 if (!dir) {
22 return false;
23 }
24 struct dirent* de;
25 errno = 0;
26 while ((de = readdir(dir)) != nullptr) {
27 out->push_back(de->d_name);
28 }
29 closedir(dir);
30 return !errno;
31}
32
33} // namespace
34
35namespace dart_utils {
36
37void VMServiceObject::GetContents(LazyEntryVector* out_vector) const {
38 // List /tmp/dart.services if it exists, and push its contents as
39 // the contents of this directory.
40 std::vector<std::string> files;
41 if (!ReadDirContents(kPortDir, &files)) {
42 FML_LOG(ERROR) << "Failed to read Dart VM service port directory '"
43 << kPortDir << "': " << strerror(errno);
44 return;
45 }
46 for (const auto& file : files) {
47 if ((file == ".") || (file == "..")) {
48 continue;
49 }
50 out_vector->push_back({std::stoul(file) + GetStartingId(), file,
51 fuchsia::io::MODE_TYPE_FILE});
52 }
53}
54
55zx_status_t VMServiceObject::GetFile(Node** out_node,
56 uint64_t id,
57 std::string name) const {
58 return ZX_ERR_NOT_FOUND;
59}
60
61} // namespace dart_utils
void GetContents(LazyEntryVector *out_vector) const override
zx_status_t GetFile(Node **out_node, uint64_t id, std::string name) const override
static constexpr const char * kPortDir
#define FML_LOG(severity)
Definition: logging.h:82
Definition: dart.idl:29
const CatchEntryMove de[]
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition: switches.h:145
#define ERROR(message)
Definition: elf_loader.cc:260