Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
119b1a99
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
119b1a99
编写于
10月 12, 2016
作者:
A
Adam Barth
提交者:
GitHub
10月 12, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Finish routing platform messages on iOS (#3119)
上级
2ff316e7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
61 addition
and
10 deletion
+61
-10
shell/platform/darwin/ios/framework/Source/application_messages_impl.h
...m/darwin/ios/framework/Source/application_messages_impl.h
+5
-2
shell/platform/darwin/ios/framework/Source/application_messages_impl.mm
.../darwin/ios/framework/Source/application_messages_impl.mm
+37
-0
shell/platform/darwin/ios/platform_view_ios.h
shell/platform/darwin/ios/platform_view_ios.h
+5
-2
shell/platform/darwin/ios/platform_view_ios.mm
shell/platform/darwin/ios/platform_view_ios.mm
+14
-6
未找到文件。
shell/platform/darwin/ios/framework/Source/application_messages_impl.h
浏览文件 @
119b1a99
...
...
@@ -7,11 +7,12 @@
#include <unordered_map>
#include "lib/ftl/memory/weak_ptr.h"
#include "mojo/public/cpp/bindings/binding_set.h"
#include "flutter/lib/ui/window/platform_message.h"
#include "flutter/services/platform/app_messages.mojom.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterAsyncMessageListener.h"
#include "flutter/shell/platform/darwin/ios/framework/Headers/FlutterMessageListener.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "mojo/public/cpp/bindings/binding_set.h"
namespace
shell
{
...
...
@@ -24,6 +25,8 @@ class ApplicationMessagesImpl : public flutter::platform::ApplicationMessages {
void
AddBinding
(
mojo
::
InterfaceRequest
<
flutter
::
platform
::
ApplicationMessages
>
request
);
void
HandlePlatformMessage
(
ftl
::
RefPtr
<
blink
::
PlatformMessage
>
message
);
void
SetMessageListener
(
const
std
::
string
&
message_name
,
NSObject
<
FlutterMessageListener
>*
listener
);
...
...
shell/platform/darwin/ios/framework/Source/application_messages_impl.mm
浏览文件 @
119b1a99
...
...
@@ -4,9 +4,21 @@
#include "flutter/shell/platform/darwin/ios/framework/Source/application_messages_impl.h"
#include <vector>
#include "base/strings/sys_string_conversions.h"
namespace
shell
{
namespace
{
std
::
vector
<
char
>
SysNSStringToVector
(
NSString
*
string
)
{
if
(
!
string
.
length
)
return
std
::
vector
<
char
>
();
const
char
*
utf8
=
string
.
UTF8String
;
return
std
::
vector
<
char
>
(
utf8
,
utf8
+
strlen
(
utf8
));
}
}
// namespace
ApplicationMessagesImpl
::
ApplicationMessagesImpl
()
:
weak_factory_
(
this
)
{}
...
...
@@ -21,6 +33,31 @@ void ApplicationMessagesImpl::AddBinding(
binding_
.
AddBinding
(
this
,
request
.
Pass
());
}
void
ApplicationMessagesImpl
::
HandlePlatformMessage
(
ftl
::
RefPtr
<
blink
::
PlatformMessage
>
message
)
{
NSString
*
string
=
[
NSString
stringWithUTF8String
:
message
->
data
().
data
()];
{
auto
it
=
listeners_
.
find
(
message
->
name
());
if
(
it
!=
listeners_
.
end
())
{
NSString
*
response
=
[
it
->
second
didReceiveString
:
string
];
message
->
InvokeCallback
(
SysNSStringToVector
(
response
));
return
;
}
}
{
auto
it
=
async_listeners_
.
find
(
message
->
name
());
if
(
it
!=
async_listeners_
.
end
())
{
[
it
->
second
didReceiveString:
string
callback:
^
(
NSString
*
response
)
{
message
->
InvokeCallback
(
SysNSStringToVector
(
response
));
}];
}
}
}
void
ApplicationMessagesImpl
::
SetMessageListener
(
const
std
::
string
&
message_name
,
NSObject
<
FlutterMessageListener
>*
listener
)
{
...
...
shell/platform/darwin/ios/platform_view_ios.h
浏览文件 @
119b1a99
...
...
@@ -49,12 +49,15 @@ class PlatformViewIOS : public PlatformView, public GPUSurfaceGLDelegate {
intptr_t
GLContextFBO
()
const
override
;
void
HandlePlatformMessage
(
ftl
::
RefPtr
<
blink
::
PlatformMessage
>
message
)
override
;
void
UpdateSemantics
(
std
::
vector
<
blink
::
SemanticsNode
>
update
)
override
;
void
RunFromSource
(
const
std
::
string
&
main
,
const
std
::
string
&
packages
,
const
std
::
string
&
assets_directory
)
override
;
void
UpdateSemantics
(
std
::
vector
<
blink
::
SemanticsNode
>
update
)
override
;
private:
std
::
unique_ptr
<
IOSGLContext
>
context_
;
sky
::
SkyEnginePtr
engine_
;
...
...
shell/platform/darwin/ios/platform_view_ios.mm
浏览文件 @
119b1a99
...
...
@@ -8,6 +8,9 @@
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import <QuartzCore/CAEAGLLayer.h>
#include <utility>
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/trace_event/trace_event.h"
#include "flutter/shell/gpu/gpu_rasterizer.h"
...
...
@@ -369,6 +372,17 @@ bool PlatformViewIOS::GLContextPresent() {
return
context_
!=
nullptr
?
context_
->
PresentRenderBuffer
()
:
false
;
}
void
PlatformViewIOS
::
UpdateSemantics
(
std
::
vector
<
blink
::
SemanticsNode
>
update
)
{
if
(
accessibility_bridge_
)
accessibility_bridge_
->
UpdateSemantics
(
std
::
move
(
update
));
}
void
PlatformViewIOS
::
HandlePlatformMessage
(
ftl
::
RefPtr
<
blink
::
PlatformMessage
>
message
)
{
app_message_receiver_
.
HandlePlatformMessage
(
std
::
move
(
message
));
}
void
PlatformViewIOS
::
RunFromSource
(
const
std
::
string
&
main
,
const
std
::
string
&
packages
,
const
std
::
string
&
assets_directory
)
{
...
...
@@ -383,10 +397,4 @@ void PlatformViewIOS::RunFromSource(const std::string& main,
delete
latch
;
}
void
PlatformViewIOS
::
UpdateSemantics
(
std
::
vector
<
blink
::
SemanticsNode
>
update
)
{
if
(
accessibility_bridge_
)
accessibility_bridge_
->
UpdateSemantics
(
std
::
move
(
update
));
}
}
// namespace shell
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录