Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
b95b5292
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,发现更多精彩内容 >>
提交
b95b5292
编写于
10月 06, 2015
作者:
C
Chinmay Garde
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Setup infrastructure to capture SKP traces when the frame interval exceeds certain thresholds
上级
aa81cbad
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
80 addition
and
44 deletion
+80
-44
sky/compositor/layer_tree.cc
sky/compositor/layer_tree.cc
+1
-1
sky/compositor/layer_tree.h
sky/compositor/layer_tree.h
+13
-0
sky/compositor/paint_context.cc
sky/compositor/paint_context.cc
+1
-0
sky/engine/core/compositing/Scene.cpp
sky/engine/core/compositing/Scene.cpp
+7
-4
sky/engine/core/compositing/Scene.h
sky/engine/core/compositing/Scene.h
+6
-3
sky/engine/core/compositing/SceneBuilder.cpp
sky/engine/core/compositing/SceneBuilder.cpp
+9
-1
sky/engine/core/compositing/SceneBuilder.h
sky/engine/core/compositing/SceneBuilder.h
+4
-0
sky/engine/core/compositing/SceneBuilder.idl
sky/engine/core/compositing/SceneBuilder.idl
+1
-0
sky/shell/gpu/rasterizer.cc
sky/shell/gpu/rasterizer.cc
+16
-5
sky/shell/ios/sky_surface.mm
sky/shell/ios/sky_surface.mm
+6
-9
sky/shell/tracing_controller.cc
sky/shell/tracing_controller.cc
+6
-15
sky/shell/tracing_controller.h
sky/shell/tracing_controller.h
+10
-6
未找到文件。
sky/compositor/layer_tree.cc
浏览文件 @
b95b5292
...
...
@@ -9,7 +9,7 @@
namespace
sky
{
namespace
compositor
{
LayerTree
::
LayerTree
()
{
LayerTree
::
LayerTree
()
:
rasterizer_tracing_threashold_
(
0
)
{
}
LayerTree
::~
LayerTree
()
{
...
...
sky/compositor/layer_tree.h
浏览文件 @
b95b5292
...
...
@@ -5,6 +5,7 @@
#ifndef SKY_COMPOSITOR_LAYER_TREE_H_
#define SKY_COMPOSITOR_LAYER_TREE_H_
#include <stdint.h>
#include <memory>
#include "base/macros.h"
...
...
@@ -38,11 +39,23 @@ class LayerTree {
return
construction_time_
;
}
// The number of frame intervals missed after which the compositor must
// trace the rasterized picture to a trace file. Specify 0 to disable all
// tracing
void
set_rasterizer_tracing_threshold
(
uint32_t
interval
)
{
rasterizer_tracing_threashold_
=
interval
;
}
uint32_t
rasterizer_tracing_threshold
()
const
{
return
rasterizer_tracing_threashold_
;
}
private:
SkISize
frame_size_
;
// Physical pixels.
std
::
unique_ptr
<
Layer
>
root_layer_
;
base
::
TimeDelta
construction_time_
;
uint32_t
rasterizer_tracing_threashold_
;
DISALLOW_COPY_AND_ASSIGN
(
LayerTree
);
};
...
...
sky/compositor/paint_context.cc
浏览文件 @
b95b5292
...
...
@@ -50,6 +50,7 @@ PaintContext::ScopedFrame::ScopedFrame(PaintContext& context,
SkRect
::
MakeWH
(
frame_size
.
width
(),
frame_size
.
height
()));
canvas_
=
trace_recorder_
->
getRecordingCanvas
();
DCHECK
(
canvas_
);
DCHECK
(
trace_file_name
.
length
()
>
0
);
context_
.
beginFrame
(
*
this
);
}
...
...
sky/engine/core/compositing/Scene.cpp
浏览文件 @
b95b5292
...
...
@@ -10,14 +10,17 @@
namespace
blink
{
PassRefPtr
<
Scene
>
Scene
::
create
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
)
{
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
,
uint32_t
rasterizerTracingThreshold
)
{
ASSERT
(
rootLayer
);
return
adoptRef
(
new
Scene
(
std
::
move
(
rootLayer
)));
return
adoptRef
(
new
Scene
(
std
::
move
(
rootLayer
)
,
rasterizerTracingThreshold
));
}
Scene
::
Scene
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
)
Scene
::
Scene
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
,
uint32_t
rasterizerTracingThreshold
)
:
m_layerTree
(
new
sky
::
compositor
::
LayerTree
())
{
m_layerTree
->
set_root_layer
(
std
::
move
(
rootLayer
));
m_layerTree
->
set_rasterizer_tracing_threshold
(
rasterizerTracingThreshold
);
}
Scene
::~
Scene
()
{}
...
...
@@ -26,4 +29,4 @@ std::unique_ptr<sky::compositor::LayerTree> Scene::takeLayerTree() {
return
std
::
move
(
m_layerTree
);
}
}
// namespace blink
}
// namespace blink
sky/engine/core/compositing/Scene.h
浏览文件 @
b95b5292
...
...
@@ -5,6 +5,7 @@
#ifndef SKY_ENGINE_CORE_COMPOSITING_SCENE_H_
#define SKY_ENGINE_CORE_COMPOSITING_SCENE_H_
#include <stdint.h>
#include <memory>
#include "sky/compositor/layer.h"
...
...
@@ -22,16 +23,18 @@ class Scene : public RefCounted<Scene>, public DartWrappable {
public:
~
Scene
()
override
;
static
PassRefPtr
<
Scene
>
create
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
);
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
,
uint32_t
rasterizerTracingThreshold
);
std
::
unique_ptr
<
sky
::
compositor
::
LayerTree
>
takeLayerTree
();
private:
explicit
Scene
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
);
explicit
Scene
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
,
uint32_t
rasterizerTracingThreshold
);
std
::
unique_ptr
<
sky
::
compositor
::
LayerTree
>
m_layerTree
;
};
}
// namespace blink
}
// namespace blink
#endif // SKY_ENGINE_CORE_COMPOSITING_SCENE_H_
sky/engine/core/compositing/SceneBuilder.cpp
浏览文件 @
b95b5292
...
...
@@ -21,6 +21,7 @@ namespace blink {
SceneBuilder
::
SceneBuilder
(
const
Rect
&
bounds
)
:
m_rootPaintBounds
(
bounds
.
sk_rect
)
,
m_currentLayer
(
nullptr
)
,
m_currentRasterizerTracingThreshold
(
0
)
{
}
...
...
@@ -120,10 +121,17 @@ void SceneBuilder::addStatistics(uint64_t enabledOptions, const Rect& bounds)
m_currentLayer
->
Add
(
std
::
move
(
layer
));
}
void
SceneBuilder
::
setRasterizerTracingThreshold
(
uint32_t
frameInterval
)
{
m_currentRasterizerTracingThreshold
=
frameInterval
;
}
PassRefPtr
<
Scene
>
SceneBuilder
::
build
()
{
m_currentLayer
=
nullptr
;
return
Scene
::
create
(
std
::
move
(
m_rootLayer
));
int32_t
threshold
=
m_currentRasterizerTracingThreshold
;
m_currentRasterizerTracingThreshold
=
0
;
return
Scene
::
create
(
std
::
move
(
m_rootLayer
),
threshold
);
}
}
// namespace blink
sky/engine/core/compositing/SceneBuilder.h
浏览文件 @
b95b5292
...
...
@@ -5,6 +5,7 @@
#ifndef SKY_ENGINE_CORE_COMPOSITING_SCENEBUILDER_H_
#define SKY_ENGINE_CORE_COMPOSITING_SCENEBUILDER_H_
#include <stdint.h>
#include <memory>
#include "sky/compositor/layer.h"
...
...
@@ -45,6 +46,8 @@ public:
void
addPicture
(
const
Offset
&
offset
,
Picture
*
picture
,
const
Rect
&
bounds
);
void
addStatistics
(
uint64_t
enabledOptions
,
const
Rect
&
bounds
);
void
setRasterizerTracingThreshold
(
uint32_t
frameInterval
);
PassRefPtr
<
Scene
>
build
();
private:
...
...
@@ -55,6 +58,7 @@ private:
SkRect
m_rootPaintBounds
;
std
::
unique_ptr
<
sky
::
compositor
::
ContainerLayer
>
m_rootLayer
;
sky
::
compositor
::
ContainerLayer
*
m_currentLayer
;
int32_t
m_currentRasterizerTracingThreshold
;
};
}
// namespace blink
...
...
sky/engine/core/compositing/SceneBuilder.idl
浏览文件 @
b95b5292
...
...
@@ -15,6 +15,7 @@
void
addPicture
(
Offset
offset
,
Picture
picture
,
Rect
bounds
)
;
void
addStatistics
(
unsigned
long
enabledOptions
,
Rect
bounds
)
;
void
setRasterizerTracingThreshold
(
unsigned
long
frameInterval
)
;
Scene
build
()
;
}
;
sky/shell/gpu/rasterizer.cc
浏览文件 @
b95b5292
...
...
@@ -23,6 +23,8 @@
namespace
sky
{
namespace
shell
{
static
const
double
kOneFrameDuration
=
1e3
/
60.0
;
Rasterizer
::
Rasterizer
()
:
share_group_
(
new
gfx
::
GLShareGroup
()),
weak_factory_
(
this
)
{
}
...
...
@@ -71,13 +73,22 @@ void Rasterizer::Draw(scoped_ptr<compositor::LayerTree> layer_tree) {
surface_
->
SwapBuffers
();
}
// Optionally, if the user has specified tracing the current scene to a file,
// acquire another frame and draw into it to obtain an SkPicture to serialize
// Trace to a file if necessary
bool
frameExceededThreshold
=
false
;
if
(
layer_tree
->
rasterizer_tracing_threshold
()
*
kOneFrameDuration
>
paint_context_
.
frame_time
().
lastLap
().
InMillisecondsF
())
{
// While rendering the last frame, if we exceeded the tracing threshold
// specified in the layer tree, we force a trace to disk.
frameExceededThreshold
=
true
;
}
const
auto
&
tracingController
=
Shell
::
Shared
().
tracing_controller
();
auto
options
=
Shell
::
Shared
().
tracing_controller
().
picture_tracing_options
();
if
(
options
.
first
)
{
if
(
frameExceededThreshold
||
tracingController
.
picture_tracing_enabled
())
{
base
::
FilePath
path
=
tracingController
.
PictureTracingPathForCurrentTime
();
sky
::
compositor
::
PaintContext
::
ScopedFrame
to_file_frame
=
paint_context_
.
AcquireFrame
(
options
.
second
,
size
);
paint_context_
.
AcquireFrame
(
path
.
AsUTF8Unsafe
()
,
size
);
layer_tree
->
root_layer
()
->
Paint
(
to_file_frame
);
}
}
...
...
sky/shell/ios/sky_surface.mm
浏览文件 @
b95b5292
...
...
@@ -101,20 +101,17 @@ class TouchMapper {
static
std
::
string
SkPictureTracingPath
()
{
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
NSUserDomainMask
,
YES
);
char
*
temp
=
reinterpret_cast
<
char
*>
(
calloc
(
256
,
sizeof
(
char
)));
snprintf
(
temp
,
256
,
"%s/layers.skp"
,
[
paths
.
firstObject
UTF8String
]);
std
::
string
path
(
temp
);
free
(
temp
);
return
path
;
return
[
paths
.
firstObject
UTF8String
];
}
-
(
instancetype
)
initWithShellView
:(
sky
::
shell
::
ShellView
*
)
shellView
{
self
=
[
super
init
];
if
(
self
)
{
sky
::
shell
::
Shell
::
Shared
().
tracing_controller
().
set_picture_tracing_path
(
SkPictureTracingPath
());
base
::
FilePath
pictureTracingPath
=
base
::
FilePath
::
FromUTF8Unsafe
(
SkPictureTracingPath
());
sky
::
shell
::
Shell
::
Shared
()
.
tracing_controller
()
.
set_picture_tracing_base_path
(
pictureTracingPath
);
_shell_view
.
reset
(
shellView
);
self
.
multipleTouchEnabled
=
YES
;
...
...
sky/shell/tracing_controller.cc
浏览文件 @
b95b5292
...
...
@@ -10,6 +10,7 @@
#include "sky/shell/tracing_controller.h"
#include <string>
#include <sstream>
namespace
sky
{
namespace
shell
{
...
...
@@ -120,21 +121,11 @@ void TracingController::UnregisterShellView(ShellView* view) {
view_
=
nullptr
;
}
TracingController
::
SkPictureTracingOptions
TracingController
::
picture_tracing_options
()
const
{
return
SkPictureTracingOptions
(
picture_tracing_path_
.
length
()
==
0
?
false
:
picture_tracing_enabled_
,
picture_tracing_path_
+
std
::
to_string
((
base
::
TimeTicks
::
Now
()
-
trace_controller_start_
)
.
InMillisecondsRoundedUp
()));
}
void
TracingController
::
set_picture_tracing_path
(
const
std
::
string
&
path
)
{
picture_tracing_path_
=
path
;
}
void
TracingController
::
set_picture_tracing_enabled
(
bool
enabled
)
{
picture_tracing_enabled_
=
enabled
;
base
::
FilePath
TracingController
::
PictureTracingPathForCurrentTime
()
const
{
base
::
TimeDelta
duration
=
base
::
TimeTicks
::
Now
()
-
trace_controller_start_
;
std
::
stringstream
stream
;
stream
<<
"trace_"
<<
duration
.
InMillisecondsRoundedUp
()
<<
".skp"
;
return
picture_tracing_base_path_
.
Append
(
stream
.
str
());
}
}
// namespace shell
...
...
sky/shell/tracing_controller.h
浏览文件 @
b95b5292
...
...
@@ -36,13 +36,17 @@ class TracingController : public mojo::common::DataPipeDrainer::Client {
// be merged before viewing in the trace viewer
void
StopTracing
(
const
base
::
FilePath
&
path
);
using
SkPictureTracingOptions
=
std
::
pair
<
bool
/* enabled */
,
std
::
string
/* path */
>
;
SkPictureTracingOptions
picture_tracing_options
()
const
;
base
::
FilePath
PictureTracingPathForCurrentTime
()
const
;
void
set_picture_tracing_path
(
const
std
::
string
&
path
);
void
set_picture_tracing_base_path
(
const
base
::
FilePath
&
base_path
)
{
picture_tracing_base_path_
=
base_path
;
}
void
set_picture_tracing_enabled
(
bool
enabled
);
void
set_picture_tracing_enabled
(
bool
enabled
)
{
picture_tracing_enabled_
=
enabled
;
}
bool
picture_tracing_enabled
()
const
{
return
picture_tracing_enabled_
;
}
private:
std
::
unique_ptr
<
mojo
::
common
::
DataPipeDrainer
>
drainer_
;
...
...
@@ -51,7 +55,7 @@ class TracingController : public mojo::common::DataPipeDrainer::Client {
// the ability to host multiple shell views, references to each must be stored
// instead and trace data from each serialized to the output trace.
ShellView
*
view_
;
std
::
string
picture_tracing
_path_
;
base
::
FilePath
picture_tracing_base
_path_
;
bool
picture_tracing_enabled_
;
base
::
TimeTicks
trace_controller_start_
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录