Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
79b9ffb1
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,发现更多精彩内容 >>
未验证
提交
79b9ffb1
编写于
4月 23, 2018
作者:
C
Chinmay Garde
提交者:
GitHub
4月 23, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixup Fuchsia content handler post shell refactor. (#5072)
上级
ec611470
变更
27
显示空白变更内容
内联
并排
Showing
27 changed file
with
343 addition
and
356 deletion
+343
-356
content_handler/accessibility_bridge.cc
content_handler/accessibility_bridge.cc
+1
-2
content_handler/accessibility_bridge.h
content_handler/accessibility_bridge.h
+4
-3
content_handler/application.cc
content_handler/application.cc
+34
-42
content_handler/application.h
content_handler/application.h
+21
-18
content_handler/application_runner.cc
content_handler/application_runner.cc
+4
-5
content_handler/application_runner.h
content_handler/application_runner.h
+8
-7
content_handler/compositor_context.h
content_handler/compositor_context.h
+2
-1
content_handler/engine.cc
content_handler/engine.cc
+23
-19
content_handler/engine.h
content_handler/engine.h
+5
-3
content_handler/fuchsia_font_manager.cc
content_handler/fuchsia_font_manager.cc
+11
-11
content_handler/isolate_configurator.cc
content_handler/isolate_configurator.cc
+4
-4
content_handler/isolate_configurator.h
content_handler/isolate_configurator.h
+9
-8
content_handler/platform_view.cc
content_handler/platform_view.cc
+88
-103
content_handler/platform_view.h
content_handler/platform_view.h
+33
-37
content_handler/session_connection.cc
content_handler/session_connection.cc
+16
-14
content_handler/session_connection.h
content_handler/session_connection.h
+3
-3
content_handler/surface.cc
content_handler/surface.cc
+6
-16
content_handler/surface.h
content_handler/surface.h
+1
-6
content_handler/vulkan_surface.cc
content_handler/vulkan_surface.cc
+14
-15
content_handler/vulkan_surface_producer.cc
content_handler/vulkan_surface_producer.cc
+4
-3
fml/native_library.h
fml/native_library.h
+4
-0
fml/platform/posix/native_library_posix.cc
fml/platform/posix/native_library_posix.cc
+8
-0
fml/platform/win/native_library_win.cc
fml/platform/win/native_library_win.cc
+8
-0
lib/snapshot/BUILD.gn
lib/snapshot/BUILD.gn
+10
-28
lib/ui/compositing/scene.cc
lib/ui/compositing/scene.cc
+1
-1
shell/common/rasterizer.cc
shell/common/rasterizer.cc
+16
-6
shell/common/rasterizer.h
shell/common/rasterizer.h
+5
-1
未找到文件。
content_handler/accessibility_bridge.cc
浏览文件 @
79b9ffb1
...
...
@@ -7,14 +7,13 @@
#include <unordered_set>
#include "lib/app/cpp/application_context.h"
#include "lib/context/fidl/context_writer.fidl.h"
#include "third_party/rapidjson/rapidjson/document.h"
#include "third_party/rapidjson/rapidjson/stringbuffer.h"
#include "third_party/rapidjson/rapidjson/writer.h"
namespace
flutter
{
AccessibilityBridge
::
AccessibilityBridge
(
m
axwell
::
ContextWriterPtr
writer
)
AccessibilityBridge
::
AccessibilityBridge
(
m
odular
::
ContextWriterPtr
writer
)
:
writer_
(
std
::
move
(
writer
))
{}
AccessibilityBridge
::~
AccessibilityBridge
()
=
default
;
...
...
content_handler/accessibility_bridge.h
浏览文件 @
79b9ffb1
...
...
@@ -6,8 +6,9 @@
#include <map>
#include <fuchsia/cpp/modular.h>
#include "flutter/lib/ui/semantics/semantics_node.h"
#include "lib/context/fidl/context_writer.fidl.h"
#include "lib/fxl/macros.h"
namespace
flutter
{
...
...
@@ -16,7 +17,7 @@ namespace flutter {
// with the Context Service.
class
AccessibilityBridge
final
{
public:
AccessibilityBridge
(
m
axwell
::
ContextWriterPtr
writer
);
AccessibilityBridge
(
m
odular
::
ContextWriterPtr
writer
);
~
AccessibilityBridge
();
...
...
@@ -25,7 +26,7 @@ class AccessibilityBridge final {
void
UpdateSemantics
(
const
blink
::
SemanticsNodeUpdates
&
update
);
private:
m
axwell
::
ContextWriterPtr
writer_
;
m
odular
::
ContextWriterPtr
writer_
;
std
::
map
<
int
,
blink
::
SemanticsNode
>
semantics_nodes_
;
// Walk the semantics node tree starting at |id|, and store the id of each
...
...
content_handler/application.cc
浏览文件 @
79b9ffb1
...
...
@@ -21,9 +21,9 @@ namespace flutter {
std
::
pair
<
std
::
unique_ptr
<
fsl
::
Thread
>
,
std
::
unique_ptr
<
Application
>>
Application
::
Create
(
Application
::
Delegate
&
delegate
,
component
::
ApplicationPackage
Ptr
package
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
{
component
::
ApplicationPackage
package
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
{
auto
thread
=
std
::
make_unique
<
fsl
::
Thread
>
();
std
::
unique_ptr
<
Application
>
application
;
...
...
@@ -52,53 +52,49 @@ static std::string DebugLabelForURL(const std::string url) {
Application
::
Application
(
Application
::
Delegate
&
delegate
,
component
::
ApplicationPackage
Ptr
package
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
component
::
ApplicationPackage
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
application_controller_request
)
:
delegate_
(
delegate
),
debug_label_
(
DebugLabelForURL
(
startup_info
->
launch_info
->
url
)),
debug_label_
(
DebugLabelForURL
(
startup_info
.
launch_info
.
url
)),
application_controller_
(
this
)
{
application_controller_
.
set_error_handler
([
this
]()
{
Kill
();
});
FXL_DCHECK
(
fdio_ns_
.
is_valid
());
// ApplicationLaunchInfo::url non-optional.
auto
&
launch_info
=
startup_info
->
launch_info
;
auto
&
launch_info
=
startup_info
.
launch_info
;
// ApplicationLaunchInfo::arguments optional.
if
(
auto
&
arguments
=
launch_info
->
arguments
)
{
if
(
auto
&
arguments
=
launch_info
.
arguments
)
{
settings_
=
shell
::
SettingsFromCommandLine
(
fxl
::
CommandLineFromIterators
(
arguments
->
begin
(),
arguments
->
end
()));
}
// TODO: ApplicationLaunchInfo::out
optional
.
// TODO: ApplicationLaunchInfo::out.
// TODO: ApplicationLaunchInfo::err
optional
.
// TODO: ApplicationLaunchInfo::err.
// ApplicationLaunchInfo::service_request optional.
if
(
launch_info
->
directory_request
)
{
if
(
launch_info
.
directory_request
)
{
service_provider_bridge_
.
ServeDirectory
(
std
::
move
(
launch_info
->
directory_request
));
std
::
move
(
launch_info
.
directory_request
));
}
// ApplicationLaunchInfo::flat_namespace optional.
if
(
auto
&
flat_namespace
=
startup_info
->
flat_namespace
)
{
for
(
size_t
i
=
0
;
i
<
flat_namespace
->
paths
->
size
();
++
i
)
{
const
auto
&
path
=
flat_namespace
->
paths
->
at
(
i
);
for
(
size_t
i
=
0
;
i
<
startup_info
.
flat_namespace
.
paths
->
size
();
++
i
)
{
const
auto
&
path
=
startup_info
.
flat_namespace
.
paths
->
at
(
i
);
if
(
path
==
"/svc"
)
{
continue
;
}
zx
::
channel
dir
=
std
::
move
(
flat_namespace
->
directories
->
at
(
i
));
zx
::
channel
dir
=
std
::
move
(
startup_info
.
flat_namespace
.
directories
->
at
(
i
));
zx_handle_t
dir_handle
=
dir
.
release
();
if
(
fdio_ns_bind
(
fdio_ns_
.
get
(),
path
->
data
(),
dir_handle
)
!=
ZX_OK
)
{
FXL_DLOG
(
ERROR
)
<<
"Could not bind path to namespace: "
<<
path
;
zx_handle_close
(
dir_handle
);
}
}
}
else
{
FXL_DLOG
(
ERROR
)
<<
"There was no flat namespace."
;
}
application_directory_
.
reset
(
fdio_ns_opendir
(
fdio_ns_
.
get
()));
FXL_DCHECK
(
application_directory_
.
is_valid
());
...
...
@@ -108,15 +104,11 @@ Application::Application(
// TODO: ApplicationLaunchInfo::additional_services optional.
// ApplicationPackage::data: This is legacy FLX data. Ensure that we dont have
// any.
FXL_DCHECK
(
!
package
->
data
)
<<
"Legacy FLX data must not be supplied."
;
// All launch arguments have been read. Perform service binding and
// final settings configuration. The next call will be to create a view
// for this application.
service_provider_bridge_
.
AddService
<
mozart
::
ViewProvider
>
(
service_provider_bridge_
.
AddService
<
views_v1
::
ViewProvider
>
(
std
::
bind
(
&
Application
::
CreateShellForView
,
this
,
std
::
placeholders
::
_1
));
component
::
ServiceProviderPtr
outgoing_services
;
...
...
@@ -193,8 +185,8 @@ void Application::AttemptVMLaunchWithCurrentSettings(
return
;
}
auto
lib
=
fxl
::
MakeRefCounted
<
fml
::
NativeLibrary
>
(
library_handle
,
// library handle
auto
lib
=
fml
::
NativeLibrary
::
CreateWithHandle
(
library_handle
,
// library handle
true
// close the handle when done
);
...
...
@@ -248,7 +240,7 @@ void Application::Detach() {
}
// |component::ApplicationController|
void
Application
::
Wait
(
const
WaitCallback
&
callback
)
{
void
Application
::
Wait
(
WaitCallback
callback
)
{
wait_callbacks_
.
emplace_back
(
std
::
move
(
callback
));
}
...
...
@@ -281,14 +273,14 @@ void Application::OnEngineTerminate(const Engine* shell_holder) {
}
void
Application
::
CreateShellForView
(
f
1dl
::
InterfaceRequest
<
mozart
::
ViewProvider
>
view_provider_request
)
{
f
idl
::
InterfaceRequest
<
views_v1
::
ViewProvider
>
view_provider_request
)
{
shells_bindings_
.
AddBinding
(
this
,
std
::
move
(
view_provider_request
));
}
// |
mozart
::ViewProvider|
// |
views_v1
::ViewProvider|
void
Application
::
CreateView
(
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
)
{
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
)
{
if
(
!
application_context_
)
{
FXL_DLOG
(
ERROR
)
<<
"Application context was invalid when attempting to "
"create a shell for a view provider request."
;
...
...
content_handler/application.h
浏览文件 @
79b9ffb1
...
...
@@ -8,16 +8,19 @@
#include <memory>
#include <set>
#include <fuchsia/cpp/component.h>
#include <fuchsia/cpp/views_v1.h>
#include <fuchsia/cpp/views_v1_token.h>
#include "engine.h"
#include "flutter/common/settings.h"
#include "lib/app/cpp/application_context.h"
#include "lib/
app/fidl/application_controller.fidl
.h"
#include "lib/fidl/cpp/
bindings/binding_se
t.h"
#include "lib/
fidl/cpp/binding_set
.h"
#include "lib/fidl/cpp/
interface_reques
t.h"
#include "lib/fsl/threading/thread.h"
#include "lib/fxl/files/unique_fd.h"
#include "lib/fxl/macros.h"
#include "lib/svc/cpp/service_provider_bridge.h"
#include "lib/ui/views/fidl/view_provider.fidl.h"
#include "unique_fdio_ns.h"
namespace
flutter
{
...
...
@@ -26,7 +29,7 @@ namespace flutter {
// Flutter engine instances.
class
Application
final
:
public
Engine
::
Delegate
,
public
component
::
ApplicationController
,
public
mozart
::
ViewProvider
{
public
views_v1
::
ViewProvider
{
public:
class
Delegate
{
public:
...
...
@@ -38,9 +41,9 @@ class Application final : public Engine::Delegate,
// This is a synchronous operation.
static
std
::
pair
<
std
::
unique_ptr
<
fsl
::
Thread
>
,
std
::
unique_ptr
<
Application
>>
Create
(
Application
::
Delegate
&
delegate
,
component
::
ApplicationPackage
Ptr
package
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
);
component
::
ApplicationPackage
package
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
);
// Must be called on the same thread returned from the create call. The thread
// may be collected after.
...
...
@@ -53,20 +56,20 @@ class Application final : public Engine::Delegate,
UniqueFDIONS
fdio_ns_
=
UniqueFDIONSCreate
();
fxl
::
UniqueFD
application_directory_
;
fxl
::
UniqueFD
application_assets_directory_
;
f
1
dl
::
Binding
<
component
::
ApplicationController
>
application_controller_
;
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request_
;
f
i
dl
::
Binding
<
component
::
ApplicationController
>
application_controller_
;
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request_
;
component
::
ServiceProviderBridge
service_provider_bridge_
;
std
::
unique_ptr
<
component
::
ApplicationContext
>
application_context_
;
f
1dl
::
BindingSet
<
mozart
::
ViewProvider
>
shells_bindings_
;
f
idl
::
BindingSet
<
views_v1
::
ViewProvider
>
shells_bindings_
;
std
::
set
<
std
::
unique_ptr
<
Engine
>>
shell_holders_
;
std
::
vector
<
WaitCallback
>
wait_callbacks_
;
std
::
pair
<
bool
,
uint32_t
>
last_return_code_
;
Application
(
Application
::
Delegate
&
delegate
,
component
::
ApplicationPackage
Ptr
package
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
);
component
::
ApplicationPackage
package
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
);
// |component::ApplicationController|
void
Kill
()
override
;
...
...
@@ -75,18 +78,18 @@ class Application final : public Engine::Delegate,
void
Detach
()
override
;
// |component::ApplicationController|
void
Wait
(
const
WaitCallback
&
callback
)
override
;
void
Wait
(
WaitCallback
callback
)
override
;
// |
mozart
::ViewProvider|
// |
views_v1
::ViewProvider|
void
CreateView
(
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
override
;
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner
,
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
services
)
override
;
// |flutter::Engine::Delegate|
void
OnEngineTerminate
(
const
Engine
*
holder
)
override
;
void
CreateShellForView
(
f
1dl
::
InterfaceRequest
<
mozart
::
ViewProvider
>
view_provider_request
);
f
idl
::
InterfaceRequest
<
views_v1
::
ViewProvider
>
view_provider_request
);
void
AttemptVMLaunchWithCurrentSettings
(
const
blink
::
Settings
&
settings
)
const
;
...
...
content_handler/application_runner.cc
浏览文件 @
79b9ffb1
...
...
@@ -8,7 +8,6 @@
#include "flutter/lib/ui/text/font_collection.h"
#include "fuchsia_font_manager.h"
#include "lib/fonts/fidl/font_provider.fidl.h"
#include "lib/icu_data/cpp/icu_data.h"
namespace
flutter
{
...
...
@@ -38,14 +37,14 @@ ApplicationRunner::~ApplicationRunner() {
}
void
ApplicationRunner
::
RegisterApplication
(
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationRunner
>
request
)
{
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationRunner
>
request
)
{
active_applications_bindings_
.
AddBinding
(
this
,
std
::
move
(
request
));
}
void
ApplicationRunner
::
StartApplication
(
component
::
ApplicationPackage
Ptr
package
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
{
component
::
ApplicationPackage
package
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
{
auto
thread_application_pair
=
Application
::
Create
(
*
this
,
// delegate
std
::
move
(
package
),
// application pacakge
...
...
content_handler/application_runner.h
浏览文件 @
79b9ffb1
...
...
@@ -7,10 +7,11 @@
#include <memory>
#include <unordered_map>
#include <fuchsia/cpp/component.h>
#include "application.h"
#include "lib/app/cpp/application_context.h"
#include "lib/app/fidl/application_runner.fidl.h"
#include "lib/fidl/cpp/bindings/binding_set.h"
#include "lib/fidl/cpp/binding_set.h"
#include "lib/fsl/tasks/message_loop.h"
#include "lib/fxl/functional/make_copyable.h"
#include "lib/fxl/macros.h"
...
...
@@ -49,18 +50,18 @@ class ApplicationRunner final : public Application::Delegate,
fxl
::
Closure
on_termination_callback_
;
std
::
unique_ptr
<
component
::
ApplicationContext
>
host_context_
;
f
1
dl
::
BindingSet
<
component
::
ApplicationRunner
>
active_applications_bindings_
;
f
i
dl
::
BindingSet
<
component
::
ApplicationRunner
>
active_applications_bindings_
;
std
::
unordered_map
<
const
Application
*
,
ActiveApplication
>
active_applications_
;
// |component::ApplicationRunner|
void
StartApplication
(
component
::
ApplicationPackage
Ptr
application
,
component
::
ApplicationStartupInfo
Ptr
startup_info
,
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
void
StartApplication
(
component
::
ApplicationPackage
application
,
component
::
ApplicationStartupInfo
startup_info
,
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationController
>
controller
)
override
;
void
RegisterApplication
(
f
1
dl
::
InterfaceRequest
<
component
::
ApplicationRunner
>
request
);
f
i
dl
::
InterfaceRequest
<
component
::
ApplicationRunner
>
request
);
void
UnregisterApplication
(
const
Application
*
application
);
...
...
content_handler/compositor_context.h
浏览文件 @
79b9ffb1
...
...
@@ -4,8 +4,9 @@
#pragma once
#include <fuchsia/cpp/ui.h>
#include "flutter/flow/compositor_context.h"
#include "garnet/public/lib/ui/scenic/fidl/scenic.fidl-common.h"
#include "lib/fxl/macros.h"
#include "session_connection.h"
...
...
content_handler/engine.cc
浏览文件 @
79b9ffb1
...
...
@@ -15,19 +15,15 @@
#include "lib/fxl/synchronization/waitable_event.h"
#include "platform_view.h"
#ifdef ERROR
#undef ERROR
#endif
namespace
flutter
{
Engine
::
Engine
(
Delegate
&
delegate
,
std
::
string
thread_label
,
component
::
ApplicationContext
&
application_context
,
blink
::
Settings
settings
,
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner
,
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner
,
const
UniqueFDIONS
&
fdio_ns
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request
)
:
delegate_
(
delegate
),
thread_label_
(
std
::
move
(
thread_label
)),
...
...
@@ -39,7 +35,7 @@ Engine::Engine(Delegate& delegate,
thread
.
Run
();
}
mozart
::
ViewManagerPtr
view_manager
;
views_v1
::
ViewManagerPtr
view_manager
;
application_context
.
ConnectToEnvironmentService
(
view_manager
.
NewRequest
());
zx
::
eventpair
import_token
,
export_token
;
...
...
@@ -66,10 +62,21 @@ Engine::Engine(Delegate& delegate,
// Grab the accessibilty context writer that can understand the semtics tree
// on the platform view.
m
axwell
::
ContextWriterPtr
accessibility_context_writer
;
m
odular
::
ContextWriterPtr
accessibility_context_writer
;
application_context
.
ConnectToEnvironmentService
(
accessibility_context_writer
.
NewRequest
());
// Create the compositor context from the scenic pointer to create the
// rasterizer.
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context
=
std
::
make_unique
<
flutter
::
CompositorContext
>
(
scenic
,
// scenic
thread_label_
,
// debug label
std
::
move
(
import_token
),
// import token
on_session_metrics_change_callback
,
// session metrics did change
on_session_error_callback
// session did encounter error
);
// Setup the callback that will instantiate the platform view.
shell
::
Shell
::
CreateCallback
<
shell
::
PlatformView
>
on_create_platform_view
=
fxl
::
MakeCopyable
([
debug_label
=
thread_label_
,
//
...
...
@@ -80,10 +87,8 @@ Engine::Engine(Delegate& delegate,
scenic
=
std
::
move
(
scenic
),
//
accessibility_context_writer
=
std
::
move
(
accessibility_context_writer
),
//
export_token
=
std
::
move
(
export_token
),
//
import_token
=
std
::
move
(
import_token
),
//
on_session_metrics_change_callback
,
//
on_session_error_callback
//
export_token
=
std
::
move
(
export_token
)
//
](
shell
::
Shell
&
shell
)
mutable
{
return
std
::
make_unique
<
flutter
::
PlatformView
>
(
shell
,
// delegate
...
...
@@ -94,21 +99,20 @@ Engine::Engine(Delegate& delegate,
std
::
move
(
view_owner
),
// view owner
std
::
move
(
scenic
),
// scenic
std
::
move
(
export_token
),
// export token
std
::
move
(
import_token
),
// import token
std
::
move
(
accessibility_context_writer
),
// accessibility context writer
std
::
move
(
on_session_metrics_change_callback
),
// metrics change
std
::
move
(
on_session_error_callback
)
// session_error
accessibility_context_writer
)
// accessibility context writer
);
});
// Setup the callback that will instantiate the rasterizer.
shell
::
Shell
::
CreateCallback
<
shell
::
Rasterizer
>
on_create_rasterizer
=
[](
shell
::
Shell
&
shell
)
{
fxl
::
MakeCopyable
([
compositor_context
=
std
::
move
(
compositor_context
)](
shell
::
Shell
&
shell
)
mutable
{
return
std
::
make_unique
<
shell
::
Rasterizer
>
(
shell
.
GetTaskRunners
()
// task runners
shell
.
GetTaskRunners
(),
// task runners
std
::
move
(
compositor_context
)
// compositor context
);
};
}
)
;
// Get the task runners from the managed threads. The current thread will be
// used as the "platform" thread.
...
...
content_handler/engine.h
浏览文件 @
79b9ffb1
...
...
@@ -4,13 +4,15 @@
#pragma once
#include <fuchsia/cpp/views_v1.h>
#include <fuchsia/cpp/views_v1_token.h>
#include "flutter/shell/common/shell.h"
#include "isolate_configurator.h"
#include "lib/app/cpp/application_context.h"
#include "lib/fsl/threading/thread.h"
#include "lib/fxl/macros.h"
#include "lib/fxl/memory/weak_ptr.h"
#include "lib/ui/views/fidl/view_manager.fidl.h"
namespace
flutter
{
...
...
@@ -27,9 +29,9 @@ class Engine final {
std
::
string
thread_label
,
component
::
ApplicationContext
&
application_context
,
blink
::
Settings
settings
,
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner
,
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner
,
const
UniqueFDIONS
&
fdio_ns
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request
);
~
Engine
();
...
...
content_handler/fuchsia_font_manager.cc
浏览文件 @
79b9ffb1
...
...
@@ -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
>
MakeSkDataFrom
VMO
(
const
fsl
::
SizedVmoTransportPtr
&
vmo
)
{
if
(
!
fsl
::
SizedVmo
::
IsSizeValid
(
vmo
->
vmo
,
vmo
->
size
)
||
vmo
->
size
>
std
::
numeric_limits
<
size_t
>::
max
())
{
sk_sp
<
SkData
>
MakeSkDataFrom
Buffer
(
const
mem
::
Buffer
&
data
)
{
if
(
!
fsl
::
SizedVmo
::
IsSizeValid
(
data
.
vmo
,
data
.
size
)
||
data
.
size
>
std
::
numeric_limits
<
size_t
>::
max
())
{
return
nullptr
;
}
uint64_t
size
=
vmo
->
size
;
uint64_t
size
=
data
.
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
,
data
.
vmo
,
0
,
size
,
ZX_VM_FLAG_PERM_READ
,
&
buffer
);
if
(
status
!=
ZX_OK
)
return
nullptr
;
...
...
@@ -90,11 +90,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
(
...
...
@@ -108,7 +108,7 @@ SkTypeface* FuchsiaFontManager::onMatchFamilyStyle(
return
nullptr
;
}
sk_sp
<
SkData
>
data
=
MakeSkDataFrom
VMO
(
response
->
data
->
vmo
);
sk_sp
<
SkData
>
data
=
MakeSkDataFrom
Buffer
(
response
->
data
.
buffer
);
if
(
!
data
)
return
nullptr
;
...
...
content_handler/isolate_configurator.cc
浏览文件 @
79b9ffb1
...
...
@@ -16,9 +16,9 @@ namespace flutter {
IsolateConfigurator
::
IsolateConfigurator
(
const
UniqueFDIONS
&
fdio_ns
,
mozart
::
ViewPtr
&
view
,
views_v1
::
ViewPtr
&
view
,
component
::
ApplicationEnvironmentPtr
application_environment
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request
)
:
fdio_ns_
(
fdio_ns
),
view_
(
view
),
...
...
@@ -42,7 +42,7 @@ bool IsolateConfigurator::ConfigureCurrentIsolate() {
}
// |mozart::NativesDelegate|
mozart
::
View
*
IsolateConfigurator
::
GetMozartView
()
{
views_v1
::
View
*
IsolateConfigurator
::
GetMozartView
()
{
return
view_
.
get
();
}
...
...
@@ -102,7 +102,7 @@ void IsolateConfigurator::BindScenic() {
tonic
::
ToDart
(
"_context"
),
//
tonic
::
DartConverter
<
uint64_t
>::
ToDart
(
reinterpret_cast
<
intptr_t
>
(
static_cast
<
mozart
::
NativesDelegate
*>
(
this
)))));
mozart
::
ViewContainerPtr
view_container
;
views_v1
::
ViewContainerPtr
view_container
;
view_
->
GetContainer
(
view_container
.
NewRequest
());
DART_CHECK_VALID
(
Dart_SetField
(
mozart_internal
,
//
...
...
content_handler/isolate_configurator.h
浏览文件 @
79b9ffb1
...
...
@@ -4,11 +4,12 @@
#pragma once
#include "lib/app/fidl/application_environment.fidl.h"
#include <fuchsia/cpp/component.h>
#include <fuchsia/cpp/ui.h>
#include <fuchsia/cpp/views_v1.h>
#include "lib/fxl/macros.h"
#include "lib/ui/flutter/sdk_ext/src/natives.h"
#include "lib/ui/views/fidl/view_containers.fidl.h"
#include "lib/ui/views/fidl/views.fidl.h"
#include "unique_fdio_ns.h"
namespace
flutter
{
...
...
@@ -20,9 +21,9 @@ class IsolateConfigurator final : mozart::NativesDelegate {
public:
IsolateConfigurator
(
const
UniqueFDIONS
&
fdio_ns
,
mozart
::
ViewPtr
&
view
,
views_v1
::
ViewPtr
&
view
,
component
::
ApplicationEnvironmentPtr
application_environment
,
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request
);
~
IsolateConfigurator
();
...
...
@@ -34,12 +35,12 @@ class IsolateConfigurator final : mozart::NativesDelegate {
private:
bool
used_
=
false
;
const
UniqueFDIONS
&
fdio_ns_
;
mozart
::
ViewPtr
&
view_
;
views_v1
::
ViewPtr
&
view_
;
component
::
ApplicationEnvironmentPtr
application_environment_
;
f
1
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request_
;
f
i
dl
::
InterfaceRequest
<
component
::
ServiceProvider
>
outgoing_services_request_
;
// |mozart::NativesDelegate|
mozart
::
View
*
GetMozartView
()
override
;
views_v1
::
View
*
GetMozartView
()
override
;
void
BindFuchsia
();
...
...
content_handler/platform_view.cc
浏览文件 @
79b9ffb1
...
...
@@ -25,14 +25,11 @@ PlatformView::PlatformView(
std
::
string
debug_label
,
blink
::
TaskRunners
task_runners
,
component
::
ServiceProviderPtr
parent_environment_service_provider
,
mozart
::
ViewManagerPtr
&
view_manager
,
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner
,
views_v1
::
ViewManagerPtr
&
view_manager
,
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner
,
ui
::
ScenicPtr
scenic
,
zx
::
eventpair
export_token
,
zx
::
eventpair
import_token
,
maxwell
::
ContextWriterPtr
accessibility_context_writer
,
OnMetricsUpdate
on_session_metrics_did_change
,
fxl
::
Closure
session_error_callback
)
modular
::
ContextWriterPtr
accessibility_context_writer
)
:
shell
::
PlatformView
(
delegate
,
std
::
move
(
task_runners
)),
debug_label_
(
std
::
move
(
debug_label
)),
view_listener_
(
this
),
...
...
@@ -40,12 +37,7 @@ PlatformView::PlatformView(
ime_client_
(
this
),
scenic_
(
std
::
move
(
scenic
)),
accessibility_bridge_
(
std
::
move
(
accessibility_context_writer
)),
surface_
(
std
::
make_unique
<
Surface
>
(
scenic_
,
debug_label_
,
std
::
move
(
import_token
),
std
::
move
(
on_session_metrics_did_change
),
std
::
move
(
session_error_callback
)))
{
surface_
(
std
::
make_unique
<
Surface
>
(
debug_label_
))
{
// Create the view.
view_manager
->
CreateView
(
view_
.
NewRequest
(),
// view
std
::
move
(
view_owner
),
// view owner
...
...
@@ -86,30 +78,26 @@ void PlatformView::RegisterPlatformMessageHandlers() {
std
::
placeholders
::
_1
);
}
mozart
::
ViewPtr
&
PlatformView
::
GetMozartView
()
{
views_v1
::
ViewPtr
&
PlatformView
::
GetMozartView
()
{
return
view_
;
}
// |mozart::ViewListener|
void
PlatformView
::
OnPropertiesChanged
(
mozart
::
ViewPropertiesPtr
properties
,
const
OnPropertiesChangedCallback
&
callback
)
{
UpdateViewportMetrics
(
properties
->
view_layout
);
// |views_v1::ViewListener|
void
PlatformView
::
OnPropertiesChanged
(
views_v1
::
ViewProperties
properties
,
OnPropertiesChangedCallback
callback
)
{
if
(
properties
.
view_layout
)
{
UpdateViewportMetrics
(
*
properties
.
view_layout
);
}
callback
();
}
void
PlatformView
::
UpdateViewportMetrics
(
const
mozart
::
ViewLayoutPtr
&
layout
)
{
if
(
!
layout
)
{
return
;
}
metrics_
.
size
.
width
=
layout
->
size
->
width
;
metrics_
.
size
.
height
=
layout
->
size
->
height
;
metrics_
.
padding
.
left
=
layout
->
inset
->
left
;
metrics_
.
padding
.
top
=
layout
->
inset
->
top
;
metrics_
.
padding
.
right
=
layout
->
inset
->
right
;
metrics_
.
padding
.
bottom
=
layout
->
inset
->
bottom
;
void
PlatformView
::
UpdateViewportMetrics
(
const
views_v1
::
ViewLayout
&
layout
)
{
metrics_
.
size
.
width
=
layout
.
size
.
width
;
metrics_
.
size
.
height
=
layout
.
size
.
height
;
metrics_
.
padding
.
left
=
layout
.
inset
.
left
;
metrics_
.
padding
.
top
=
layout
.
inset
.
top
;
metrics_
.
padding
.
right
=
layout
.
inset
.
right
;
metrics_
.
padding
.
bottom
=
layout
.
inset
.
bottom
;
FlushViewportMetrics
();
}
...
...
@@ -150,31 +138,30 @@ void PlatformView::FlushViewportMetrics() {
SetViewportMetrics
(
metrics
);
}
// |
mozar
t::InputMethodEditorClient|
void
PlatformView
::
DidUpdateState
(
mozart
::
TextInputStatePtr
state
,
mozart
::
InputEventPtr
event
)
{
// |
inpu
t::InputMethodEditorClient|
void
PlatformView
::
DidUpdateState
(
input
::
TextInputState
state
,
std
::
unique_ptr
<
input
::
InputEvent
>
)
{
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
,
allocator
);
switch
(
state
->
selection
->
affinity
)
{
case
mozart
::
TextAffinity
::
UPSTREAM
:
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
input
::
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
);
...
...
@@ -198,8 +185,8 @@ void PlatformView::DidUpdateState(mozart::TextInputStatePtr state,
);
}
// |
mozar
t::InputMethodEditorClient|
void
PlatformView
::
OnAction
(
mozar
t
::
InputMethodAction
action
)
{
// |
inpu
t::InputMethodEditorClient|
void
PlatformView
::
OnAction
(
inpu
t
::
InputMethodAction
action
)
{
rapidjson
::
Document
document
;
auto
&
allocator
=
document
.
GetAllocator
();
...
...
@@ -226,21 +213,20 @@ void PlatformView::OnAction(mozart::InputMethodAction action) {
);
}
// |mozart::InputListener|
void
PlatformView
::
OnEvent
(
mozart
::
InputEventPtr
event
,
const
OnEventCallback
&
callback
)
{
using
Type
=
mozart
::
InputEvent
::
Tag
;
switch
(
event
->
which
())
{
case
Type
::
POINTER
:
callback
(
OnHandlePointerEvent
(
event
->
get_pointer
()));
// |input::InputListener|
void
PlatformView
::
OnEvent
(
input
::
InputEvent
event
,
OnEventCallback
callback
)
{
using
Type
=
input
::
InputEvent
::
Tag
;
switch
(
event
.
Which
())
{
case
Type
::
kPointer
:
callback
(
OnHandlePointerEvent
(
event
.
pointer
()));
return
;
case
Type
::
KEYBOARD
:
callback
(
OnHandleKeyboardEvent
(
event
->
get_
keyboard
()));
case
Type
::
kKeyboard
:
callback
(
OnHandleKeyboardEvent
(
event
.
keyboard
()));
return
;
case
Type
::
FOCUS
:
callback
(
OnHandleFocusEvent
(
event
->
get_
focus
()));
case
Type
::
kFocus
:
callback
(
OnHandleFocusEvent
(
event
.
focus
()));
return
;
case
Type
::
__UNKNOWN__
:
default
:
break
;
}
...
...
@@ -248,21 +234,21 @@ void PlatformView::OnEvent(mozart::InputEventPtr event,
}
static
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
;
...
...
@@ -270,26 +256,27 @@ static blink::PointerData::Change GetChangeFromPointerEventPhase(
}
static
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
;
}
}
bool
PlatformView
::
OnHandlePointerEvent
(
const
mozart
::
PointerEventPtr
&
pointer
)
{
bool
PlatformView
::
OnHandlePointerEvent
(
const
input
::
PointerEvent
&
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
*
metrics_
.
scale
;
pointer_data
.
physical_y
=
pointer
->
y
*
metrics_
.
scale
;
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
*
metrics_
.
scale
;
pointer_data
.
physical_y
=
pointer
.
y
*
metrics_
.
scale
;
// Buttons are single bit values starting with kMousePrimaryButton = 1.
pointer_data
.
buttons
=
static_cast
<
uint64_t
>
(
pointer
.
buttons
);
switch
(
pointer_data
.
change
)
{
case
blink
::
PointerData
::
Change
::
kDown
:
...
...
@@ -327,14 +314,13 @@ bool PlatformView::OnHandlePointerEvent(
return
true
;
}
bool
PlatformView
::
OnHandleKeyboardEvent
(
const
mozart
::
KeyboardEventPtr
&
keyboard
)
{
bool
PlatformView
::
OnHandleKeyboardEvent
(
const
input
::
KeyboardEvent
&
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"
;
}
...
...
@@ -348,9 +334,9 @@ bool PlatformView::OnHandleKeyboardEvent(
document
.
SetObject
();
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
);
...
...
@@ -365,8 +351,8 @@ bool PlatformView::OnHandleKeyboardEvent(
return
true
;
}
bool
PlatformView
::
OnHandleFocusEvent
(
const
mozart
::
FocusEventPtr
&
focus
)
{
if
(
!
focus
->
focused
&&
current_text_input_client_
!=
0
)
{
bool
PlatformView
::
OnHandleFocusEvent
(
const
input
::
FocusEvent
&
focus
)
{
if
(
!
focus
.
focused
&&
current_text_input_client_
!=
0
)
{
current_text_input_client_
=
0
;
if
(
ime_
)
{
ime_
->
Hide
();
...
...
@@ -434,13 +420,13 @@ void PlatformView::HandleFlutterPlatformChannelPlatformMessage(
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
();
std
::
string
result
=
json_buffer
.
GetString
();
...
...
@@ -491,13 +477,14 @@ void PlatformView::HandleFlutterTextInputChannelPlatformMessage(
}
// TODO(abarth): Read the keyboard type from 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_connection_
->
GetInputMethodEditor
(
mozart
::
KeyboardType
::
TEXT
,
mozart
::
InputMethodAction
::
DONE
,
std
::
move
(
state
),
ime_client_
.
NewBinding
(),
ime_
.
NewRequest
());
input
::
KeyboardType
::
TEXT
,
// keyboard type
input
::
InputMethodAction
::
DONE
,
// input method action
input
::
TextInputState
{},
// initial state
ime_client_
.
NewBinding
(),
// client
ime_
.
NewRequest
()
// editor
);
}
else
if
(
method
->
value
==
"TextInput.setEditingState"
)
{
if
(
ime_
)
{
auto
args_it
=
root
.
FindMember
(
"args"
);
...
...
@@ -505,36 +492,34 @@ void PlatformView::HandleFlutterTextInputChannelPlatformMessage(
return
;
}
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
();
ime_
->
SetState
(
std
::
move
(
state
));
}
}
else
if
(
method
->
value
==
"TextInput.clearClient"
)
{
...
...
content_handler/platform_view.h
浏览文件 @
79b9ffb1
...
...
@@ -7,15 +7,16 @@
#include <map>
#include <set>
#include <fuchsia/cpp/input.h>
#include <fuchsia/cpp/modular.h>
#include <fuchsia/cpp/views_v1.h>
#include <fuchsia/cpp/views_v1_token.h>
#include "accessibility_bridge.h"
#include "flutter/lib/ui/window/viewport_metrics.h"
#include "flutter/shell/common/platform_view.h"
#include "lib/clipboard/fidl/clipboard.fidl.h"
#include "lib/fidl/cpp/bindings/binding.h"
#include "lib/fidl/cpp/binding.h"
#include "lib/fxl/macros.h"
#include "lib/ui/input/fidl/input_connection.fidl.h"
#include "lib/ui/views/fidl/view_manager.fidl.h"
#include "lib/ui/views/fidl/views.fidl.h"
#include "surface.h"
namespace
flutter
{
...
...
@@ -23,39 +24,36 @@ namespace flutter {
// The per engine component residing on the platform thread is responsible for
// all platform specific integrations.
class
PlatformView
final
:
public
shell
::
PlatformView
,
public
mozart
::
ViewListener
,
public
mozar
t
::
InputMethodEditorClient
,
public
mozar
t
::
InputListener
{
public
views_v1
::
ViewListener
,
public
inpu
t
::
InputMethodEditorClient
,
public
inpu
t
::
InputListener
{
public:
PlatformView
(
PlatformView
::
Delegate
&
delegate
,
std
::
string
debug_label
,
blink
::
TaskRunners
task_runners
,
component
::
ServiceProviderPtr
parent_environment_service_provider
,
mozart
::
ViewManagerPtr
&
view_manager
,
f
1dl
::
InterfaceRequest
<
mozart
::
ViewOwner
>
view_owner
,
views_v1
::
ViewManagerPtr
&
view_manager
,
f
idl
::
InterfaceRequest
<
views_v1_token
::
ViewOwner
>
view_owner
,
ui
::
ScenicPtr
scenic
,
zx
::
eventpair
export_token
,
zx
::
eventpair
import_token
,
maxwell
::
ContextWriterPtr
accessibility_context_writer
,
OnMetricsUpdate
on_session_metrics_did_change
,
fxl
::
Closure
session_error_callback
);
modular
::
ContextWriterPtr
accessibility_context_writer
);
~
PlatformView
();
void
UpdateViewportMetrics
(
double
pixel_ratio
);
mozart
::
ViewPtr
&
GetMozartView
();
views_v1
::
ViewPtr
&
GetMozartView
();
private:
const
std
::
string
debug_label_
;
mozart
::
ViewPtr
view_
;
f
1dl
::
Binding
<
mozart
::
ViewListener
>
view_listener_
;
mozar
t
::
InputConnectionPtr
input_connection_
;
f
1dl
::
Binding
<
mozar
t
::
InputListener
>
input_listener_
;
views_v1
::
ViewPtr
view_
;
f
idl
::
Binding
<
views_v1
::
ViewListener
>
view_listener_
;
inpu
t
::
InputConnectionPtr
input_connection_
;
f
idl
::
Binding
<
inpu
t
::
InputListener
>
input_listener_
;
int
current_text_input_client_
=
0
;
f
1dl
::
Binding
<
mozar
t
::
InputMethodEditorClient
>
ime_client_
;
mozar
t
::
InputMethodEditorPtr
ime_
;
f
idl
::
Binding
<
inpu
t
::
InputMethodEditorClient
>
ime_client_
;
inpu
t
::
InputMethodEditorPtr
ime_
;
modular
::
ClipboardPtr
clipboard_
;
ui
::
ScenicPtr
scenic_
;
AccessibilityBridge
accessibility_bridge_
;
...
...
@@ -70,31 +68,29 @@ class PlatformView final : public shell::PlatformView,
void
RegisterPlatformMessageHandlers
();
void
UpdateViewportMetrics
(
const
mozart
::
ViewLayoutPtr
&
layout
);
void
UpdateViewportMetrics
(
const
views_v1
::
ViewLayout
&
layout
);
void
FlushViewportMetrics
();
// |mozart::ViewListener|
void
OnPropertiesChanged
(
mozart
::
ViewPropertiesPtr
properties
,
const
OnPropertiesChangedCallback
&
callback
)
override
;
// |views_v1::ViewListener|
void
OnPropertiesChanged
(
views_v1
::
ViewProperties
properties
,
OnPropertiesChangedCallback
callback
)
override
;
// |
mozar
t::InputMethodEditorClient|
void
DidUpdateState
(
mozart
::
TextInputStatePtr
state
,
mozart
::
InputEventPtr
event
)
override
;
// |
inpu
t::InputMethodEditorClient|
void
DidUpdateState
(
input
::
TextInputState
state
,
std
::
unique_ptr
<
input
::
InputEvent
>
event
)
override
;
// |
mozar
t::InputMethodEditorClient|
void
OnAction
(
mozar
t
::
InputMethodAction
action
)
override
;
// |
inpu
t::InputMethodEditorClient|
void
OnAction
(
inpu
t
::
InputMethodAction
action
)
override
;
// |mozart::InputListener|
void
OnEvent
(
mozart
::
InputEventPtr
event
,
const
OnEventCallback
&
callback
)
override
;
// |input::InputListener|
void
OnEvent
(
input
::
InputEvent
event
,
OnEventCallback
callback
)
override
;
bool
OnHandlePointerEvent
(
const
mozart
::
PointerEventPtr
&
pointer
);
bool
OnHandlePointerEvent
(
const
input
::
PointerEvent
&
pointer
);
bool
OnHandleKeyboardEvent
(
const
mozart
::
KeyboardEventPtr
&
keyboard
);
bool
OnHandleKeyboardEvent
(
const
input
::
KeyboardEvent
&
keyboard
);
bool
OnHandleFocusEvent
(
const
mozart
::
FocusEventPtr
&
focus
);
bool
OnHandleFocusEvent
(
const
input
::
FocusEvent
&
focus
);
// |shell::PlatformView|
std
::
unique_ptr
<
shell
::
Surface
>
CreateRenderingSurface
()
override
;
...
...
content_handler/session_connection.cc
浏览文件 @
79b9ffb1
...
...
@@ -4,6 +4,7 @@
#include "session_connection.h"
#include "lib/fidl/cpp/optional.h"
#include "lib/ui/scenic/fidl_helpers.h"
namespace
flutter
{
...
...
@@ -26,28 +27,29 @@ SessionConnection::SessionConnection(
this
,
std
::
placeholders
::
_1
));
root_node_
.
Bind
(
std
::
move
(
import_token
));
root_node_
.
SetEventMask
(
ui
::
gfx
::
kMetricsEventMask
);
session_
.
Present
(
0
,
[](
ui
::
PresentationInfoPtr
inf
o
)
{});
root_node_
.
SetEventMask
(
gfx
::
kMetricsEventMask
);
session_
.
Present
(
0
,
[](
aut
o
)
{});
}
SessionConnection
::~
SessionConnection
()
=
default
;
void
SessionConnection
::
OnSessionEvents
(
f
1dl
::
Array
<
ui
::
EventPtr
>
events
)
{
using
Type
=
ui
::
gfx
::
Event
::
Tag
;
void
SessionConnection
::
OnSessionEvents
(
f
idl
::
VectorPtr
<
ui
::
Event
>
events
)
{
using
Type
=
gfx
::
Event
::
Tag
;
for
(
auto
&
raw_event
:
*
events
)
{
if
(
!
raw_event
->
is_gfx
())
{
if
(
!
raw_event
.
is_gfx
())
{
continue
;
}
auto
&
event
=
raw_event
->
get_
gfx
();
auto
&
event
=
raw_event
.
gfx
();
switch
(
event
->
which
())
{
case
Type
::
METRICS
:
{
if
(
event
->
get_metrics
()
->
node_id
==
root_node_
.
id
())
{
auto
&
metrics
=
event
->
get_metrics
()
->
metrics
;
double
device_pixel_ratio
=
metrics
->
scale_x
;
scene_update_context_
.
set_metrics
(
std
::
move
(
metrics
));
switch
(
event
.
Which
())
{
case
Type
::
kMetrics
:
{
if
(
event
.
metrics
().
node_id
==
root_node_
.
id
())
{
auto
&
metrics
=
event
.
metrics
().
metrics
;
double
device_pixel_ratio
=
metrics
.
scale_x
;
scene_update_context_
.
set_metrics
(
fidl
::
MakeOptional
(
std
::
move
(
metrics
)));
if
(
metrics_changed_callback_
)
{
metrics_changed_callback_
(
device_pixel_ratio
);
}
...
...
@@ -64,7 +66,7 @@ void SessionConnection::Present(flow::CompositorContext::ScopedFrame& frame) {
// fenced. The compositor can start processing ops while we finalize paint
// tasks.
session_
.
Present
(
0
,
// presentation_time. (placeholder).
[](
ui
::
PresentationInfoPtr
)
{}
// callback
[](
auto
)
{}
// callback
);
// Execute paint tasks and signal fences.
...
...
content_handler/session_connection.h
浏览文件 @
79b9ffb1
...
...
@@ -8,7 +8,7 @@
#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"
...
...
@@ -33,7 +33,7 @@ class SessionConnection final {
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
();
}
...
...
@@ -53,7 +53,7 @@ class SessionConnection final {
flow
::
SceneUpdateContext
scene_update_context_
;
OnMetricsUpdate
metrics_changed_callback_
;
void
OnSessionEvents
(
f
1dl
::
Array
<
ui
::
EventPtr
>
events
);
void
OnSessionEvents
(
f
idl
::
VectorPtr
<
ui
::
Event
>
events
);
void
EnqueueClearOps
();
...
...
content_handler/surface.cc
浏览文件 @
79b9ffb1
...
...
@@ -13,18 +13,8 @@
namespace
flutter
{
Surface
::
Surface
(
const
ui
::
ScenicPtr
&
scenic
,
std
::
string
debug_label
,
zx
::
eventpair
import_token
,
OnMetricsUpdate
session_metrics_did_change_callback
,
fxl
::
Closure
session_error_callback
)
:
shell
::
Surface
(
std
::
make_unique
<
CompositorContext
>
(
scenic
,
debug_label
,
std
::
move
(
import_token
),
std
::
move
(
session_metrics_did_change_callback
),
std
::
move
(
session_error_callback
))),
debug_label_
(
debug_label
)
{}
Surface
::
Surface
(
std
::
string
debug_label
)
:
debug_label_
(
std
::
move
(
debug_label
))
{}
Surface
::~
Surface
()
=
default
;
...
...
@@ -58,15 +48,15 @@ static zx_status_t DriverWatcher(int dirfd,
}
bool
Surface
::
CanConnectToDisplay
()
{
constexpr
char
k
DisplayDriverClass
[]
=
"/dev/class/display
"
;
fxl
::
UniqueFD
fd
(
open
(
k
Display
DriverClass
,
O_DIRECTORY
|
O_RDONLY
));
constexpr
char
k
GpuDriverClass
[]
=
"/dev/class/gpu
"
;
fxl
::
UniqueFD
fd
(
open
(
k
Gpu
DriverClass
,
O_DIRECTORY
|
O_RDONLY
));
if
(
fd
.
get
()
<
0
)
{
FXL_DLOG
(
ERROR
)
<<
"Failed to open "
<<
k
Display
DriverClass
;
FXL_DLOG
(
ERROR
)
<<
"Failed to open "
<<
k
Gpu
DriverClass
;
return
false
;
}
zx_status_t
status
=
fdio_watch_directory
(
fd
.
get
(),
DriverWatcher
,
zx_deadline_after
(
ZX_SEC
(
1
)),
nullptr
);
fd
.
get
(),
DriverWatcher
,
zx_deadline_after
(
ZX_SEC
(
5
)),
nullptr
);
return
status
==
ZX_ERR_STOP
;
}
...
...
content_handler/surface.h
浏览文件 @
79b9ffb1
...
...
@@ -16,18 +16,13 @@ namespace flutter {
// thread.
class
Surface
final
:
public
shell
::
Surface
{
public:
Surface
(
const
ui
::
ScenicPtr
&
scenic
,
std
::
string
debug_label
,
zx
::
eventpair
import_token
,
OnMetricsUpdate
session_metrics_did_change_callback
,
fxl
::
Closure
session_error_callback
);
Surface
(
std
::
string
debug_label
);
~
Surface
()
override
;
private:
const
bool
valid_
=
CanConnectToDisplay
();
const
std
::
string
debug_label_
;
std
::
unique_ptr
<
CompositorContext
>
compositor_context_
;
// |shell::Surface|
bool
IsValid
()
override
;
...
...
content_handler/vulkan_surface.cc
浏览文件 @
79b9ffb1
...
...
@@ -48,11 +48,8 @@ VulkanSurface::VulkanSurface(vulkan::VulkanProvider& vulkan_provider,
}
VulkanSurface
::~
VulkanSurface
()
{
if
(
async_
)
{
wait_
.
Cancel
(
async_
);
wait_
.
Cancel
();
wait_
.
set_object
(
ZX_HANDLE_INVALID
);
async_
=
nullptr
;
}
}
bool
VulkanSurface
::
IsValid
()
const
{
...
...
@@ -192,10 +189,12 @@ bool VulkanSurface::AllocateDeviceMemory(sk_sp<GrContext> context,
break
;
}
}
VkExportMemoryAllocateInfoKHR
export_allocate_info
=
{
.
sType
=
VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR
,
.
pNext
=
nullptr
,
.
handleTypes
=
VK_EXTERNAL_MEMORY_HANDLE_TYPE_FUCHSIA_VMO_BIT_KHR
};
const
VkMemoryAllocateInfo
alloc_info
=
{
.
sType
=
VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO
,
.
pNext
=
&
export_allocate_info
,
...
...
@@ -399,8 +398,8 @@ void VulkanSurface::Reset() {
}
}
async_wait_result_t
VulkanSurface
::
OnHandleReady
(
async_t
*
async
,
void
VulkanSurface
::
OnHandleReady
(
async_t
*
async
,
async
::
WaitBase
*
wait
,
zx_status_t
status
,
const
zx_packet_signal_t
*
signal
)
{
if
(
status
!=
ZX_OK
)
...
...
content_handler/vulkan_surface_producer.cc
浏览文件 @
79b9ffb1
...
...
@@ -151,13 +151,14 @@ bool VulkanSurfaceProducer::TransitionSurfacesToExternal(
if
(
!
command_buffer
->
Begin
())
return
false
;
GrBackendRenderTarget
backendRT
=
vk_surface
->
GetSkiaSurface
()
->
getBackendRenderTarget
(
GrBackendRenderTarget
backendRT
=
vk_surface
->
GetSkiaSurface
()
->
getBackendRenderTarget
(
SkSurface
::
kFlushRead_BackendHandleAccess
);
if
(
!
backendRT
.
isValid
())
{
return
false
;
}
GrVkImageInfo
imageInfo
;
if
(
!
backendRT
.
getVkImageInfo
(
&
imageInfo
))
{
if
(
!
backendRT
.
getVkImageInfo
(
&
imageInfo
))
{
return
false
;
}
...
...
fml/native_library.h
浏览文件 @
79b9ffb1
...
...
@@ -26,6 +26,10 @@ class NativeLibrary : public fxl::RefCountedThreadSafe<NativeLibrary> {
static
fxl
::
RefPtr
<
NativeLibrary
>
Create
(
const
char
*
path
);
static
fxl
::
RefPtr
<
NativeLibrary
>
CreateWithHandle
(
Handle
handle
,
bool
close_handle_when_done
);
static
fxl
::
RefPtr
<
NativeLibrary
>
CreateForCurrentProcess
();
const
uint8_t
*
ResolveSymbol
(
const
char
*
symbol
);
...
...
fml/platform/posix/native_library_posix.cc
浏览文件 @
79b9ffb1
...
...
@@ -45,6 +45,14 @@ fxl::RefPtr<NativeLibrary> NativeLibrary::Create(const char* path) {
return
library
->
GetHandle
()
!=
nullptr
?
library
:
nullptr
;
}
fxl
::
RefPtr
<
NativeLibrary
>
NativeLibrary
::
CreateWithHandle
(
Handle
handle
,
bool
close_handle_when_done
)
{
auto
library
=
fxl
::
AdoptRef
(
new
NativeLibrary
(
handle
,
close_handle_when_done
));
return
library
->
GetHandle
()
!=
nullptr
?
library
:
nullptr
;
}
fxl
::
RefPtr
<
NativeLibrary
>
NativeLibrary
::
CreateForCurrentProcess
()
{
return
fxl
::
AdoptRef
(
new
NativeLibrary
(
RTLD_DEFAULT
,
false
));
}
...
...
fml/platform/win/native_library_win.cc
浏览文件 @
79b9ffb1
...
...
@@ -37,6 +37,14 @@ fxl::RefPtr<NativeLibrary> NativeLibrary::Create(const char* path) {
return
library
->
GetHandle
()
!=
nullptr
?
library
:
nullptr
;
}
fxl
::
RefPtr
<
NativeLibrary
>
NativeLibrary
::
CreateWithHandle
(
Handle
handle
,
bool
close_handle_when_done
)
{
auto
library
=
fxl
::
AdoptRef
(
new
NativeLibrary
(
handle
,
close_handle_when_done
));
return
library
->
GetHandle
()
!=
nullptr
?
library
:
nullptr
;
}
fxl
::
RefPtr
<
NativeLibrary
>
NativeLibrary
::
CreateForCurrentProcess
()
{
return
fxl
::
AdoptRef
(
new
NativeLibrary
(
::
GetModuleHandle
(
nullptr
),
false
));
}
...
...
lib/snapshot/BUILD.gn
浏览文件 @
79b9ffb1
...
...
@@ -29,33 +29,14 @@ if (is_fuchsia) {
# The sole purpose of this target is to generate a .packages file.
sources = []
dot_packages_file = "$target_gen_dir/snapshot.packages"
outputs = [
dot_packages_file,
]
deps = []
foreach(dep, dart_deps) {
deps += [ "$dep($dart_toolchain)" ]
}
infer_package_name = true
disable_analysis = true
script = "//build/dart/gen_dot_packages.py"
args = [
"--out",
rebase_path(dot_packages_file, root_build_dir),
"--source-dir",
rebase_path("."),
"--root-build-dir",
rebase_path(root_build_dir),
"--root-gen-dir",
rebase_path(dart_root_gen_dir),
"--package-name",
"snapshot_root",
"--depfile",
rebase_path(depfile),
"--deps",
] + dart_deps
deps = [
"//topaz/public/dart/fuchsia",
"//topaz/public/dart/zircon",
]
}
}
...
...
@@ -148,10 +129,11 @@ action("generate_snapshot_bin") {
}
if (is_fuchsia) {
package_gen_dir =
get_label_info(":bogus($dart_toolchain)",
"target_gen_dir")
package_gen_dir =
get_label_info(":bogus($dart_toolchain)",
"target_gen_dir")
package_file = "$package_gen_dir/generate_package_map.packages"
inputs += zircon_sdk_ext_files + mozart_dart_sdk_ext_files + [package_file]
inputs +=
zircon_sdk_ext_files + mozart_dart_sdk_ext_files + [ package_file ]
zircon_path = rebase_path(zircon_sdk_ext_lib)
fuchsia_path = rebase_path(fuchsia_sdk_ext_lib)
mozart_internal_path = rebase_path(mozart_dart_sdk_ext_lib)
...
...
@@ -329,7 +311,7 @@ copy_entry_points_extra_json("entry_points_extra_json") {
group("entry_points_json_files") {
public_deps = [
":entry_points_json",
":entry_points_extra_json",
":entry_points_json",
]
}
lib/ui/compositing/scene.cc
浏览文件 @
79b9ffb1
...
...
@@ -4,7 +4,7 @@
#include "flutter/lib/ui/compositing/scene.h"
#include "flutter/
fml
/trace_event.h"
#include "flutter/
glue
/trace_event.h"
#include "flutter/lib/ui/painting/image.h"
#include "lib/fxl/functional/make_copyable.h"
#include "lib/tonic/converter/dart_converter.h"
...
...
shell/common/rasterizer.cc
浏览文件 @
79b9ffb1
...
...
@@ -16,7 +16,17 @@
namespace
shell
{
Rasterizer
::
Rasterizer
(
blink
::
TaskRunners
task_runners
)
:
task_runners_
(
std
::
move
(
task_runners
)),
weak_factory_
(
this
)
{}
:
Rasterizer
(
std
::
move
(
task_runners
),
std
::
make_unique
<
flow
::
CompositorContext
>
())
{}
Rasterizer
::
Rasterizer
(
blink
::
TaskRunners
task_runners
,
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context
)
:
task_runners_
(
std
::
move
(
task_runners
)),
compositor_context_
(
std
::
move
(
compositor_context
)),
weak_factory_
(
this
)
{
FXL_DCHECK
(
compositor_context_
);
}
Rasterizer
::~
Rasterizer
()
=
default
;
...
...
@@ -26,17 +36,17 @@ fml::WeakPtr<Rasterizer> Rasterizer::GetWeakPtr() const {
void
Rasterizer
::
Setup
(
std
::
unique_ptr
<
Surface
>
surface
)
{
surface_
=
std
::
move
(
surface
);
compositor_context_
.
OnGrContextCreated
();
compositor_context_
->
OnGrContextCreated
();
}
void
Rasterizer
::
Teardown
()
{
compositor_context_
.
OnGrContextDestroyed
();
compositor_context_
->
OnGrContextDestroyed
();
surface_
.
reset
();
last_layer_tree_
.
reset
();
}
flow
::
TextureRegistry
*
Rasterizer
::
GetTextureRegistry
()
{
return
&
compositor_context_
.
texture_registry
();
return
&
compositor_context_
->
texture_registry
();
}
flow
::
LayerTree
*
Rasterizer
::
GetLastLayerTree
()
{
...
...
@@ -96,12 +106,12 @@ bool Rasterizer::DrawToSurface(flow::LayerTree& layer_tree) {
// There is no way for the compositor to know how long the layer tree
// construction took. Fortunately, the layer tree does. Grab that time
// for instrumentation.
compositor_context_
.
engine_time
().
SetLapTime
(
layer_tree
.
construction_time
());
compositor_context_
->
engine_time
().
SetLapTime
(
layer_tree
.
construction_time
());
auto
canvas
=
frame
->
SkiaCanvas
();
auto
compositor_frame
=
compositor_context_
.
AcquireFrame
(
surface_
->
GetContext
(),
canvas
,
true
);
compositor_context_
->
AcquireFrame
(
surface_
->
GetContext
(),
canvas
,
true
);
if
(
canvas
)
{
canvas
->
clear
(
SK_ColorBLACK
);
...
...
shell/common/rasterizer.h
浏览文件 @
79b9ffb1
...
...
@@ -8,6 +8,7 @@
#include <memory>
#include "flutter/common/task_runners.h"
#include "flutter/flow/compositor_context.h"
#include "flutter/flow/layers/layer_tree.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/shell/common/surface.h"
...
...
@@ -21,6 +22,9 @@ class Rasterizer final {
public:
Rasterizer
(
blink
::
TaskRunners
task_runners
);
Rasterizer
(
blink
::
TaskRunners
task_runners
,
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context
);
~
Rasterizer
();
void
Setup
(
std
::
unique_ptr
<
Surface
>
surface
);
...
...
@@ -62,7 +66,7 @@ class Rasterizer final {
private:
blink
::
TaskRunners
task_runners_
;
std
::
unique_ptr
<
Surface
>
surface_
;
flow
::
CompositorContext
compositor_context_
;
std
::
unique_ptr
<
flow
::
CompositorContext
>
compositor_context_
;
std
::
unique_ptr
<
flow
::
LayerTree
>
last_layer_tree_
;
fxl
::
Closure
next_frame_callback_
;
fml
::
WeakPtrFactory
<
Rasterizer
>
weak_factory_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录