Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
cc81c2fb
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,发现更多精彩内容 >>
提交
cc81c2fb
编写于
11月 11, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2027 from abarth/dispose
Add the ability to dispose host objects
上级
5c0bd1da
ff48ddb6
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
42 addition
and
4 deletion
+42
-4
sky/engine/core/compositing/Scene.cpp
sky/engine/core/compositing/Scene.cpp
+4
-0
sky/engine/core/compositing/Scene.h
sky/engine/core/compositing/Scene.h
+2
-0
sky/engine/core/compositing/Scene.idl
sky/engine/core/compositing/Scene.idl
+1
-0
sky/engine/core/compositing/SceneBuilder.cpp
sky/engine/core/compositing/SceneBuilder.cpp
+3
-1
sky/engine/core/painting/CanvasImage.cpp
sky/engine/core/painting/CanvasImage.cpp
+4
-0
sky/engine/core/painting/CanvasImage.h
sky/engine/core/painting/CanvasImage.h
+1
-0
sky/engine/core/painting/Image.idl
sky/engine/core/painting/Image.idl
+2
-0
sky/engine/core/painting/Picture.cpp
sky/engine/core/painting/Picture.cpp
+5
-0
sky/engine/core/painting/Picture.h
sky/engine/core/painting/Picture.h
+1
-0
sky/engine/core/painting/Picture.idl
sky/engine/core/painting/Picture.idl
+2
-0
sky/engine/core/painting/PictureRecorder.cpp
sky/engine/core/painting/PictureRecorder.cpp
+4
-0
sky/engine/core/painting/PictureRecorder.idl
sky/engine/core/painting/PictureRecorder.idl
+0
-1
sky/engine/tonic/dart_wrappable.cc
sky/engine/tonic/dart_wrappable.cc
+10
-0
sky/engine/tonic/dart_wrappable.h
sky/engine/tonic/dart_wrappable.h
+1
-0
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+2
-2
未找到文件。
sky/engine/core/compositing/Scene.cpp
浏览文件 @
cc81c2fb
...
...
@@ -25,6 +25,10 @@ Scene::Scene(std::unique_ptr<sky::compositor::Layer> rootLayer,
Scene
::~
Scene
()
{}
void
Scene
::
dispose
()
{
ClearDartWrapper
();
}
std
::
unique_ptr
<
sky
::
compositor
::
LayerTree
>
Scene
::
takeLayerTree
()
{
return
std
::
move
(
m_layerTree
);
}
...
...
sky/engine/core/compositing/Scene.h
浏览文件 @
cc81c2fb
...
...
@@ -28,6 +28,8 @@ class Scene : public RefCounted<Scene>, public DartWrappable {
std
::
unique_ptr
<
sky
::
compositor
::
LayerTree
>
takeLayerTree
();
void
dispose
();
private:
explicit
Scene
(
std
::
unique_ptr
<
sky
::
compositor
::
Layer
>
rootLayer
,
uint32_t
rasterizerTracingThreshold
);
...
...
sky/engine/core/compositing/Scene.idl
浏览文件 @
cc81c2fb
...
...
@@ -4,4 +4,5 @@
//
An
opaque
handle
to
a
composited
scene
.
interface
Scene
{
void
dispose
()
;
}
;
sky/engine/core/compositing/SceneBuilder.cpp
浏览文件 @
cc81c2fb
...
...
@@ -131,7 +131,9 @@ PassRefPtr<Scene> SceneBuilder::build()
m_currentLayer
=
nullptr
;
int32_t
threshold
=
m_currentRasterizerTracingThreshold
;
m_currentRasterizerTracingThreshold
=
0
;
return
Scene
::
create
(
std
::
move
(
m_rootLayer
),
threshold
);
RefPtr
<
Scene
>
scene
=
Scene
::
create
(
std
::
move
(
m_rootLayer
),
threshold
);
ClearDartWrapper
();
return
scene
.
release
();
}
}
// namespace blink
sky/engine/core/painting/CanvasImage.cpp
浏览文件 @
cc81c2fb
...
...
@@ -20,4 +20,8 @@ int CanvasImage::height() const {
return
image_
->
height
();
}
void
CanvasImage
::
dispose
()
{
ClearDartWrapper
();
}
}
// namespace blink
sky/engine/core/painting/CanvasImage.h
浏览文件 @
cc81c2fb
...
...
@@ -20,6 +20,7 @@ class CanvasImage final : public RefCounted<CanvasImage>,
int
width
()
const
;
int
height
()
const
;
void
dispose
();
SkImage
*
image
()
const
{
return
image_
.
get
();
}
void
setImage
(
PassRefPtr
<
SkImage
>
image
)
{
image_
=
image
;
}
...
...
sky/engine/core/painting/Image.idl
浏览文件 @
cc81c2fb
...
...
@@ -9,4 +9,6 @@
//
TODO
(
ianh
):
convert
this
to
a
Size
readonly
attribute
long
width
; // width in number of image pixels
readonly
attribute
long
height
; // height in number of image pixels
void
dispose
()
;
}
;
sky/engine/core/painting/Picture.cpp
浏览文件 @
cc81c2fb
...
...
@@ -28,4 +28,9 @@ void Picture::playback(Canvas* canvas)
m_picture
->
playback
(
canvas
->
skCanvas
());
}
void
Picture
::
dispose
()
{
ClearDartWrapper
();
}
}
// namespace blink
sky/engine/core/painting/Picture.h
浏览文件 @
cc81c2fb
...
...
@@ -23,6 +23,7 @@ public:
SkPicture
*
toSkia
()
const
{
return
m_picture
.
get
();
}
void
playback
(
Canvas
*
canvas
);
void
dispose
();
private:
explicit
Picture
(
PassRefPtr
<
SkPicture
>
skPicture
);
...
...
sky/engine/core/painting/Picture.idl
浏览文件 @
cc81c2fb
...
...
@@ -7,4 +7,6 @@ interface Picture {
//
canvas
.
Using
the
Canvas
drawPicture
entry
point
gives
the
destination
//
canvas
the
option
of
just
taking
a
ref
.
void
playback
(
Canvas
canvas
)
;
void
dispose
()
;
}
;
sky/engine/core/painting/PictureRecorder.cpp
浏览文件 @
cc81c2fb
...
...
@@ -34,7 +34,9 @@ PassRefPtr<Picture> PictureRecorder::endRecording()
RefPtr
<
Picture
>
picture
=
Picture
::
create
(
adoptRef
(
m_pictureRecorder
.
endRecording
()));
m_canvas
->
clearSkCanvas
();
m_canvas
->
ClearDartWrapper
();
m_canvas
=
nullptr
;
ClearDartWrapper
();
return
picture
.
release
();
}
...
...
@@ -45,7 +47,9 @@ PassRefPtr<Drawable> PictureRecorder::endRecordingAsDrawable()
RefPtr
<
Drawable
>
drawable
=
Drawable
::
create
(
adoptRef
(
m_pictureRecorder
.
endRecordingAsDrawable
()));
m_canvas
->
clearSkCanvas
();
m_canvas
->
ClearDartWrapper
();
m_canvas
=
nullptr
;
ClearDartWrapper
();
return
drawable
.
release
();
}
...
...
sky/engine/core/painting/PictureRecorder.idl
浏览文件 @
cc81c2fb
...
...
@@ -4,7 +4,6 @@
[
Constructor
()
]
interface
PictureRecorder
{
readonly
attribute
boolean
isRecording
;
Picture
endRecording
()
;
Drawable
endRecordingAsDrawable
()
;
}
;
sky/engine/tonic/dart_wrappable.cc
浏览文件 @
cc81c2fb
...
...
@@ -63,6 +63,16 @@ void DartWrappable::AssociateWithDartWrapper(Dart_NativeArguments args) {
wrapper
,
this
,
info
.
size_in_bytes
,
&
FinalizeDartWrapper
);
}
void
DartWrappable
::
ClearDartWrapper
()
{
DCHECK
(
dart_wrapper_
);
Dart_Handle
wrapper
=
Dart_HandleFromWeakPersistent
(
dart_wrapper_
);
CHECK
(
!
LogIfError
(
Dart_SetNativeInstanceField
(
wrapper
,
kPeerIndex
,
0
)));
CHECK
(
!
LogIfError
(
Dart_SetNativeInstanceField
(
wrapper
,
kWrapperInfoIndex
,
0
)));
Dart_DeleteWeakPersistentHandle
(
Dart_CurrentIsolate
(),
dart_wrapper_
);
dart_wrapper_
=
nullptr
;
GetDartWrapperInfo
().
deref_object
(
this
);
}
void
DartWrappable
::
FinalizeDartWrapper
(
void
*
isolate_callback_data
,
Dart_WeakPersistentHandle
wrapper
,
void
*
peer
)
{
...
...
sky/engine/tonic/dart_wrappable.h
浏览文件 @
cc81c2fb
...
...
@@ -41,6 +41,7 @@ class DartWrappable {
Dart_Handle
CreateDartWrapper
(
DartState
*
dart_state
);
void
AssociateWithDartWrapper
(
Dart_NativeArguments
args
);
void
ClearDartWrapper
();
// Warning: Might delete this.
Dart_WeakPersistentHandle
dart_wrapper
()
const
{
return
dart_wrapper_
;
}
protected:
...
...
sky/shell/ui/engine.cc
浏览文件 @
cc81c2fb
...
...
@@ -13,15 +13,15 @@
#include "mojo/data_pipe_utils/data_pipe_utils.h"
#include "mojo/public/cpp/application/connect.h"
#include "services/asset_bundle/asset_unpacker_job.h"
#include "sky/engine/public/platform/WebInputEvent.h"
#include "sky/engine/public/platform/sky_display_metrics.h"
#include "sky/engine/public/platform/sky_display_metrics.h"
#include "sky/engine/public/platform/WebInputEvent.h"
#include "sky/engine/public/web/Sky.h"
#include "sky/engine/public/web/WebRuntimeFeatures.h"
#include "sky/shell/dart/dart_library_provider_files.h"
#include "sky/shell/dart/dart_library_provider_network.h"
#include "sky/shell/service_provider.h"
#include "sky/shell/switches.h"
#include "sky/shell/switches.h"
#include "sky/shell/ui/animator.h"
#include "sky/shell/ui/internals.h"
#include "sky/shell/ui/platform_impl.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录