Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
ac552fba
E
engine
项目概览
qq_34031325
/
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,发现更多精彩内容 >>
提交
ac552fba
编写于
3月 29, 2018
作者:
J
Jeff Brown
提交者:
Adam Barth
3月 29, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Port flutter content handler to FIDL2. (#4903)
上级
94cdd810
变更
27
隐藏空白更改
内联
并排
Showing
27 changed file
with
227 addition
and
233 deletion
+227
-233
content_handler/BUILD.gn
content_handler/BUILD.gn
+2
-3
content_handler/accessibility_bridge.cc
content_handler/accessibility_bridge.cc
+1
-2
content_handler/accessibility_bridge.h
content_handler/accessibility_bridge.h
+2
-2
content_handler/app.cc
content_handler/app.cc
+5
-5
content_handler/app.h
content_handler/app.h
+5
-5
content_handler/application_controller_impl.cc
content_handler/application_controller_impl.cc
+21
-21
content_handler/application_controller_impl.h
content_handler/application_controller_impl.h
+17
-17
content_handler/fuchsia_font_manager.cc
content_handler/fuchsia_font_manager.cc
+11
-11
content_handler/fuchsia_font_manager.h
content_handler/fuchsia_font_manager.h
+1
-1
content_handler/rasterizer.h
content_handler/rasterizer.h
+1
-1
content_handler/runtime_holder.cc
content_handler/runtime_holder.cc
+73
-79
content_handler/runtime_holder.h
content_handler/runtime_holder.h
+32
-32
content_handler/session_connection.cc
content_handler/session_connection.cc
+11
-10
content_handler/session_connection.h
content_handler/session_connection.h
+4
-4
content_handler/vulkan_rasterizer.cc
content_handler/vulkan_rasterizer.cc
+1
-1
content_handler/vulkan_rasterizer.h
content_handler/vulkan_rasterizer.h
+1
-1
content_handler/vulkan_surface.cc
content_handler/vulkan_surface.cc
+9
-9
flow/BUILD.gn
flow/BUILD.gn
+1
-1
flow/export_node.cc
flow/export_node.cc
+2
-2
flow/layers/layer.h
flow/layers/layer.h
+1
-1
flow/layers/layer_tree.cc
flow/layers/layer_tree.cc
+2
-2
flow/layers/layer_tree.h
flow/layers/layer_tree.h
+3
-3
flow/raster_cache.cc
flow/raster_cache.cc
+2
-2
flow/raster_cache.h
flow/raster_cache.h
+2
-2
flow/scene_update_context.h
flow/scene_update_context.h
+4
-3
sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp
sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp
+12
-12
sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h
sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h
+1
-1
未找到文件。
content_handler/BUILD.gn
浏览文件 @
ac552fba
...
...
@@ -64,11 +64,10 @@ template("flutter_content_handler") {
"//garnet/public/lib/svc/cpp",
"//garnet/public/lib/ui/input/fidl",
"//garnet/public/lib/ui/scenic:client",
"//garnet/public/lib/ui/views/fidl",
"//garnet/public/lib/ui/views/fidl
:v1
",
"//garnet/public/lib/vulkan",
"//garnet/public/lib/zip",
"//peridot/public/lib/clipboard/fidl",
"//peridot/public/lib/context/fidl",
"//peridot/public/lib:fidl",
"//third_party/rapidjson",
"//third_party/skia",
"//topaz/lib/tonic",
...
...
content_handler/accessibility_bridge.cc
浏览文件 @
ac552fba
...
...
@@ -8,7 +8,6 @@
#include "flutter/lib/ui/semantics/semantics_node.h"
#include "lib/app/cpp/application_context.h"
#include "lib/context/fidl/context_writer.fidl.h"
#include "lib/fxl/macros.h"
#include "third_party/rapidjson/rapidjson/document.h"
#include "third_party/rapidjson/rapidjson/stringbuffer.h"
...
...
@@ -17,7 +16,7 @@
namespace
flutter_runner
{
AccessibilityBridge
::
AccessibilityBridge
(
component
::
ApplicationContext
*
context
)
:
writer_
(
context
->
ConnectToEnvironmentService
<
m
axwell
::
ContextWriter
>
())
{}
:
writer_
(
context
->
ConnectToEnvironmentService
<
m
odular
::
ContextWriter
>
())
{}
void
AccessibilityBridge
::
UpdateSemantics
(
const
blink
::
SemanticsNodeUpdates
&
update
)
{
...
...
content_handler/accessibility_bridge.h
浏览文件 @
ac552fba
...
...
@@ -9,7 +9,7 @@
#include "flutter/lib/ui/semantics/semantics_node.h"
#include "lib/app/cpp/application_context.h"
#include
"lib/context/fidl/context_writer.fidl.h"
#include
<fuchsia/cpp/modular.h>
namespace
flutter_runner
{
...
...
@@ -34,7 +34,7 @@ class AccessibilityBridge {
void
EraseUnvisitedNodes
(
const
std
::
vector
<
int
>&
visited_nodes
);
std
::
map
<
int
,
blink
::
SemanticsNode
>
semantics_nodes_
;
m
axwell
::
ContextWriterPtr
writer_
;
m
odular
::
ContextWriterPtr
writer_
;
};
}
// namespace flutter_runner
...
...
content_handler/app.cc
浏览文件 @
ac552fba
...
...
@@ -79,7 +79,7 @@ App::App() {
}
context_
->
outgoing_services
()
->
AddService
<
component
::
ApplicationRunner
>
(
[
this
](
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationRunner
>
request
)
{
[
this
](
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationRunner
>
request
)
{
runner_bindings_
.
AddBinding
(
this
,
std
::
move
(
request
));
});
}
...
...
@@ -129,12 +129,12 @@ void App::WaitForPlatformViewsIdsUIThread(
}
void
App
::
StartApplication
(
component
::
ApplicationPackage
Ptr
application
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
{
component
::
ApplicationPackage
application
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
{
if
(
controllers_
.
empty
())
{
// Name this process after the url of the first application being launched.
base_label_
=
"flutter:"
+
GetLabelFromURL
(
startup_info
->
launch_info
->
url
);
base_label_
=
"flutter:"
+
GetLabelFromURL
(
startup_info
.
launch_info
.
url
);
}
std
::
unique_ptr
<
ApplicationControllerImpl
>
impl
=
...
...
content_handler/app.h
浏览文件 @
ac552fba
...
...
@@ -10,7 +10,7 @@
#include "flutter/content_handler/application_controller_impl.h"
#include "lib/app/cpp/application_context.h"
#include
"lib/app/fidl/application_runner.fidl.h"
#include
<fuchsia/cpp/component.h>
#include "lib/fsl/threading/thread.h"
#include "lib/fxl/macros.h"
#include "lib/fxl/synchronization/waitable_event.h"
...
...
@@ -27,9 +27,9 @@ class App : public component::ApplicationRunner {
// |component::ApplicationRunner| implementation:
void
StartApplication
(
component
::
ApplicationPackage
Ptr
application
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
override
;
component
::
ApplicationPackage
application
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
override
;
void
Destroy
(
ApplicationControllerImpl
*
controller
);
...
...
@@ -50,7 +50,7 @@ class App : public component::ApplicationRunner {
std
::
unique_ptr
<
component
::
ApplicationContext
>
context_
;
std
::
unique_ptr
<
fsl
::
Thread
>
gpu_thread_
;
std
::
unique_ptr
<
fsl
::
Thread
>
io_thread_
;
f
1
dl
::
BindingSet
<
component
::
ApplicationRunner
>
runner_bindings_
;
f
i
dl
::
BindingSet
<
component
::
ApplicationRunner
>
runner_bindings_
;
std
::
unordered_map
<
ApplicationControllerImpl
*
,
std
::
unique_ptr
<
ApplicationControllerImpl
>>
controllers_
;
...
...
content_handler/application_controller_impl.cc
浏览文件 @
ac552fba
...
...
@@ -19,9 +19,9 @@ namespace flutter_runner {
ApplicationControllerImpl
::
ApplicationControllerImpl
(
App
*
app
,
component
::
ApplicationPackage
Ptr
application
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
component
::
ApplicationPackage
application
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
:
app_
(
app
),
binding_
(
this
)
{
if
(
controller
.
is_valid
())
{
binding_
.
Bind
(
std
::
move
(
controller
));
...
...
@@ -32,8 +32,8 @@ ApplicationControllerImpl::ApplicationControllerImpl(
}
std
::
vector
<
char
>
bundle
;
if
(
application
->
data
)
{
if
(
!
fsl
::
VectorFromVmo
(
std
::
move
(
application
->
data
),
&
bundle
))
{
if
(
application
.
data
)
{
if
(
!
fsl
::
VectorFromVmo
(
std
::
move
(
*
application
.
data
),
&
bundle
))
{
FXL_LOG
(
ERROR
)
<<
"Failed to receive bundle."
;
return
;
}
...
...
@@ -42,13 +42,13 @@ ApplicationControllerImpl::ApplicationControllerImpl(
// TODO(jeffbrown): Decide what to do with command-line arguments and
// startup handles.
if
(
startup_info
->
launch_info
->
directory_request
.
is_valid
())
{
if
(
startup_info
.
launch_info
.
directory_request
.
is_valid
())
{
service_provider_bridge_
.
ServeDirectory
(
std
::
move
(
startup_info
->
launch_info
->
directory_request
));
std
::
move
(
startup_info
.
launch_info
.
directory_request
));
}
service_provider_bridge_
.
AddService
<
mozart
::
ViewProvider
>
(
[
this
](
f
1dl
::
InterfaceRequest
<
mozart
::
ViewProvider
>
request
)
{
service_provider_bridge_
.
AddService
<
views_v1
::
ViewProvider
>
(
[
this
](
f
idl
::
InterfaceRequest
<
views_v1
::
ViewProvider
>
request
)
{
view_provider_bindings_
.
AddBinding
(
this
,
std
::
move
(
request
));
});
...
...
@@ -56,13 +56,13 @@ ApplicationControllerImpl::ApplicationControllerImpl(
auto
request
=
service_provider
.
NewRequest
();
service_provider_bridge_
.
set_backend
(
std
::
move
(
service_provider
));
fdio_ns_t
*
fdio_ns
=
SetupNamespace
(
st
artup_info
->
flat_namespace
);
fdio_ns_t
*
fdio_ns
=
SetupNamespace
(
st
d
::
move
(
startup_info
.
flat_namespace
)
);
if
(
fdio_ns
==
nullptr
)
{
FXL_LOG
(
ERROR
)
<<
"Failed to initialize namespace"
;
return
;
}
url_
=
startup_info
->
launch_info
->
url
;
url_
=
startup_info
.
launch_info
.
url
;
runtime_holder_
.
reset
(
new
RuntimeHolder
());
runtime_holder_
->
SetMainIsolateShutdownCallback
([
this
]()
{
Kill
();
});
runtime_holder_
->
Init
(
...
...
@@ -75,24 +75,24 @@ ApplicationControllerImpl::~ApplicationControllerImpl() = default;
constexpr
char
kServiceRootPath
[]
=
"/svc"
;
fdio_ns_t
*
ApplicationControllerImpl
::
SetupNamespace
(
co
nst
component
::
FlatNamespacePtr
&
flat
)
{
co
mponent
::
FlatNamespace
flat
)
{
fdio_ns_t
*
fdio_namespc
;
zx_status_t
status
=
fdio_ns_create
(
&
fdio_namespc
);
if
(
status
!=
ZX_OK
)
{
FXL_LOG
(
ERROR
)
<<
"Failed to create namespace"
;
return
nullptr
;
}
for
(
size_t
i
=
0
;
i
<
flat
->
paths
->
size
();
++
i
)
{
if
(
flat
->
paths
->
at
(
i
)
==
kServiceRootPath
)
{
for
(
size_t
i
=
0
;
i
<
flat
.
paths
->
size
();
++
i
)
{
if
(
flat
.
paths
->
at
(
i
)
==
kServiceRootPath
)
{
// Ownership of /svc goes to the ApplicationContext created above.
continue
;
}
zx
::
channel
dir
=
std
::
move
(
flat
->
directories
->
at
(
i
));
zx
::
channel
dir
=
std
::
move
(
flat
.
directories
->
at
(
i
));
zx_handle_t
dir_handle
=
dir
.
release
();
const
char
*
path
=
flat
->
paths
->
at
(
i
)
->
data
();
const
char
*
path
=
flat
.
paths
->
at
(
i
)
->
data
();
status
=
fdio_ns_bind
(
fdio_namespc
,
path
,
dir_handle
);
if
(
status
!=
ZX_OK
)
{
FXL_LOG
(
ERROR
)
<<
"Failed to bind "
<<
flat
->
paths
->
at
(
i
)
FXL_LOG
(
ERROR
)
<<
"Failed to bind "
<<
flat
.
paths
->
at
(
i
)
<<
" to namespace"
;
zx_handle_close
(
dir_handle
);
fdio_ns_destroy
(
fdio_namespc
);
...
...
@@ -113,8 +113,8 @@ void ApplicationControllerImpl::Detach() {
binding_
.
set_error_handler
(
fxl
::
Closure
());
}
void
ApplicationControllerImpl
::
Wait
(
const
WaitCallback
&
callback
)
{
wait_callbacks_
.
push_back
(
callback
);
void
ApplicationControllerImpl
::
Wait
(
WaitCallback
callback
)
{
wait_callbacks_
.
push_back
(
std
::
move
(
callback
)
);
}
void
ApplicationControllerImpl
::
SendReturnCode
(
int32_t
return_code
)
{
...
...
@@ -125,8 +125,8 @@ void ApplicationControllerImpl::SendReturnCode(int32_t return_code) {
}
void
ApplicationControllerImpl
::
CreateView
(
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner_request
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
{
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner_request
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
{
runtime_holder_
->
CreateView
(
url_
,
std
::
move
(
view_owner_request
),
std
::
move
(
services
));
}
...
...
content_handler/application_controller_impl.h
浏览文件 @
ac552fba
...
...
@@ -9,15 +9,15 @@
#include <fdio/namespace.h>
#include "lib/app/fidl/application_controller.fidl.h"
#include "lib/app/fidl/application_runner.fidl.h"
#include "lib/app/fidl/service_provider.fidl.h"
#include "lib/fidl/cpp/bindings/binding.h"
#include "lib/fidl/cpp/bindings/binding_set.h"
#include <fuchsia/cpp/component.h>
#include <fuchsia/cpp/ui.h>
#include <fuchsia/cpp/views_v1.h>
#include "lib/fidl/cpp/binding.h"
#include "lib/fidl/cpp/binding_set.h"
#include "lib/fxl/macros.h"
#include "lib/fxl/synchronization/waitable_event.h"
#include "lib/svc/cpp/service_provider_bridge.h"
#include "lib/ui/views/fidl/view_provider.fidl.h"
#include "third_party/dart/runtime/include/dart_api.h"
namespace
flutter_runner
{
...
...
@@ -25,13 +25,13 @@ class App;
class
RuntimeHolder
;
class
ApplicationControllerImpl
:
public
component
::
ApplicationController
,
public
mozart
::
ViewProvider
{
public
views_v1
::
ViewProvider
{
public:
ApplicationControllerImpl
(
App
*
app
,
component
::
ApplicationPackage
Ptr
application
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
);
component
::
ApplicationPackage
application
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
);
~
ApplicationControllerImpl
()
override
;
...
...
@@ -39,13 +39,13 @@ class ApplicationControllerImpl : public component::ApplicationController,
void
Kill
()
override
;
void
Detach
()
override
;
void
Wait
(
const
WaitCallback
&
callback
)
override
;
void
Wait
(
WaitCallback
callback
)
override
;
// |
mozart
::ViewProvider| implementation
// |
views_v1
::ViewProvider| implementation
void
CreateView
(
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner_request
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
override
;
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner_request
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
override
;
Dart_Port
GetUIIsolateMainPort
();
std
::
string
GetUIIsolateName
();
...
...
@@ -54,14 +54,14 @@ class ApplicationControllerImpl : public component::ApplicationController,
void
StartRuntimeIfReady
();
void
SendReturnCode
(
int32_t
return_code
);
fdio_ns_t
*
SetupNamespace
(
co
nst
component
::
FlatNamespacePtr
&
flat
);
fdio_ns_t
*
SetupNamespace
(
co
mponent
::
FlatNamespace
flat
);
App
*
app_
;
f
1
dl
::
Binding
<
component
::
ApplicationController
>
binding_
;
f
i
dl
::
Binding
<
component
::
ApplicationController
>
binding_
;
component
::
ServiceProviderBridge
service_provider_bridge_
;
f
1dl
::
BindingSet
<
mozart
::
ViewProvider
>
view_provider_bindings_
;
f
idl
::
BindingSet
<
views_v1
::
ViewProvider
>
view_provider_bindings_
;
std
::
string
url_
;
std
::
unique_ptr
<
RuntimeHolder
>
runtime_holder_
;
...
...
content_handler/fuchsia_font_manager.cc
浏览文件 @
ac552fba
...
...
@@ -32,14 +32,14 @@ void UnmapMemory(const void* buffer, void* context) {
zx
::
vmar
::
root_self
().
unmap
(
reinterpret_cast
<
uintptr_t
>
(
buffer
),
size
);
}
sk_sp
<
SkData
>
MakeSkDataFromVMO
(
const
fsl
::
SizedVmoTransportPtr
&
vmo
)
{
if
(
!
fsl
::
SizedVmo
::
IsSizeValid
(
vmo
->
vmo
,
vmo
->
size
)
||
vmo
->
size
>
std
::
numeric_limits
<
size_t
>::
max
())
{
sk_sp
<
SkData
>
MakeSkDataFromVMO
(
fsl
::
SizedVmoTransport
vmo
)
{
if
(
!
fsl
::
SizedVmo
::
IsSizeValid
(
vmo
.
vmo
,
vmo
.
size
)
||
vmo
.
size
>
std
::
numeric_limits
<
size_t
>::
max
())
{
return
nullptr
;
}
uint64_t
size
=
vmo
->
size
;
uint64_t
size
=
vmo
.
size
;
uintptr_t
buffer
=
0
;
zx_status_t
status
=
zx
::
vmar
::
root_self
().
map
(
0
,
vmo
->
vmo
,
0
,
size
,
zx_status_t
status
=
zx
::
vmar
::
root_self
().
map
(
0
,
vmo
.
vmo
,
0
,
size
,
ZX_VM_FLAG_PERM_READ
,
&
buffer
);
if
(
status
!=
ZX_OK
)
return
nullptr
;
...
...
@@ -88,11 +88,11 @@ SkFontStyleSet* FuchsiaFontManager::onMatchFamily(
SkTypeface
*
FuchsiaFontManager
::
onMatchFamilyStyle
(
const
char
family_name
[],
const
SkFontStyle
&
style
)
const
{
auto
request
=
fonts
::
FontRequest
::
New
()
;
request
->
family
=
family_name
;
request
->
weight
=
style
.
weight
();
request
->
width
=
style
.
width
();
request
->
slant
=
ToFontSlant
(
style
.
slant
());
fonts
::
FontRequest
request
;
request
.
family
=
family_name
;
request
.
weight
=
style
.
weight
();
request
.
width
=
style
.
width
();
request
.
slant
=
ToFontSlant
(
style
.
slant
());
fonts
::
FontResponsePtr
response
;
font_provider_
->
GetFont
(
...
...
@@ -107,7 +107,7 @@ SkTypeface* FuchsiaFontManager::onMatchFamilyStyle(
if
(
!
response
)
return
nullptr
;
sk_sp
<
SkData
>
data
=
MakeSkDataFromVMO
(
response
->
data
->
vmo
);
sk_sp
<
SkData
>
data
=
MakeSkDataFromVMO
(
std
::
move
(
response
->
data
.
vmo
)
);
if
(
!
data
)
return
nullptr
;
...
...
content_handler/fuchsia_font_manager.h
浏览文件 @
ac552fba
...
...
@@ -18,7 +18,7 @@
#define TXT_FUCHSIA_FONT_MANAGER_H_
#include <memory>
#include
"lib/fonts/fidl/font_provider.fidl.h"
#include
<fuchsia/cpp/fonts.h>
#include "lib/fxl/macros.h"
#include "third_party/skia/include/core/SkStream.h"
#include "third_party/skia/include/core/SkTypeface.h"
...
...
content_handler/rasterizer.h
浏览文件 @
ac552fba
...
...
@@ -22,7 +22,7 @@ class Rasterizer {
static
std
::
unique_ptr
<
Rasterizer
>
Create
();
virtual
void
SetScene
(
f
1
dl
::
InterfaceHandle
<
ui
::
Scenic
>
mozart
,
f
i
dl
::
InterfaceHandle
<
ui
::
Scenic
>
mozart
,
zx
::
eventpair
import_token
,
fxl
::
Closure
metrics_changed_callback
)
=
0
;
...
...
content_handler/runtime_holder.cc
浏览文件 @
ac552fba
...
...
@@ -60,21 +60,21 @@ void SetThreadName(fxl::RefPtr<fxl::TaskRunner> runner, std::string name) {
}
blink
::
PointerData
::
Change
GetChangeFromPointerEventPhase
(
mozart
::
PointerEvent
::
Phase
phase
)
{
input
::
PointerEvent
Phase
phase
)
{
switch
(
phase
)
{
case
mozart
::
PointerEvent
::
Phase
::
ADD
:
case
input
::
PointerEvent
Phase
::
ADD
:
return
blink
::
PointerData
::
Change
::
kAdd
;
case
mozart
::
PointerEvent
::
Phase
::
HOVER
:
case
input
::
PointerEvent
Phase
::
HOVER
:
return
blink
::
PointerData
::
Change
::
kHover
;
case
mozart
::
PointerEvent
::
Phase
::
DOWN
:
case
input
::
PointerEvent
Phase
::
DOWN
:
return
blink
::
PointerData
::
Change
::
kDown
;
case
mozart
::
PointerEvent
::
Phase
::
MOVE
:
case
input
::
PointerEvent
Phase
::
MOVE
:
return
blink
::
PointerData
::
Change
::
kMove
;
case
mozart
::
PointerEvent
::
Phase
::
UP
:
case
input
::
PointerEvent
Phase
::
UP
:
return
blink
::
PointerData
::
Change
::
kUp
;
case
mozart
::
PointerEvent
::
Phase
::
REMOVE
:
case
input
::
PointerEvent
Phase
::
REMOVE
:
return
blink
::
PointerData
::
Change
::
kRemove
;
case
mozart
::
PointerEvent
::
Phase
::
CANCEL
:
case
input
::
PointerEvent
Phase
::
CANCEL
:
return
blink
::
PointerData
::
Change
::
kCancel
;
default:
return
blink
::
PointerData
::
Change
::
kCancel
;
...
...
@@ -82,11 +82,11 @@ blink::PointerData::Change GetChangeFromPointerEventPhase(
}
blink
::
PointerData
::
DeviceKind
GetKindFromPointerType
(
mozart
::
PointerEvent
::
Type
type
)
{
input
::
PointerEvent
Type
type
)
{
switch
(
type
)
{
case
mozart
::
PointerEvent
::
Type
::
TOUCH
:
case
input
::
PointerEvent
Type
::
TOUCH
:
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
case
mozart
::
PointerEvent
::
Type
::
MOUSE
:
case
input
::
PointerEvent
Type
::
MOUSE
:
return
blink
::
PointerData
::
DeviceKind
::
kMouse
;
default:
return
blink
::
PointerData
::
DeviceKind
::
kTouch
;
...
...
@@ -111,7 +111,7 @@ RuntimeHolder::~RuntimeHolder() {
void
RuntimeHolder
::
Init
(
fdio_ns_t
*
namespc
,
std
::
unique_ptr
<
component
::
ApplicationContext
>
context
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services
,
std
::
vector
<
char
>
bundle
)
{
FXL_DCHECK
(
!
rasterizer_
);
rasterizer_
=
Rasterizer
::
Create
();
...
...
@@ -193,8 +193,8 @@ void RuntimeHolder::Init(
void
RuntimeHolder
::
CreateView
(
const
std
::
string
&
script_uri
,
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner_request
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
{
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner_request
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
{
if
(
view_listener_binding_
.
is_bound
())
{
// TODO(jeffbrown): Refactor this to support multiple view instances
// sharing the same underlying root bundle (but with different runtimes).
...
...
@@ -220,7 +220,7 @@ void RuntimeHolder::CreateView(
FXL_LOG
(
ERROR
)
<<
"Could not create an event pair."
;
return
;
}
mozart
::
ViewListenerPtr
view_listener
;
views_v1
::
ViewListenerPtr
view_listener
;
view_listener_binding_
.
Bind
(
view_listener
.
NewRequest
());
view_manager_
->
CreateView
(
view_
.
NewRequest
(),
// view
std
::
move
(
view_owner_request
),
// view owner
...
...
@@ -233,12 +233,12 @@ void RuntimeHolder::CreateView(
// Listen for input events.
ConnectToService
(
view_services
.
get
(),
input_connection_
.
NewRequest
());
mozar
t
::
InputListenerPtr
input_listener
;
inpu
t
::
InputListenerPtr
input_listener
;
input_listener_binding_
.
Bind
(
input_listener
.
NewRequest
());
input_connection_
->
SetEventListener
(
std
::
move
(
input_listener
));
// Setup the session.
f
1
dl
::
InterfaceHandle
<
ui
::
Scenic
>
scenic
;
f
i
dl
::
InterfaceHandle
<
ui
::
Scenic
>
scenic
;
view_manager_
->
GetScenic
(
scenic
.
NewRequest
());
blink
::
Threads
::
Gpu
()
->
PostTask
(
fxl
::
MakeCopyable
([
...
...
@@ -444,7 +444,7 @@ void RuntimeHolder::InitDartIoInternal() {
}
void
RuntimeHolder
::
InitFuchsia
()
{
f
1
dl
::
InterfaceHandle
<
component
::
ApplicationEnvironment
>
environment
;
f
i
dl
::
InterfaceHandle
<
component
::
ApplicationEnvironment
>
environment
;
context_
->
ConnectToEnvironmentService
(
environment
.
NewRequest
());
fuchsia
::
dart
::
Initialize
(
std
::
move
(
environment
),
std
::
move
(
outgoing_services_
));
...
...
@@ -467,7 +467,7 @@ void RuntimeHolder::InitZircon() {
}
void
RuntimeHolder
::
InitScenicInternal
()
{
f
1dl
::
InterfaceHandle
<
mozart
::
ViewContainer
>
view_container
;
f
idl
::
InterfaceHandle
<
views_v1
::
ViewContainer
>
view_container
;
view_
->
GetContainer
(
view_container
.
NewRequest
());
Dart_Handle
mozart_internal
=
...
...
@@ -509,7 +509,7 @@ void RuntimeHolder::InitRootBundle(std::vector<char> bundle) {
}
}
mozart
::
View
*
RuntimeHolder
::
GetMozartView
()
{
views_v1
::
View
*
RuntimeHolder
::
GetMozartView
()
{
return
view_
.
get
();
}
...
...
@@ -558,13 +558,13 @@ bool RuntimeHolder::HandleFlutterPlatformMessage(
clipboard_
->
Push
(
text
);
response
->
CompleteEmpty
();
}
else
if
(
method
->
value
==
"Clipboard.getData"
)
{
clipboard_
->
Peek
([
response
](
const
::
f1dl
::
String
&
text
)
{
clipboard_
->
Peek
([
response
](
fidl
::
StringPtr
text
)
{
rapidjson
::
StringBuffer
json_buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
json_buffer
);
writer
.
StartArray
();
writer
.
StartObject
();
writer
.
Key
(
"text"
);
writer
.
String
(
text
);
writer
.
String
(
text
.
get
()
);
writer
.
EndObject
();
writer
.
EndArray
();
...
...
@@ -613,12 +613,10 @@ bool RuntimeHolder::HandleTextInputPlatformMessage(
return
false
;
// TODO(abarth): Read the keyboard type form the configuration.
current_text_input_client_
=
args
->
value
[
0
].
GetInt
();
mozart
::
TextInputStatePtr
state
=
mozart
::
TextInputState
::
New
();
state
->
text
=
std
::
string
();
state
->
selection
=
mozart
::
TextSelection
::
New
();
state
->
composing
=
mozart
::
TextRange
::
New
();
input
::
TextInputState
state
;
state
.
text
=
std
::
string
();
input_connection_
->
GetInputMethodEditor
(
mozart
::
KeyboardType
::
TEXT
,
mozar
t
::
InputMethodAction
::
DONE
,
input
::
KeyboardType
::
TEXT
,
inpu
t
::
InputMethodAction
::
DONE
,
std
::
move
(
state
),
text_input_binding_
.
NewBinding
(),
input_method_editor_
.
NewRequest
());
}
else
if
(
method
->
value
==
"TextInput.setEditingState"
)
{
...
...
@@ -627,36 +625,34 @@ bool RuntimeHolder::HandleTextInputPlatformMessage(
if
(
args_it
==
root
.
MemberEnd
()
||
!
args_it
->
value
.
IsObject
())
return
false
;
const
auto
&
args
=
args_it
->
value
;
mozart
::
TextInputStatePtr
state
=
mozart
::
TextInputState
::
New
();
state
->
selection
=
mozart
::
TextSelection
::
New
();
state
->
composing
=
mozart
::
TextRange
::
New
();
input
::
TextInputState
state
;
// TODO(abarth): Deserialize state.
auto
text
=
args
.
FindMember
(
"text"
);
if
(
text
!=
args
.
MemberEnd
()
&&
text
->
value
.
IsString
())
state
->
text
=
text
->
value
.
GetString
();
state
.
text
=
text
->
value
.
GetString
();
auto
selection_base
=
args
.
FindMember
(
"selectionBase"
);
if
(
selection_base
!=
args
.
MemberEnd
()
&&
selection_base
->
value
.
IsInt
())
state
->
selection
->
base
=
selection_base
->
value
.
GetInt
();
state
.
selection
.
base
=
selection_base
->
value
.
GetInt
();
auto
selection_extent
=
args
.
FindMember
(
"selectionExtent"
);
if
(
selection_extent
!=
args
.
MemberEnd
()
&&
selection_extent
->
value
.
IsInt
())
state
->
selection
->
extent
=
selection_extent
->
value
.
GetInt
();
state
.
selection
.
extent
=
selection_extent
->
value
.
GetInt
();
auto
selection_affinity
=
args
.
FindMember
(
"selectionAffinity"
);
if
(
selection_affinity
!=
args
.
MemberEnd
()
&&
selection_affinity
->
value
.
IsString
()
&&
selection_affinity
->
value
==
"TextAffinity.upstream"
)
state
->
selection
->
affinity
=
mozar
t
::
TextAffinity
::
UPSTREAM
;
state
.
selection
.
affinity
=
inpu
t
::
TextAffinity
::
UPSTREAM
;
else
state
->
selection
->
affinity
=
mozar
t
::
TextAffinity
::
DOWNSTREAM
;
state
.
selection
.
affinity
=
inpu
t
::
TextAffinity
::
DOWNSTREAM
;
// We ignore selectionIsDirectional because that concept doesn't exist on
// Fuchsia.
auto
composing_base
=
args
.
FindMember
(
"composingBase"
);
if
(
composing_base
!=
args
.
MemberEnd
()
&&
composing_base
->
value
.
IsInt
())
state
->
composing
->
start
=
composing_base
->
value
.
GetInt
();
state
.
composing
.
start
=
composing_base
->
value
.
GetInt
();
auto
composing_extent
=
args
.
FindMember
(
"composingExtent"
);
if
(
composing_extent
!=
args
.
MemberEnd
()
&&
composing_extent
->
value
.
IsInt
())
state
->
composing
->
end
=
composing_extent
->
value
.
GetInt
();
state
.
composing
.
end
=
composing_extent
->
value
.
GetInt
();
input_method_editor_
->
SetState
(
std
::
move
(
state
));
}
}
else
if
(
method
->
value
==
"TextInput.clearClient"
)
{
...
...
@@ -680,20 +676,20 @@ blink::UnzipperProvider RuntimeHolder::GetUnzipperProviderForRootBundle() {
};
}
void
RuntimeHolder
::
OnEvent
(
mozart
::
InputEventPtr
event
,
const
OnEventCallback
&
callback
)
{
void
RuntimeHolder
::
OnEvent
(
input
::
InputEvent
event
,
OnEventCallback
callback
)
{
bool
handled
=
false
;
if
(
event
->
is_pointer
())
{
const
mozart
::
PointerEventPtr
&
pointer
=
event
->
get_
pointer
();
if
(
event
.
is_pointer
())
{
const
input
::
PointerEvent
&
pointer
=
event
.
pointer
();
blink
::
PointerData
pointer_data
;
pointer_data
.
time_stamp
=
pointer
->
event_time
/
1000
;
pointer_data
.
change
=
GetChangeFromPointerEventPhase
(
pointer
->
phase
);
pointer_data
.
kind
=
GetKindFromPointerType
(
pointer
->
type
);
pointer_data
.
device
=
pointer
->
pointer_id
;
pointer_data
.
physical_x
=
pointer
->
x
*
viewport_metrics_
.
device_pixel_ratio
;
pointer_data
.
physical_y
=
pointer
->
y
*
viewport_metrics_
.
device_pixel_ratio
;
pointer_data
.
time_stamp
=
pointer
.
event_time
/
1000
;
pointer_data
.
change
=
GetChangeFromPointerEventPhase
(
pointer
.
phase
);
pointer_data
.
kind
=
GetKindFromPointerType
(
pointer
.
type
);
pointer_data
.
device
=
pointer
.
pointer_id
;
pointer_data
.
physical_x
=
pointer
.
x
*
viewport_metrics_
.
device_pixel_ratio
;
pointer_data
.
physical_y
=
pointer
.
y
*
viewport_metrics_
.
device_pixel_ratio
;
// Buttons are single bit values starting with kMousePrimaryButton = 1.
pointer_data
.
buttons
=
static_cast
<
uint64_t
>
(
pointer
->
buttons
);
pointer_data
.
buttons
=
static_cast
<
uint64_t
>
(
pointer
.
buttons
);
switch
(
pointer_data
.
change
)
{
case
blink
::
PointerData
::
Change
::
kDown
:
...
...
@@ -729,14 +725,14 @@ void RuntimeHolder::OnEvent(mozart::InputEventPtr event,
runtime_
->
DispatchPointerDataPacket
(
packet
);
handled
=
true
;
}
else
if
(
event
->
is_keyboard
())
{
const
mozart
::
KeyboardEventPtr
&
keyboard
=
event
->
get_
keyboard
();
}
else
if
(
event
.
is_keyboard
())
{
const
input
::
KeyboardEvent
&
keyboard
=
event
.
keyboard
();
const
char
*
type
=
nullptr
;
if
(
keyboard
->
phase
==
mozart
::
KeyboardEvent
::
Phase
::
PRESSED
)
if
(
keyboard
.
phase
==
input
::
KeyboardEvent
Phase
::
PRESSED
)
type
=
"keydown"
;
else
if
(
keyboard
->
phase
==
mozart
::
KeyboardEvent
::
Phase
::
REPEAT
)
else
if
(
keyboard
.
phase
==
input
::
KeyboardEvent
Phase
::
REPEAT
)
type
=
"keydown"
;
// TODO change this to keyrepeat
else
if
(
keyboard
->
phase
==
mozart
::
KeyboardEvent
::
Phase
::
RELEASED
)
else
if
(
keyboard
.
phase
==
input
::
KeyboardEvent
Phase
::
RELEASED
)
type
=
"keyup"
;
if
(
type
)
{
...
...
@@ -746,9 +742,9 @@ void RuntimeHolder::OnEvent(mozart::InputEventPtr event,
document
.
AddMember
(
"type"
,
rapidjson
::
Value
(
type
,
strlen
(
type
)),
allocator
);
document
.
AddMember
(
"keymap"
,
rapidjson
::
Value
(
"fuchsia"
),
allocator
);
document
.
AddMember
(
"hidUsage"
,
keyboard
->
hid_usage
,
allocator
);
document
.
AddMember
(
"codePoint"
,
keyboard
->
code_point
,
allocator
);
document
.
AddMember
(
"modifiers"
,
keyboard
->
modifiers
,
allocator
);
document
.
AddMember
(
"hidUsage"
,
keyboard
.
hid_usage
,
allocator
);
document
.
AddMember
(
"codePoint"
,
keyboard
.
code_point
,
allocator
);
document
.
AddMember
(
"modifiers"
,
keyboard
.
modifiers
,
allocator
);
rapidjson
::
StringBuffer
buffer
;
rapidjson
::
Writer
<
rapidjson
::
StringBuffer
>
writer
(
buffer
);
document
.
Accept
(
writer
);
...
...
@@ -766,26 +762,24 @@ void RuntimeHolder::OnEvent(mozart::InputEventPtr event,
}
void
RuntimeHolder
::
OnPropertiesChanged
(
mozart
::
ViewPropertiesPtr
properties
,
const
OnPropertiesChangedCallback
&
callback
)
{
FXL_DCHECK
(
properties
);
views_v1
::
ViewProperties
properties
,
OnPropertiesChangedCallback
callback
)
{
// Attempt to read the device pixel ratio.
float
pixel_ratio
=
1.
f
;
if
(
auto
&
metrics
=
properties
->
display_metrics
)
{
if
(
auto
&
metrics
=
properties
.
display_metrics
)
{
pixel_ratio
=
metrics
->
device_pixel_ratio
;
}
// Apply view property changes.
if
(
auto
&
layout
=
properties
->
view_layout
)
{
viewport_metrics_
.
physical_width
=
layout
->
size
->
width
*
pixel_ratio
;
viewport_metrics_
.
physical_height
=
layout
->
size
->
height
*
pixel_ratio
;
viewport_metrics_
.
physical_padding_top
=
layout
->
inset
->
top
*
pixel_ratio
;
if
(
auto
&
layout
=
properties
.
view_layout
)
{
viewport_metrics_
.
physical_width
=
layout
->
size
.
width
*
pixel_ratio
;
viewport_metrics_
.
physical_height
=
layout
->
size
.
height
*
pixel_ratio
;
viewport_metrics_
.
physical_padding_top
=
layout
->
inset
.
top
*
pixel_ratio
;
viewport_metrics_
.
physical_padding_right
=
layout
->
inset
->
right
*
pixel_ratio
;
layout
->
inset
.
right
*
pixel_ratio
;
viewport_metrics_
.
physical_padding_bottom
=
layout
->
inset
->
bottom
*
pixel_ratio
;
viewport_metrics_
.
physical_padding_left
=
layout
->
inset
->
left
*
pixel_ratio
;
layout
->
inset
.
bottom
*
pixel_ratio
;
viewport_metrics_
.
physical_padding_left
=
layout
->
inset
.
left
*
pixel_ratio
;
viewport_metrics_
.
device_pixel_ratio
=
pixel_ratio
;
runtime_
->
SetViewportMetrics
(
viewport_metrics_
);
}
...
...
@@ -795,31 +789,31 @@ void RuntimeHolder::OnPropertiesChanged(
callback
();
}
void
RuntimeHolder
::
DidUpdateState
(
mozart
::
TextInputStatePtr
state
,
mozar
t
::
InputEventPtr
event
)
{
void
RuntimeHolder
::
DidUpdateState
(
input
::
TextInputState
state
,
inpu
t
::
InputEventPtr
event
)
{
rapidjson
::
Document
document
;
auto
&
allocator
=
document
.
GetAllocator
();
rapidjson
::
Value
encoded_state
(
rapidjson
::
kObjectType
);
encoded_state
.
AddMember
(
"text"
,
state
->
text
.
get
(),
allocator
);
encoded_state
.
AddMember
(
"selectionBase"
,
state
->
selection
->
base
,
allocator
);
encoded_state
.
AddMember
(
"selectionExtent"
,
state
->
selection
->
extent
,
encoded_state
.
AddMember
(
"text"
,
state
.
text
.
get
(),
allocator
);
encoded_state
.
AddMember
(
"selectionBase"
,
state
.
selection
.
base
,
allocator
);
encoded_state
.
AddMember
(
"selectionExtent"
,
state
.
selection
.
extent
,
allocator
);
switch
(
state
->
selection
->
affinity
)
{
case
mozar
t
::
TextAffinity
::
UPSTREAM
:
switch
(
state
.
selection
.
affinity
)
{
case
inpu
t
::
TextAffinity
::
UPSTREAM
:
encoded_state
.
AddMember
(
"selectionAffinity"
,
rapidjson
::
Value
(
"TextAffinity.upstream"
),
allocator
);
break
;
case
mozar
t
::
TextAffinity
::
DOWNSTREAM
:
case
inpu
t
::
TextAffinity
::
DOWNSTREAM
:
encoded_state
.
AddMember
(
"selectionAffinity"
,
rapidjson
::
Value
(
"TextAffinity.downstream"
),
allocator
);
break
;
}
encoded_state
.
AddMember
(
"selectionIsDirectional"
,
true
,
allocator
);
encoded_state
.
AddMember
(
"composingBase"
,
state
->
composing
->
start
,
allocator
);
encoded_state
.
AddMember
(
"composingExtent"
,
state
->
composing
->
end
,
allocator
);
encoded_state
.
AddMember
(
"composingBase"
,
state
.
composing
.
start
,
allocator
);
encoded_state
.
AddMember
(
"composingExtent"
,
state
.
composing
.
end
,
allocator
);
rapidjson
::
Value
args
(
rapidjson
::
kArrayType
);
args
.
PushBack
(
current_text_input_client_
,
allocator
);
...
...
@@ -841,7 +835,7 @@ void RuntimeHolder::DidUpdateState(mozart::TextInputStatePtr state,
nullptr
));
}
void
RuntimeHolder
::
OnAction
(
mozar
t
::
InputMethodAction
action
)
{
void
RuntimeHolder
::
OnAction
(
inpu
t
::
InputMethodAction
action
)
{
rapidjson
::
Document
document
;
auto
&
allocator
=
document
.
GetAllocator
();
...
...
content_handler/runtime_holder.h
浏览文件 @
ac552fba
...
...
@@ -21,17 +21,17 @@
#include "flutter/runtime/runtime_controller.h"
#include "flutter/runtime/runtime_delegate.h"
#include "lib/app/cpp/application_context.h"
#include
"lib/app/fidl/application_environment.fidl.h"
#include
"lib/app/fidl/service_provider.fidl.h"
#include
"lib/clipboard/fidl/clipboard.fidl.h"
#include "lib/fidl/cpp/binding
s/binding
.h"
#include
<fuchsia/cpp/component.h>
#include
<fuchsia/cpp/component.h>
#include
<fuchsia/cpp/modular.h>
#include "lib/fidl/cpp/binding.h"
#include "lib/fxl/functional/closure.h"
#include "lib/fxl/macros.h"
#include "lib/fxl/memory/weak_ptr.h"
#include "lib/ui/flutter/sdk_ext/src/natives.h"
#include
"lib/ui/input/fidl/input_connection.fidl.h"
#include
"lib/ui/input/fidl/text_input.fidl.h"
#include
"lib/ui/views/fidl/view_manager.fidl.h"
#include
<fuchsia/cpp/ui.h>
#include
<fuchsia/cpp/ui.h>
#include
<fuchsia/cpp/ui.h>
namespace
flutter_runner
{
...
...
@@ -39,20 +39,20 @@ class Rasterizer;
class
RuntimeHolder
:
public
blink
::
RuntimeDelegate
,
public
mozart
::
NativesDelegate
,
public
mozart
::
ViewListener
,
public
mozar
t
::
InputListener
,
public
mozar
t
::
InputMethodEditorClient
{
public
views_v1
::
ViewListener
,
public
inpu
t
::
InputListener
,
public
inpu
t
::
InputMethodEditorClient
{
public:
RuntimeHolder
();
~
RuntimeHolder
();
void
Init
(
fdio_ns_t
*
namespc
,
std
::
unique_ptr
<
component
::
ApplicationContext
>
context
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services
,
std
::
vector
<
char
>
bundle
);
void
CreateView
(
const
std
::
string
&
script_uri
,
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner_request
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
);
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner_request
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
);
Dart_Port
GetUIIsolateMainPort
();
std
::
string
GetUIIsolateName
();
...
...
@@ -73,21 +73,21 @@ class RuntimeHolder : public blink::RuntimeDelegate,
void
DidShutdownMainIsolate
()
override
;
// |mozart::NativesDelegate| implementation:
mozart
::
View
*
GetMozartView
()
override
;
views_v1
::
View
*
GetMozartView
()
override
;
// |
mozar
t::InputListener| implementation:
void
OnEvent
(
mozart
::
InputEventPtr
event
,
const
OnEventCallback
&
callback
)
override
;
// |
inpu
t::InputListener| implementation:
void
OnEvent
(
input
::
InputEvent
event
,
OnEventCallback
callback
)
override
;
// |
mozart
::ViewListener| implementation:
// |
views_v1
::ViewListener| implementation:
void
OnPropertiesChanged
(
mozart
::
ViewPropertiesPtr
properties
,
const
OnPropertiesChangedCallback
&
callback
)
override
;
views_v1
::
ViewProperties
properties
,
OnPropertiesChangedCallback
callback
)
override
;
// |
mozar
t::InputMethodEditorClient| implementation:
void
DidUpdateState
(
mozart
::
TextInputStatePtr
state
,
mozar
t
::
InputEventPtr
event
)
override
;
void
OnAction
(
mozar
t
::
InputMethodAction
action
)
override
;
// |
inpu
t::InputMethodEditorClient| implementation:
void
DidUpdateState
(
input
::
TextInputState
state
,
inpu
t
::
InputEventPtr
event
)
override
;
void
OnAction
(
inpu
t
::
InputMethodAction
action
)
override
;
fxl
::
WeakPtr
<
RuntimeHolder
>
GetWeakPtr
();
...
...
@@ -112,7 +112,7 @@ class RuntimeHolder : public blink::RuntimeDelegate,
fdio_ns_t
*
namespc_
;
int
dirfd_
;
std
::
unique_ptr
<
component
::
ApplicationContext
>
context_
;
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_
;
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_
;
std
::
vector
<
char
>
root_bundle_data_
;
// TODO(zarah): Remove asset_store_ when flx is completely removed
fxl
::
RefPtr
<
blink
::
ZipAssetStore
>
asset_store_
;
...
...
@@ -121,14 +121,14 @@ class RuntimeHolder : public blink::RuntimeDelegate,
std
::
unique_ptr
<
Rasterizer
>
rasterizer_
;
std
::
unique_ptr
<
blink
::
RuntimeController
>
runtime_
;
blink
::
ViewportMetrics
viewport_metrics_
;
mozart
::
ViewManagerPtr
view_manager_
;
f
1dl
::
Binding
<
mozart
::
ViewListener
>
view_listener_binding_
;
f
1dl
::
Binding
<
mozar
t
::
InputListener
>
input_listener_binding_
;
mozar
t
::
InputConnectionPtr
input_connection_
;
mozart
::
ViewPtr
view_
;
views_v1
::
ViewManagerPtr
view_manager_
;
f
idl
::
Binding
<
views_v1
::
ViewListener
>
view_listener_binding_
;
f
idl
::
Binding
<
inpu
t
::
InputListener
>
input_listener_binding_
;
inpu
t
::
InputConnectionPtr
input_connection_
;
views_v1
::
ViewPtr
view_
;
std
::
unordered_set
<
int
>
down_pointers_
;
mozar
t
::
InputMethodEditorPtr
input_method_editor_
;
f
1dl
::
Binding
<
mozar
t
::
InputMethodEditorClient
>
text_input_binding_
;
inpu
t
::
InputMethodEditorPtr
input_method_editor_
;
f
idl
::
Binding
<
inpu
t
::
InputMethodEditorClient
>
text_input_binding_
;
int
current_text_input_client_
=
0
;
fxl
::
TimePoint
last_begin_frame_time_
;
bool
frame_outstanding_
=
false
;
...
...
content_handler/session_connection.cc
浏览文件 @
ac552fba
...
...
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "flutter/content_handler/session_connection.h"
#include "lib/fidl/cpp/optional.h"
#include "lib/ui/scenic/fidl_helpers.h"
namespace
flutter_runner
{
...
...
@@ -21,8 +22,8 @@ SessionConnection::SessionConnection(ui::ScenicPtr scenic,
this
,
std
::
placeholders
::
_1
));
root_node_
.
Bind
(
std
::
move
(
import_token
));
root_node_
.
SetEventMask
(
ui
::
gfx
::
kMetricsEventMask
);
session_
.
Present
(
0
,
[](
ui
::
PresentationInfoPtr
info
)
{});
root_node_
.
SetEventMask
(
gfx
::
kMetricsEventMask
);
session_
.
Present
(
0
,
[](
images
::
PresentationInfo
info
)
{});
present_callback_
=
std
::
bind
(
&
SessionConnection
::
OnPresent
,
this
,
std
::
placeholders
::
_1
);
...
...
@@ -38,18 +39,18 @@ void SessionConnection::OnSessionError() {
FXL_CHECK
(
false
)
<<
"Session connection was terminated."
;
}
void
SessionConnection
::
OnSessionEvents
(
f
1dl
::
Array
<
ui
::
EventPtr
>
events
)
{
ui
::
gfx
::
MetricsPtr
new_metrics
;
for
(
const
auto
&
event
:
*
events
)
{
if
(
event
->
is_gfx
()
&&
event
->
get_gfx
()
->
is_metrics
()
&&
event
->
get_gfx
()
->
get_metrics
()
->
node_id
==
root_node_
.
id
())
{
new_metrics
=
std
::
move
(
event
->
get_gfx
()
->
get_metrics
()
->
metrics
)
;
void
SessionConnection
::
OnSessionEvents
(
f
idl
::
VectorPtr
<
ui
::
Event
>
events
)
{
gfx
::
Metrics
*
new_metrics
;
for
(
auto
&
event
:
*
events
)
{
if
(
event
.
is_gfx
()
&&
event
.
gfx
().
is_metrics
()
&&
event
.
gfx
().
metrics
().
node_id
==
root_node_
.
id
())
{
new_metrics
=
&
event
.
gfx
().
metrics
().
metrics
;
}
}
if
(
!
new_metrics
)
return
;
scene_update_context_
.
set_metrics
(
std
::
move
(
new_metrics
));
scene_update_context_
.
set_metrics
(
fidl
::
MakeOptional
(
std
::
move
(
*
new_metrics
)
));
if
(
metrics_changed_callback_
)
metrics_changed_callback_
();
...
...
@@ -80,7 +81,7 @@ void SessionConnection::Present(flow::CompositorContext::ScopedFrame& frame,
EnqueueClearCommands
();
}
void
SessionConnection
::
OnPresent
(
ui
::
PresentationInfoPtr
info
)
{
void
SessionConnection
::
OnPresent
(
images
::
PresentationInfo
info
)
{
ASSERT_IS_GPU_THREAD
;
auto
callback
=
pending_on_present_callback_
;
pending_on_present_callback_
=
nullptr
;
...
...
content_handler/session_connection.h
浏览文件 @
ac552fba
...
...
@@ -11,7 +11,7 @@
#include "flutter/content_handler/vulkan_surface_producer.h"
#include "flutter/flow/compositor_context.h"
#include "flutter/flow/scene_update_context.h"
#include "lib/fidl/cpp/
bindings/
interface_handle.h"
#include "lib/fidl/cpp/interface_handle.h"
#include "lib/fxl/functional/closure.h"
#include "lib/fxl/macros.h"
#include "lib/ui/scenic/client/resources.h"
...
...
@@ -27,7 +27,7 @@ class SessionConnection {
bool
has_metrics
()
const
{
return
scene_update_context_
.
has_metrics
();
}
const
ui
::
gfx
::
MetricsPtr
&
metrics
()
const
{
const
gfx
::
MetricsPtr
&
metrics
()
const
{
return
scene_update_context_
.
metrics
();
}
...
...
@@ -57,11 +57,11 @@ class SessionConnection {
fxl
::
Closure
metrics_changed_callback_
;
void
OnSessionError
();
void
OnSessionEvents
(
f
1dl
::
Array
<
ui
::
EventPtr
>
events
);
void
OnSessionEvents
(
f
idl
::
VectorPtr
<
ui
::
Event
>
events
);
void
EnqueueClearCommands
();
void
OnPresent
(
ui
::
PresentationInfoPtr
info
);
void
OnPresent
(
images
::
PresentationInfo
info
);
FXL_DISALLOW_COPY_AND_ASSIGN
(
SessionConnection
);
};
...
...
content_handler/vulkan_rasterizer.cc
浏览文件 @
ac552fba
...
...
@@ -53,7 +53,7 @@ bool VulkanRasterizer::IsValid() const {
return
valid_
;
}
void
VulkanRasterizer
::
SetScene
(
f
1
dl
::
InterfaceHandle
<
ui
::
Scenic
>
scenic
,
void
VulkanRasterizer
::
SetScene
(
f
i
dl
::
InterfaceHandle
<
ui
::
Scenic
>
scenic
,
zx
::
eventpair
import_token
,
fxl
::
Closure
metrics_changed_callback
)
{
ASSERT_IS_GPU_THREAD
;
...
...
content_handler/vulkan_rasterizer.h
浏览文件 @
ac552fba
...
...
@@ -22,7 +22,7 @@ class VulkanRasterizer : public Rasterizer {
bool
IsValid
()
const
;
void
SetScene
(
f
1
dl
::
InterfaceHandle
<
ui
::
Scenic
>
scenic
,
void
SetScene
(
f
i
dl
::
InterfaceHandle
<
ui
::
Scenic
>
scenic
,
zx
::
eventpair
import_token
,
fxl
::
Closure
metrics_changed_callback
)
override
;
...
...
content_handler/vulkan_surface.cc
浏览文件 @
ac552fba
...
...
@@ -308,15 +308,15 @@ bool VulkanSurface::PushSessionImageSetupOps(scenic_lib::Session* session,
}
scenic_lib
::
Memory
memory
(
session
,
std
::
move
(
exported_vmo
),
ui
::
gfx
::
MemoryType
::
VK_DEVICE_MEMORY
);
auto
image_info
=
ui
::
gfx
::
ImageInfo
::
New
()
;
image_info
->
width
=
sk_surface_
->
width
();
image_info
->
height
=
sk_surface_
->
height
();
image_info
->
stride
=
4
*
sk_surface_
->
width
();
image_info
->
pixel_format
=
ui
::
gfx
::
ImageInfo
::
PixelFormat
::
BGRA_8
;
image_info
->
color_space
=
ui
::
gfx
::
ImageInfo
::
ColorSpace
::
SRGB
;
image_info
->
tiling
=
ui
::
gfx
::
ImageInfo
::
Tiling
::
LINEAR
;
images
::
MemoryType
::
VK_DEVICE_MEMORY
);
images
::
ImageInfo
image_info
;
image_info
.
width
=
sk_surface_
->
width
();
image_info
.
height
=
sk_surface_
->
height
();
image_info
.
stride
=
4
*
sk_surface_
->
width
();
image_info
.
pixel_format
=
images
::
PixelFormat
::
BGRA_8
;
image_info
.
color_space
=
images
::
ColorSpace
::
SRGB
;
image_info
.
tiling
=
images
::
Tiling
::
LINEAR
;
session_image_
=
std
::
make_unique
<
scenic_lib
::
Image
>
(
memory
,
0
/* memory offset */
,
std
::
move
(
image_info
));
...
...
flow/BUILD.gn
浏览文件 @
ac552fba
...
...
@@ -83,7 +83,7 @@ source_set("flow") {
"scene_update_context.h",
]
deps += [
public_
deps += [
"//garnet/public/lib/ui/scenic:client",
"//garnet/public/lib/ui/scenic/fidl",
"//topaz/public/dart-pkg/zircon",
...
...
flow/export_node.cc
浏览文件 @
ac552fba
...
...
@@ -61,8 +61,8 @@ void ExportNode::Bind(SceneUpdateContext& context,
container
.
AddChild
(
*
node_
);
node_
->
SetTranslation
(
offset
.
x
(),
offset
.
y
(),
0.
f
);
node_
->
SetHitTestBehavior
(
hit_testable
?
ui
::
gfx
::
HitTestBehavior
::
kDefault
:
ui
::
gfx
::
HitTestBehavior
::
kSuppress
);
?
gfx
::
HitTestBehavior
::
kDefault
:
gfx
::
HitTestBehavior
::
kSuppress
);
}
}
...
...
flow/layers/layer.h
浏览文件 @
ac552fba
...
...
@@ -45,7 +45,7 @@ class Layer {
struct
PrerollContext
{
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
=
nullptr
;
gfx
::
Metrics
*
metrics
=
nullptr
;
#endif
RasterCache
*
raster_cache
;
GrContext
*
gr_context
;
...
...
flow/layers/layer_tree.cc
浏览文件 @
ac552fba
...
...
@@ -19,7 +19,7 @@ LayerTree::~LayerTree() = default;
void
LayerTree
::
Raster
(
CompositorContext
::
ScopedFrame
&
frame
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
ignore_raster_cache
)
{
#if defined(OS_FUCHSIA)
...
...
@@ -35,7 +35,7 @@ void LayerTree::Raster(CompositorContext::ScopedFrame& frame,
void
LayerTree
::
Preroll
(
CompositorContext
::
ScopedFrame
&
frame
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
ignore_raster_cache
)
{
#if defined(OS_FUCHSIA)
...
...
flow/layers/layer_tree.h
浏览文件 @
ac552fba
...
...
@@ -14,7 +14,7 @@
#include "lib/fxl/macros.h"
#include "lib/fxl/time/time_delta.h"
#if defined(OS_FUCHSIA)
#include
"lib/ui/scenic/fidl/events.fidl.h"
#include
<fuchsia/cpp/ui.h>
#endif
#include "third_party/skia/include/core/SkSize.h"
...
...
@@ -29,13 +29,13 @@ class LayerTree {
// Raster includes both Preroll and Paint.
void
Raster
(
CompositorContext
::
ScopedFrame
&
frame
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
ignore_raster_cache
=
false
);
void
Preroll
(
CompositorContext
::
ScopedFrame
&
frame
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
ignore_raster_cache
=
false
);
...
...
flow/raster_cache.cc
浏览文件 @
ac552fba
...
...
@@ -74,7 +74,7 @@ RasterCacheResult RasterizePicture(SkPicture* picture,
const
MatrixDecomposition
&
matrix
,
SkColorSpace
*
dst_color_space
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
checkerboard
)
{
TRACE_EVENT0
(
"flutter"
,
"RasterCachePopulate"
);
...
...
@@ -154,7 +154,7 @@ RasterCacheResult RasterCache::GetPrerolledImage(
const
SkMatrix
&
transformation_matrix
,
SkColorSpace
*
dst_color_space
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
is_complex
,
bool
will_change
)
{
...
...
flow/raster_cache.h
浏览文件 @
ac552fba
...
...
@@ -13,7 +13,7 @@
#include "lib/fxl/macros.h"
#include "lib/fxl/memory/weak_ptr.h"
#if defined(OS_FUCHSIA)
#include
"lib/ui/scenic/fidl/events.fidl.h"
#include
<fuchsia/cpp/ui.h>
#endif
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkSize.h"
...
...
@@ -58,7 +58,7 @@ class RasterCache {
const
SkMatrix
&
transformation_matrix
,
SkColorSpace
*
dst_color_space
,
#if defined(OS_FUCHSIA)
ui
::
gfx
::
Metrics
*
metrics
,
gfx
::
Metrics
*
metrics
,
#endif
bool
is_complex
,
bool
will_change
);
...
...
flow/scene_update_context.h
浏览文件 @
ac552fba
...
...
@@ -6,6 +6,7 @@
#define FLUTTER_FLOW_SCENE_UPDATE_CONTEXT_H_
#include <memory>
#include <set>
#include <vector>
#include "flutter/flow/compositor_context.h"
...
...
@@ -118,10 +119,10 @@ class SceneUpdateContext {
scenic_lib
::
Session
*
session
()
{
return
session_
;
}
bool
has_metrics
()
const
{
return
!!
metrics_
;
}
void
set_metrics
(
ui
::
gfx
::
MetricsPtr
metrics
)
{
void
set_metrics
(
gfx
::
MetricsPtr
metrics
)
{
metrics_
=
std
::
move
(
metrics
);
}
const
ui
::
gfx
::
MetricsPtr
&
metrics
()
const
{
return
metrics_
;
}
const
gfx
::
MetricsPtr
&
metrics
()
const
{
return
metrics_
;
}
void
AddChildScene
(
ExportNode
*
export_node
,
SkPoint
offset
,
...
...
@@ -181,7 +182,7 @@ class SceneUpdateContext {
scenic_lib
::
Session
*
const
session_
;
SurfaceProducer
*
const
surface_producer_
;
ui
::
gfx
::
MetricsPtr
metrics_
;
gfx
::
MetricsPtr
metrics_
;
std
::
vector
<
PaintTask
>
paint_tasks_
;
...
...
sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.cpp
浏览文件 @
ac552fba
...
...
@@ -13,7 +13,7 @@
#include "flutter/sky/engine/platform/fonts/AlternateFontFamily.h"
#include "flutter/sky/engine/platform/fonts/FontCache.h"
#include "flutter/sky/engine/platform/fonts/FontDescription.h"
#include
"lib/fonts/fidl/font_provider.fidl.h"
#include
<fuchsia/cpp/fonts.h>
#include "lib/fsl/vmo/sized_vmo.h"
#include "lib/fxl/logging.h"
#include "third_party/skia/include/core/SkData.h"
...
...
@@ -65,14 +65,14 @@ void UnmapMemory(const void* buffer, void* context) {
zx
::
vmar
::
root_self
().
unmap
(
reinterpret_cast
<
uintptr_t
>
(
buffer
),
size
);
}
sk_sp
<
SkData
>
MakeSkDataFromVMO
(
const
fsl
::
SizedVmoTransport
Ptr
&
vmo
)
{
if
(
!
fsl
::
SizedVmo
::
IsSizeValid
(
vmo
->
vmo
,
vmo
->
size
)
||
vmo
->
size
>
std
::
numeric_limits
<
size_t
>::
max
())
{
sk_sp
<
SkData
>
MakeSkDataFromVMO
(
const
fsl
::
SizedVmoTransport
&
vmo
)
{
if
(
!
fsl
::
SizedVmo
::
IsSizeValid
(
vmo
.
vmo
,
vmo
.
size
)
||
vmo
.
size
>
std
::
numeric_limits
<
size_t
>::
max
())
{
return
nullptr
;
}
uint64_t
size
=
vmo
->
size
;
uint64_t
size
=
vmo
.
size
;
uintptr_t
buffer
=
0
;
zx_status_t
status
=
zx
::
vmar
::
root_self
().
map
(
0
,
vmo
->
vmo
,
0
,
size
,
zx_status_t
status
=
zx
::
vmar
::
root_self
().
map
(
0
,
vmo
.
vmo
,
0
,
size
,
ZX_VM_FLAG_PERM_READ
,
&
buffer
);
if
(
status
!=
ZX_OK
)
return
nullptr
;
...
...
@@ -111,11 +111,11 @@ sk_sp<SkTypeface> FontCache::createTypeface(
name
=
family
.
utf8
();
}
auto
request
=
fonts
::
FontRequest
::
New
()
;
request
->
family
=
name
.
data
();
request
->
weight
=
ToIntegerWeight
(
fontDescription
.
weight
());
request
->
width
=
static_cast
<
uint32_t
>
(
fontDescription
.
stretch
());
request
->
slant
=
ToFontSlant
(
fontDescription
.
style
());
fonts
::
FontRequest
request
;
request
.
family
=
name
.
data
();
request
.
weight
=
ToIntegerWeight
(
fontDescription
.
weight
());
request
.
width
=
static_cast
<
uint32_t
>
(
fontDescription
.
stretch
());
request
.
slant
=
ToFontSlant
(
fontDescription
.
style
());
fonts
::
FontResponsePtr
response
;
auto
&
font_provider
=
GetFontProvider
();
...
...
@@ -132,7 +132,7 @@ sk_sp<SkTypeface> FontCache::createTypeface(
if
(
!
response
)
return
nullptr
;
sk_sp
<
SkData
>
data
=
MakeSkDataFromVMO
(
response
->
data
->
vmo
);
sk_sp
<
SkData
>
data
=
MakeSkDataFromVMO
(
response
->
data
.
vmo
);
if
(
!
data
)
return
nullptr
;
...
...
sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h
浏览文件 @
ac552fba
...
...
@@ -5,7 +5,7 @@
#ifndef SKY_ENGINE_PLATFORM_FONTS_FUCHSIA_FONT_CACHE_FUCHSIA_H_
#define SKY_ENGINE_PLATFORM_FONTS_FUCHSIA_FONT_CACHE_FUCHSIA_H_
#include
"lib/fonts/fidl/font_provider.fidl.h"
#include
<fuchsia/cpp/fonts.h>
namespace
blink
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录