Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
1019008f
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
1019008f
编写于
4月 27, 2021
作者:
L
lucasradaelli
提交者:
GitHub
4月 27, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[fuchsia] Adds a singleton to access inspect root node. (#25745)
Bug: fxbug.dev/75281
上级
555073f6
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
79 addition
and
8 deletion
+79
-8
ci/licenses_golden/licenses_flutter
ci/licenses_golden/licenses_flutter
+2
-0
shell/platform/fuchsia/dart_runner/main.cc
shell/platform/fuchsia/dart_runner/main.cc
+4
-4
shell/platform/fuchsia/flutter/main.cc
shell/platform/fuchsia/flutter/main.cc
+4
-4
shell/platform/fuchsia/runtime/dart/utils/BUILD.gn
shell/platform/fuchsia/runtime/dart/utils/BUILD.gn
+3
-0
shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.cc
.../platform/fuchsia/runtime/dart/utils/root_inspect_node.cc
+24
-0
shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.h
...l/platform/fuchsia/runtime/dart/utils/root_inspect_node.h
+42
-0
未找到文件。
ci/licenses_golden/licenses_flutter
浏览文件 @
1019008f
...
...
@@ -1373,6 +1373,8 @@ FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/inlines.h
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/logging.h
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.cc
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/mapped_resource.h
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.cc
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.h
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/tempfs.cc
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/tempfs.h
FILE: ../../../flutter/shell/platform/fuchsia/runtime/dart/utils/vmo.cc
...
...
shell/platform/fuchsia/dart_runner/main.cc
浏览文件 @
1019008f
...
...
@@ -15,6 +15,7 @@
#include "logging.h"
#include "platform/utils.h"
#include "runtime/dart/utils/files.h"
#include "runtime/dart/utils/root_inspect_node.h"
#include "runtime/dart/utils/tempfs.h"
#include "third_party/dart/runtime/include/dart_api.h"
...
...
@@ -37,11 +38,10 @@ int main(int argc, const char** argv) {
// Create our component context which is served later.
auto
context
=
sys
::
ComponentContext
::
Create
();
sys
::
ComponentInspector
inspector
(
context
.
get
());
dart_utils
::
RootInspectNode
::
Initialize
(
context
.
get
());
inspect
::
Node
&
root
=
inspector
.
inspector
()
->
GetRoot
();
dart
::
SetDartVmNode
(
std
::
make_unique
<
inspect
::
Node
>
(
root
.
CreateChild
(
"vm"
)));
dart
::
SetDartVmNode
(
std
::
make_unique
<
inspect
::
Node
>
(
dart_utils
::
RootInspectNode
::
CreateRootChild
(
"vm"
)));
std
::
unique_ptr
<
trace
::
TraceProviderWithFdio
>
provider
;
{
...
...
shell/platform/fuchsia/flutter/main.cc
浏览文件 @
1019008f
...
...
@@ -12,6 +12,7 @@
#include "loop.h"
#include "platform/utils.h"
#include "runner.h"
#include "runtime/dart/utils/root_inspect_node.h"
#include "runtime/dart/utils/tempfs.h"
int
main
(
int
argc
,
char
const
*
argv
[])
{
...
...
@@ -19,13 +20,12 @@ int main(int argc, char const* argv[]) {
// Create our component context which is served later.
auto
context
=
sys
::
ComponentContext
::
Create
();
sys
::
ComponentInspector
inspector
(
context
.
get
());
inspect
::
Node
&
root
=
inspector
.
inspector
()
->
GetRoot
();
dart_utils
::
RootInspectNode
::
Initialize
(
context
.
get
());
// We inject the 'vm' node into the dart vm so that it can add any inspect
// data that it needs to the inspect tree.
dart
::
SetDartVmNode
(
std
::
make_unique
<
inspect
::
Node
>
(
root
.
CreateChild
(
"vm"
)));
dart
::
SetDartVmNode
(
std
::
make_unique
<
inspect
::
Node
>
(
dart_utils
::
RootInspectNode
::
CreateRootChild
(
"vm"
)));
std
::
unique_ptr
<
trace
::
TraceProviderWithFdio
>
provider
;
{
...
...
shell/platform/fuchsia/runtime/dart/utils/BUILD.gn
浏览文件 @
1019008f
...
...
@@ -22,6 +22,8 @@ template("make_utils") {
"logging.h",
"mapped_resource.cc",
"mapped_resource.h",
"root_inspect_node.cc",
"root_inspect_node.h",
"tempfs.cc",
"tempfs.h",
"vmo.cc",
...
...
@@ -39,6 +41,7 @@ template("make_utils") {
"$fuchsia_sdk_root/pkg:fdio",
"$fuchsia_sdk_root/pkg:memfs",
"$fuchsia_sdk_root/pkg:sys_cpp",
"$fuchsia_sdk_root/pkg:sys_inspect_cpp",
"$fuchsia_sdk_root/pkg:syslog",
"$fuchsia_sdk_root/pkg:trace",
"$fuchsia_sdk_root/pkg:vfs_cpp",
...
...
shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.cc
0 → 100644
浏览文件 @
1019008f
// 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.
#include "root_inspect_node.h"
namespace
dart_utils
{
std
::
unique_ptr
<
sys
::
ComponentInspector
>
RootInspectNode
::
inspector_
;
std
::
mutex
RootInspectNode
::
mutex_
;
void
RootInspectNode
::
Initialize
(
sys
::
ComponentContext
*
context
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
if
(
!
inspector_
)
{
inspector_
=
std
::
make_unique
<
sys
::
ComponentInspector
>
(
context
);
}
}
inspect
::
Node
RootInspectNode
::
CreateRootChild
(
const
std
::
string
&
name
)
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
mutex_
);
return
inspector_
->
inspector
()
->
GetRoot
().
CreateChild
(
name
);
}
}
// namespace dart_utils
shell/platform/fuchsia/runtime/dart/utils/root_inspect_node.h
0 → 100644
浏览文件 @
1019008f
// 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_FUCHSIA_RUNTIME_DART_UTILS_ROOT_INSPECT_NODE_H_
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_ROOT_INSPECT_NODE_H_
#include <lib/sys/inspect/cpp/component.h>
#include <memory>
#include <mutex>
namespace
dart_utils
{
// This singleton object offers a way to create a new inspect node under the
// root node in a thread safe way.
//
// Usage notes:
// RootInspectNode::Initialize() must be invoked once in the program's
// main before trying to obtain a child node.
class
RootInspectNode
{
private:
RootInspectNode
()
=
default
;
~
RootInspectNode
()
=
default
;
public:
// Initializes the underlying component inspector. Must be invoked at least
// once before calling CreateRootChild().
static
void
Initialize
(
sys
::
ComponentContext
*
context
);
// Creates an inspect node which is a child of the component's root inspect
// node with the provided |name|.
static
inspect
::
Node
CreateRootChild
(
const
std
::
string
&
name
);
private:
static
std
::
unique_ptr
<
sys
::
ComponentInspector
>
inspector_
;
static
std
::
mutex
mutex_
;
};
}
// namespace dart_utils
#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_RUNTIME_DART_UTILS_ROOT_INSPECT_NODE_H_
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录