Flutter Engine
The Flutter Engine
root_inspect_node.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 "root_inspect_node.h"
6#include <lib/async/default.h>
7
8namespace dart_utils {
9
10std::unique_ptr<inspect::ComponentInspector> RootInspectNode::inspector_;
11std::mutex RootInspectNode::mutex_;
12
14 std::lock_guard<std::mutex> lock(mutex_);
15 if (!inspector_) {
16 inspector_ = std::make_unique<inspect::ComponentInspector>(
17 async_get_default_dispatcher(), inspect::PublishOptions{});
18 }
19}
20
21inspect::Node RootInspectNode::CreateRootChild(const std::string& name) {
22 std::lock_guard<std::mutex> lock(mutex_);
23 return inspector_->inspector().GetRoot().CreateChild(name);
24}
25
26inspect::Inspector* RootInspectNode::GetInspector() {
27 return &inspector_->inspector();
28}
29
30} // namespace dart_utils
static inspect::Inspector * GetInspector()
static void Initialize(sys::ComponentContext *context)
static inspect::Node CreateRootChild(const std::string &name)
sys::ComponentContext * ComponentContext()
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32