Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
d14eba08
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,发现更多精彩内容 >>
提交
d14eba08
编写于
7月 29, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #361 from abarth/iterate_vsync
Improve vsync provider
上级
e1f5e8aa
752ff897
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
74 addition
and
17 deletion
+74
-17
sky/services/vsync/BUILD.gn
sky/services/vsync/BUILD.gn
+1
-1
sky/services/vsync/src/org/domokit/vsync/VSyncProviderImpl.java
...rvices/vsync/src/org/domokit/vsync/VSyncProviderImpl.java
+47
-0
sky/services/vsync/vsync.mojom
sky/services/vsync/vsync.mojom
+4
-2
sky/shell/android/org/domokit/sky/shell/SkyApplication.java
sky/shell/android/org/domokit/sky/shell/SkyApplication.java
+4
-4
sky/shell/ui/animator.cc
sky/shell/ui/animator.cc
+13
-6
sky/shell/ui/animator.h
sky/shell/ui/animator.h
+3
-2
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+2
-2
未找到文件。
sky/services/vsync/BUILD.gn
浏览文件 @
d14eba08
...
...
@@ -27,7 +27,7 @@ if (is_android) {
import("//build/config/android/rules.gni")
android_library("vsync_lib") {
java_files = [ "src/org/domokit/vsync/V
s
yncProviderImpl.java" ]
java_files = [ "src/org/domokit/vsync/V
S
yncProviderImpl.java" ]
deps = [
"//base:base_java",
...
...
sky/services/vsync/src/org/domokit/vsync/V
s
yncProviderImpl.java
→
sky/services/vsync/src/org/domokit/vsync/V
S
yncProviderImpl.java
浏览文件 @
d14eba08
...
...
@@ -6,16 +6,21 @@ package org.domokit.vsync;
import
android.view.Choreographer
;
import
org.chromium.mojo.system.MessagePipeHandle
;
import
org.chromium.mojo.system.MojoException
;
import
org.chromium.mojom.vsync.V
s
yncProvider
;
import
org.chromium.mojom.vsync.V
S
yncProvider
;
/**
* Android implementation of V
s
yncProvider.
* Android implementation of V
S
yncProvider.
*/
public
class
VsyncProviderImpl
implements
VsyncProvider
{
private
static
final
String
TAG
=
"VsyncProviderImpl"
;
public
VsyncProviderImpl
()
{
public
class
VSyncProviderImpl
implements
VSyncProvider
,
Choreographer
.
FrameCallback
{
private
Choreographer
mChoreographer
;
private
AwaitVSyncResponse
mCallback
;
private
MessagePipeHandle
mPipe
;
public
VSyncProviderImpl
(
MessagePipeHandle
pipe
)
{
mPipe
=
pipe
;
mChoreographer
=
Choreographer
.
getInstance
();
}
@Override
...
...
@@ -25,12 +30,18 @@ public class VsyncProviderImpl implements VsyncProvider {
public
void
onConnectionError
(
MojoException
e
)
{}
@Override
public
void
awaitVsync
(
final
AwaitVsyncResponse
callback
)
{
Choreographer
.
getInstance
().
postFrameCallback
(
new
Choreographer
.
FrameCallback
()
{
@Override
public
void
doFrame
(
long
frameTimeNanos
)
{
callback
.
call
(
frameTimeNanos
);
}
});
public
void
awaitVSync
(
final
AwaitVSyncResponse
callback
)
{
if
(
mCallback
!=
null
)
{
mPipe
.
close
();
return
;
}
mCallback
=
callback
;
mChoreographer
.
postFrameCallback
(
this
);
}
@Override
public
void
doFrame
(
long
frameTimeNanos
)
{
mCallback
.
call
(
frameTimeNanos
/
1000
);
mCallback
=
null
;
}
}
sky/services/vsync/vsync.mojom
浏览文件 @
d14eba08
...
...
@@ -4,6 +4,8 @@
module vsync;
interface VsyncProvider {
AwaitVsync() => (int64 time_stamp);
interface VSyncProvider {
// Timebase is in MojoGetTimeTicksNow.
// Only one callback can be parked at a given time.
AwaitVSync() => (int64 time_stamp);
};
sky/shell/android/org/domokit/sky/shell/SkyApplication.java
浏览文件 @
d14eba08
...
...
@@ -21,11 +21,11 @@ import org.chromium.mojom.keyboard.KeyboardService;
import
org.chromium.mojom.media.MediaService
;
import
org.chromium.mojom.mojo.NetworkService
;
import
org.chromium.mojom.sensors.SensorService
;
import
org.chromium.mojom.vsync.V
s
yncProvider
;
import
org.chromium.mojom.vsync.V
S
yncProvider
;
import
org.domokit.activity.ActivityImpl
;
import
org.domokit.media.MediaServiceImpl
;
import
org.domokit.oknet.NetworkServiceImpl
;
import
org.domokit.vsync.V
s
yncProviderImpl
;
import
org.domokit.vsync.V
S
yncProviderImpl
;
/**
* Sky implementation of {@link android.app.Application}, managing application-level global
...
...
@@ -100,10 +100,10 @@ public class SkyApplication extends BaseChromiumApplication {
}
});
registry
.
register
(
V
s
yncProvider
.
MANAGER
.
getName
(),
new
ServiceFactory
()
{
registry
.
register
(
V
S
yncProvider
.
MANAGER
.
getName
(),
new
ServiceFactory
()
{
@Override
public
void
connectToService
(
Context
context
,
Core
core
,
MessagePipeHandle
pipe
)
{
V
syncProvider
.
MANAGER
.
bind
(
new
VsyncProviderImpl
(
),
pipe
);
V
SyncProvider
.
MANAGER
.
bind
(
new
VSyncProviderImpl
(
pipe
),
pipe
);
}
});
}
...
...
sky/shell/ui/animator.cc
浏览文件 @
d14eba08
...
...
@@ -11,7 +11,7 @@
namespace
sky
{
namespace
shell
{
const
int
kPipelineDepth
=
2
;
const
int
kPipelineDepth
=
3
;
Animator
::
Animator
(
const
Engine
::
Config
&
config
,
Engine
*
engine
)
:
config_
(
config
),
...
...
@@ -39,10 +39,7 @@ void Animator::RequestFrame() {
return
;
}
if
(
vsync_provider_
)
{
vsync_provider_
->
AwaitVsync
(
base
::
Bind
(
&
Animator
::
BeginFrame
,
weak_factory_
.
GetWeakPtr
()));
}
else
{
if
(
!
AwaitVSync
())
{
base
::
MessageLoop
::
current
()
->
PostTask
(
FROM_HERE
,
base
::
Bind
(
&
Animator
::
BeginFrame
,
weak_factory_
.
GetWeakPtr
(),
0
));
...
...
@@ -87,9 +84,19 @@ void Animator::OnFrameComplete() {
if
(
did_defer_frame_request_
)
{
did_defer_frame_request_
=
false
;
BeginFrame
(
0
);
if
(
!
AwaitVSync
())
BeginFrame
(
0
);
}
}
bool
Animator
::
AwaitVSync
()
{
if
(
!
vsync_provider_
)
return
false
;
vsync_provider_
->
AwaitVSync
(
base
::
Bind
(
&
Animator
::
BeginFrame
,
weak_factory_
.
GetWeakPtr
()));
return
true
;
}
}
// namespace shell
}
// namespace sky
sky/shell/ui/animator.h
浏览文件 @
d14eba08
...
...
@@ -22,17 +22,18 @@ class Animator {
void
Start
();
void
Stop
();
void
set_vsync_provider
(
vsync
::
V
s
yncProviderPtr
vsync_provider
)
{
void
set_vsync_provider
(
vsync
::
V
S
yncProviderPtr
vsync_provider
)
{
vsync_provider_
=
vsync_provider
.
Pass
();
}
private:
void
BeginFrame
(
int64_t
time_stamp
);
void
OnFrameComplete
();
bool
AwaitVSync
();
Engine
::
Config
config_
;
Engine
*
engine_
;
vsync
::
V
s
yncProviderPtr
vsync_provider_
;
vsync
::
V
S
yncProviderPtr
vsync_provider_
;
int
outstanding_requests_
;
bool
did_defer_frame_request_
;
bool
engine_requested_frame_
;
...
...
sky/shell/ui/engine.cc
浏览文件 @
d14eba08
...
...
@@ -67,8 +67,8 @@ Engine::Engine(const Config& config)
mojo
::
ConnectToService
(
service_provider
.
get
(),
&
network_service_
);
#if defined(OS_ANDROID)
// TODO(abarth): Implement V
s
yncProvider on other platforms.
vsync
::
V
s
yncProviderPtr
vsync_provider
;
// TODO(abarth): Implement V
S
yncProvider on other platforms.
vsync
::
V
S
yncProviderPtr
vsync_provider
;
mojo
::
ConnectToService
(
service_provider
.
get
(),
&
vsync_provider
);
animator_
->
set_vsync_provider
(
vsync_provider
.
Pass
());
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录