Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
6e2d67fa
E
engine
项目概览
weixin_43355755
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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,发现更多精彩内容 >>
提交
6e2d67fa
编写于
9月 01, 2017
作者:
Z
Zachary Anderson
提交者:
GitHub
9月 01, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Fuchsia] Pass namespaces to Isolates (#4047)
上级
75a7afa6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
1 deletion
+65
-1
content_handler/application_controller_impl.cc
content_handler/application_controller_impl.cc
+38
-0
content_handler/application_controller_impl.h
content_handler/application_controller_impl.h
+4
-0
content_handler/runtime_holder.cc
content_handler/runtime_holder.cc
+17
-0
content_handler/runtime_holder.h
content_handler/runtime_holder.h
+5
-1
runtime/dart_vm_entry_points_fuchsia.txt
runtime/dart_vm_entry_points_fuchsia.txt
+1
-0
未找到文件。
content_handler/application_controller_impl.cc
浏览文件 @
6e2d67fa
...
...
@@ -6,6 +6,9 @@
#include <utility>
#include <magenta/status.h>
#include <mxio/namespace.h>
#include "application/lib/app/connect.h"
#include "flutter/content_handler/app.h"
#include "flutter/content_handler/runtime_holder.h"
...
...
@@ -56,15 +59,50 @@ ApplicationControllerImpl::ApplicationControllerImpl(
auto
request
=
service_provider
.
NewRequest
();
service_provider_bridge_
.
set_backend
(
std
::
move
(
service_provider
));
mxio_ns_t
*
mxio_ns
=
SetupNamespace
(
startup_info
->
flat_namespace
);
if
(
mxio_ns
==
nullptr
)
{
FTL_LOG
(
ERROR
)
<<
"Failed to initialize namespace"
;
}
url_
=
startup_info
->
launch_info
->
url
;
runtime_holder_
.
reset
(
new
RuntimeHolder
());
runtime_holder_
->
Init
(
mxio_ns
,
app
::
ApplicationContext
::
CreateFrom
(
std
::
move
(
startup_info
)),
std
::
move
(
request
),
std
::
move
(
bundle
));
}
ApplicationControllerImpl
::~
ApplicationControllerImpl
()
=
default
;
constexpr
char
kServiceRootPath
[]
=
"/svc"
;
mxio_ns_t
*
ApplicationControllerImpl
::
SetupNamespace
(
const
app
::
FlatNamespacePtr
&
flat
)
{
mxio_ns_t
*
mxio_namespc
;
mx_status_t
status
=
mxio_ns_create
(
&
mxio_namespc
);
if
(
status
!=
MX_OK
)
{
FTL_LOG
(
ERROR
)
<<
"Failed to create namespace"
;
return
nullptr
;
}
for
(
size_t
i
=
0
;
i
<
flat
->
paths
.
size
();
++
i
)
{
if
(
flat
->
paths
[
i
]
==
kServiceRootPath
)
{
// Ownership of /svc goes to the ApplicationContext created above.
continue
;
}
mx
::
channel
dir
=
std
::
move
(
flat
->
directories
[
i
]);
mx_handle_t
dir_handle
=
dir
.
release
();
const
char
*
path
=
flat
->
paths
[
i
].
data
();
status
=
mxio_ns_bind
(
mxio_namespc
,
path
,
dir_handle
);
if
(
status
!=
MX_OK
)
{
FTL_LOG
(
ERROR
)
<<
"Failed to bind "
<<
flat
->
paths
[
i
]
<<
" to namespace"
;
mx_handle_close
(
dir_handle
);
mxio_ns_destroy
(
mxio_namespc
);
return
nullptr
;
}
}
return
mxio_namespc
;
}
void
ApplicationControllerImpl
::
Kill
()
{
runtime_holder_
.
reset
();
app_
->
Destroy
(
this
);
...
...
content_handler/application_controller_impl.h
浏览文件 @
6e2d67fa
...
...
@@ -7,6 +7,8 @@
#include <memory>
#include <mxio/namespace.h>
#include "application/lib/svc/service_provider_bridge.h"
#include "application/services/application_controller.fidl.h"
#include "application/services/application_runner.fidl.h"
...
...
@@ -50,6 +52,8 @@ class ApplicationControllerImpl : public app::ApplicationController,
private:
void
StartRuntimeIfReady
();
mxio_ns_t
*
SetupNamespace
(
const
app
::
FlatNamespacePtr
&
flat
);
App
*
app_
;
fidl
::
Binding
<
app
::
ApplicationController
>
binding_
;
...
...
content_handler/runtime_holder.cc
浏览文件 @
6e2d67fa
...
...
@@ -6,6 +6,7 @@
#include <dlfcn.h>
#include <magenta/dlfcn.h>
#include <mxio/namespace.h>
#include <utility>
#include "application/lib/app/connect.h"
...
...
@@ -94,6 +95,7 @@ RuntimeHolder::~RuntimeHolder() {
}
void
RuntimeHolder
::
Init
(
mxio_ns_t
*
namespc
,
std
::
unique_ptr
<
app
::
ApplicationContext
>
context
,
fidl
::
InterfaceRequest
<
app
::
ServiceProvider
>
outgoing_services
,
std
::
vector
<
char
>
bundle
)
{
...
...
@@ -101,6 +103,7 @@ void RuntimeHolder::Init(
rasterizer_
=
Rasterizer
::
Create
();
FTL_DCHECK
(
rasterizer_
);
namespc_
=
namespc
;
context_
=
std
::
move
(
context
);
outgoing_services_
=
std
::
move
(
outgoing_services
);
...
...
@@ -351,10 +354,24 @@ void RuntimeHolder::HandlePlatformMessage(
void
RuntimeHolder
::
DidCreateMainIsolate
(
Dart_Isolate
isolate
)
{
if
(
asset_store_
)
blink
::
AssetFontSelector
::
Install
(
asset_store_
);
InitDartIoInternal
();
InitFidlInternal
();
InitMozartInternal
();
}
void
RuntimeHolder
::
InitDartIoInternal
()
{
Dart_Handle
io_lib
=
Dart_LookupLibrary
(
ToDart
(
"dart:io"
));
Dart_Handle
namespace_type
=
Dart_GetType
(
io_lib
,
ToDart
(
"_Namespace"
),
0
,
nullptr
);
DART_CHECK_VALID
(
namespace_type
);
Dart_Handle
namespace_args
[
1
];
namespace_args
[
0
]
=
Dart_NewInteger
(
reinterpret_cast
<
intptr_t
>
(
namespc_
));
DART_CHECK_VALID
(
namespace_args
[
0
]);
DART_CHECK_VALID
(
Dart_Invoke
(
namespace_type
,
ToDart
(
"_setupNamespace"
),
1
,
namespace_args
));
}
void
RuntimeHolder
::
InitFidlInternal
()
{
fidl
::
InterfaceHandle
<
app
::
ApplicationEnvironment
>
environment
;
context_
->
ConnectToEnvironmentService
(
environment
.
NewRequest
());
...
...
content_handler/runtime_holder.h
浏览文件 @
6e2d67fa
...
...
@@ -6,6 +6,7 @@
#define FLUTTER_CONTENT_HANDLER_RUNTIME_HOLDER_H_
#include <mx/channel.h>
#include <mxio/namespace.h>
#include <unordered_set>
...
...
@@ -39,7 +40,8 @@ class RuntimeHolder : public blink::RuntimeDelegate,
RuntimeHolder
();
~
RuntimeHolder
();
void
Init
(
std
::
unique_ptr
<
app
::
ApplicationContext
>
context
,
void
Init
(
mxio_ns_t
*
namespc
,
std
::
unique_ptr
<
app
::
ApplicationContext
>
context
,
fidl
::
InterfaceRequest
<
app
::
ServiceProvider
>
outgoing_services
,
std
::
vector
<
char
>
bundle
);
void
CreateView
(
const
std
::
string
&
script_uri
,
...
...
@@ -83,6 +85,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
bool
HandleAssetPlatformMessage
(
blink
::
PlatformMessage
*
message
);
bool
HandleTextInputPlatformMessage
(
blink
::
PlatformMessage
*
message
);
void
InitDartIoInternal
();
void
InitFidlInternal
();
void
InitMozartInternal
();
...
...
@@ -92,6 +95,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
void
OnRedrawFrame
();
void
Invalidate
();
mxio_ns_t
*
namespc_
;
std
::
unique_ptr
<
app
::
ApplicationContext
>
context_
;
fidl
::
InterfaceRequest
<
app
::
ServiceProvider
>
outgoing_services_
;
std
::
vector
<
char
>
root_bundle_data_
;
...
...
runtime/dart_vm_entry_points_fuchsia.txt
浏览文件 @
6e2d67fa
dart:io,_Namespace,_setupNamespace
dart:fidl.internal,::,_environment
dart:fidl.internal,::,_outgoingServices
dart:fidl.internal,GetSizeResult,GetSizeResult.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录