Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
33e56114
E
engine
项目概览
liujiuri
/
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,发现更多精彩内容 >>
提交
33e56114
编写于
11月 13, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2050 from abarth/execute_code3
Wire sky_shell.mojo up to native_viewport
上级
8b406037
96b847cd
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
556 addition
and
135 deletion
+556
-135
sky/services/engine/BUILD.gn
sky/services/engine/BUILD.gn
+2
-1
sky/services/engine/sky_engine.mojom
sky/services/engine/sky_engine.mojom
+3
-0
sky/shell/BUILD.gn
sky/shell/BUILD.gn
+11
-6
sky/shell/gpu/direct/ganesh_surface.cc
sky/shell/gpu/direct/ganesh_surface.cc
+0
-34
sky/shell/gpu/direct/ganesh_surface.h
sky/shell/gpu/direct/ganesh_surface.h
+0
-41
sky/shell/gpu/direct/rasterizer_direct.cc
sky/shell/gpu/direct/rasterizer_direct.cc
+17
-27
sky/shell/gpu/direct/rasterizer_direct.h
sky/shell/gpu/direct/rasterizer_direct.h
+10
-11
sky/shell/gpu/ganesh_canvas.cc
sky/shell/gpu/ganesh_canvas.cc
+71
-0
sky/shell/gpu/ganesh_canvas.h
sky/shell/gpu/ganesh_canvas.h
+39
-0
sky/shell/gpu/mojo/rasterizer_mojo.cc
sky/shell/gpu/mojo/rasterizer_mojo.cc
+72
-0
sky/shell/gpu/mojo/rasterizer_mojo.h
sky/shell/gpu/mojo/rasterizer_mojo.h
+48
-0
sky/shell/platform/android/sky_main.cc
sky/shell/platform/android/sky_main.cc
+1
-1
sky/shell/platform/linux/main_linux.cc
sky/shell/platform/linux/main_linux.cc
+1
-1
sky/shell/platform/mac/platform_mac.mm
sky/shell/platform/mac/platform_mac.mm
+1
-1
sky/shell/platform/mojo/BUILD.gn
sky/shell/platform/mojo/BUILD.gn
+14
-2
sky/shell/platform/mojo/content_handler_impl.cc
sky/shell/platform/mojo/content_handler_impl.cc
+27
-0
sky/shell/platform/mojo/content_handler_impl.h
sky/shell/platform/mojo/content_handler_impl.h
+34
-0
sky/shell/platform/mojo/main_mojo.cc
sky/shell/platform/mojo/main_mojo.cc
+3
-1
sky/shell/platform/mojo/platform_view_mojo.cc
sky/shell/platform/mojo/platform_view_mojo.cc
+56
-2
sky/shell/platform/mojo/platform_view_mojo.h
sky/shell/platform/mojo/platform_view_mojo.h
+23
-1
sky/shell/platform/mojo/sky_application_impl.cc
sky/shell/platform/mojo/sky_application_impl.cc
+49
-0
sky/shell/platform/mojo/sky_application_impl.h
sky/shell/platform/mojo/sky_application_impl.h
+47
-0
sky/shell/shell.cc
sky/shell/shell.cc
+6
-1
sky/shell/shell.h
sky/shell/shell.h
+5
-0
sky/shell/shell_view.cc
sky/shell/shell_view.cc
+3
-3
sky/shell/shell_view.h
sky/shell/shell_view.h
+2
-2
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+9
-0
sky/shell/ui/engine.h
sky/shell/ui/engine.h
+2
-0
未找到文件。
sky/services/engine/BUILD.gn
浏览文件 @
33e56114
...
...
@@ -11,6 +11,7 @@ mojom("interfaces") {
]
deps = [
"//sky/services/pointer:interfaces"
"//mojo/services/asset_bundle/interfaces",
"//sky/services/pointer:interfaces",
]
}
sky/services/engine/sky_engine.mojom
浏览文件 @
33e56114
...
...
@@ -4,6 +4,7 @@
module sky;
import "mojo/services/asset_bundle/interfaces/asset_bundle.mojom";
import "sky/services/engine/input_event.mojom";
import "sky/services/pointer/pointer.mojom";
...
...
@@ -30,4 +31,6 @@ interface SkyEngine {
RunFromPrecompiledSnapshot(string path);
RunFromSnapshot(string path);
RunFromBundle(string path);
RunFromAssetBundle(string url, mojo.asset_bundle.AssetBundle bundle);
};
sky/shell/BUILD.gn
浏览文件 @
33e56114
...
...
@@ -28,6 +28,11 @@ common_deps = [
"//ui/gfx/geometry",
"//ui/gl",
"//url:url",
"//mojo/public/c/gpu",
"//mojo/public/c/gpu:gpu_onscreen",
"//mojo/services/gpu/interfaces",
"//mojo/services/native_viewport/interfaces",
"//mojo/skia:skia_bindings",
]
if (is_linux || is_mac) {
...
...
@@ -43,12 +48,12 @@ if (is_linux || is_mac) {
source_set("common") {
sources = [
"gpu/direct/
ganesh_contex
t.cc",
"gpu/direct/
ganesh_contex
t.h",
"gpu/
direct/ganesh_surface
.cc",
"gpu/
direct/ganesh_surface
.h",
"gpu/
direct/rasterizer
.cc",
"gpu/
direct/rasterizer
.h",
"gpu/direct/
rasterizer_direc
t.cc",
"gpu/direct/
rasterizer_direc
t.h",
"gpu/
mojo/rasterizer_mojo
.cc",
"gpu/
mojo/rasterizer_mojo
.h",
"gpu/
ganesh_canvas
.cc",
"gpu/
ganesh_canvas
.h",
"gpu_delegate.cc",
"gpu_delegate.h",
"platform_view.cc",
...
...
sky/shell/gpu/direct/ganesh_surface.cc
已删除
100644 → 0
浏览文件 @
8b406037
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/gpu/direct/ganesh_surface.h"
#include "base/logging.h"
#include "third_party/skia/include/gpu/GrContext.h"
namespace
sky
{
namespace
shell
{
GaneshSurface
::
GaneshSurface
(
intptr_t
window_fbo
,
GaneshContext
*
context
,
const
gfx
::
Size
&
size
)
{
GrBackendRenderTargetDesc
desc
;
desc
.
fWidth
=
size
.
width
();
desc
.
fHeight
=
size
.
height
();
desc
.
fConfig
=
kSkia8888_GrPixelConfig
;
desc
.
fOrigin
=
kBottomLeft_GrSurfaceOrigin
;
desc
.
fRenderTargetHandle
=
window_fbo
;
skia
::
RefPtr
<
GrRenderTarget
>
target
=
skia
::
AdoptRef
(
context
->
gr
()
->
textureProvider
()
->
wrapBackendRenderTarget
(
desc
));
DCHECK
(
target
);
surface_
=
skia
::
AdoptRef
(
SkSurface
::
NewRenderTargetDirect
(
target
.
get
()));
DCHECK
(
surface_
);
}
GaneshSurface
::~
GaneshSurface
()
{
}
}
// namespace shell
}
// namespace sky
sky/shell/gpu/direct/ganesh_surface.h
已删除
100644 → 0
浏览文件 @
8b406037
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_GPU_DIRECT_GANESH_SURFACE_H_
#define SKY_SHELL_GPU_DIRECT_GANESH_SURFACE_H_
#include "base/memory/scoped_ptr.h"
#include "sky/engine/wtf/RefPtr.h"
#include "sky/shell/gpu/direct/ganesh_context.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/geometry/size.h"
namespace
sky
{
namespace
shell
{
// GaneshSurface holds an SkSurface configured to render with Ganesh. Using the
// provided GaneshContext, GaneshSurface wraps an SkSurface around the window
// bound FBO so that you can use |canvas()| to draw to that window bound FBO.
class
GaneshSurface
{
public:
GaneshSurface
(
intptr_t
window_fbo
,
GaneshContext
*
context
,
const
gfx
::
Size
&
size
);
~
GaneshSurface
();
SkCanvas
*
canvas
()
const
{
return
surface_
->
getCanvas
();
}
gfx
::
Size
size
()
const
{
return
gfx
::
Size
(
surface_
->
width
(),
surface_
->
height
());
}
private:
skia
::
RefPtr
<
SkSurface
>
surface_
;
DISALLOW_COPY_AND_ASSIGN
(
GaneshSurface
);
};
}
// namespace shell
}
// namespace sky
#endif // SKY_SHELL_GPU_DIRECT_GANESH_SURFACE_H_
sky/shell/gpu/direct/rasterizer.cc
→
sky/shell/gpu/direct/rasterizer
_direct
.cc
浏览文件 @
33e56114
...
...
@@ -2,48 +2,47 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/gpu/direct/rasterizer.h"
#include "sky/shell/gpu/direct/rasterizer
_direct
.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "sky/compositor/container_layer.h"
#include "sky/compositor/layer.h"
#include "sky/compositor/paint_context.h"
#include "sky/compositor/picture_layer.h"
#include "sky/shell/gpu/direct/ganesh_context.h"
#include "sky/shell/gpu/direct/ganesh_surface.h"
#include "sky/shell/shell.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPicture.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_bindings_skia_in_process.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_share_group.h"
#include "ui/gl/gl_surface.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace
sky
{
namespace
shell
{
static
const
double
kOneFrameDuration
=
1e3
/
60.0
;
Rasterizer
::
Rasterizer
()
Rasterizer
Direct
::
RasterizerDirect
()
:
share_group_
(
new
gfx
::
GLShareGroup
()),
weak_factory_
(
this
)
{
}
Rasterizer
::~
Rasterizer
()
{
Rasterizer
Direct
::~
RasterizerDirect
()
{
}
base
::
WeakPtr
<
Rasterizer
>
Rasterizer
::
GetWeakPtr
()
{
base
::
WeakPtr
<
Rasterizer
Direct
>
RasterizerDirect
::
GetWeakPtr
()
{
return
weak_factory_
.
GetWeakPtr
();
}
void
Rasterizer
::
OnAcceleratedWidgetAvailable
(
gfx
::
AcceleratedWidget
widget
)
{
void
Rasterizer
Direct
::
OnAcceleratedWidgetAvailable
(
gfx
::
AcceleratedWidget
widget
)
{
surface_
=
gfx
::
GLSurface
::
CreateViewGLSurface
(
widget
,
gfx
::
SurfaceConfiguration
());
CHECK
(
surface_
)
<<
"GLSurface required."
;
}
void
Rasterizer
::
Draw
(
scoped_ptr
<
compositor
::
LayerTree
>
layer_tree
)
{
TRACE_EVENT0
(
"sky"
,
"Rasterizer::Draw"
);
void
Rasterizer
Direct
::
Draw
(
scoped_ptr
<
compositor
::
LayerTree
>
layer_tree
)
{
TRACE_EVENT0
(
"sky"
,
"Rasterizer
Direct
::Draw"
);
if
(
!
surface_
)
return
;
...
...
@@ -59,12 +58,11 @@ void Rasterizer::Draw(scoped_ptr<compositor::LayerTree> layer_tree) {
// for instrumentation.
paint_context_
.
engine_time
().
setLapTime
(
layer_tree
->
construction_time
());
// Use the canvas from the Ganesh Surface to render the current frame into
{
EnsureGLContext
();
CHECK
(
context_
->
MakeCurrent
(
surface_
.
get
()));
EnsureGaneshSurface
(
surface_
->
GetBackingFrameBufferObject
(),
size
);
SkCanvas
*
canvas
=
ganesh_surface_
->
canvas
(
);
SkCanvas
*
canvas
=
ganesh_canvas_
.
GetCanvas
(
surface_
->
GetBackingFrameBufferObject
(),
layer_tree
->
frame_size
()
);
sky
::
compositor
::
PaintContext
::
ScopedFrame
frame
=
paint_context_
.
AcquireFrame
(
*
canvas
);
canvas
->
clear
(
SK_ColorBLACK
);
...
...
@@ -94,34 +92,26 @@ void Rasterizer::Draw(scoped_ptr<compositor::LayerTree> layer_tree) {
}
}
void
Rasterizer
::
OnOutputSurfaceDestroyed
()
{
void
Rasterizer
Direct
::
OnOutputSurfaceDestroyed
()
{
if
(
context_
)
{
CHECK
(
context_
->
MakeCurrent
(
surface_
.
get
()));
ganesh_surface_
.
reset
();
ganesh_context_
.
reset
();
ganesh_canvas_
.
SetGrGLInterface
(
nullptr
);
context_
=
nullptr
;
}
CHECK
(
!
ganesh_surface_
);
CHECK
(
!
ganesh_context_
);
CHECK
(
!
ganesh_canvas_
.
IsValid
());
CHECK
(
!
context_
);
surface_
=
nullptr
;
}
void
Rasterizer
::
EnsureGLContext
()
{
void
Rasterizer
Direct
::
EnsureGLContext
()
{
if
(
context_
)
return
;
context_
=
gfx
::
GLContext
::
CreateGLContext
(
share_group_
.
get
(),
surface_
.
get
(),
gfx
::
PreferIntegratedGpu
);
CHECK
(
context_
)
<<
"GLContext required."
;
CHECK
(
context_
->
MakeCurrent
(
surface_
.
get
()));
ganesh_context_
.
reset
(
new
GaneshContext
(
context_
.
get
()));
}
void
Rasterizer
::
EnsureGaneshSurface
(
intptr_t
window_fbo
,
const
gfx
::
Size
&
size
)
{
if
(
!
ganesh_surface_
||
ganesh_surface_
->
size
()
!=
size
)
ganesh_surface_
.
reset
(
new
GaneshSurface
(
window_fbo
,
ganesh_context_
.
get
(),
size
));
gr_gl_interface_
=
skia
::
AdoptRef
(
gfx
::
CreateInProcessSkiaGLBinding
());
ganesh_canvas_
.
SetGrGLInterface
(
gr_gl_interface_
.
get
());
}
}
// namespace shell
...
...
sky/shell/gpu/direct/rasterizer.h
→
sky/shell/gpu/direct/rasterizer
_direct
.h
浏览文件 @
33e56114
...
...
@@ -8,12 +8,11 @@
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "skia/ext/refptr.h"
#include "sky/compositor/paint_context.h"
#include "sky/shell/gpu/ganesh_canvas.h"
#include "sky/shell/gpu_delegate.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/native_widget_types.h"
#include "sky/compositor/paint_context.h"
class
SkPicture
;
namespace
gfx
{
class
GLContext
;
...
...
@@ -26,12 +25,12 @@ namespace shell {
class
GaneshContext
;
class
GaneshSurface
;
class
Rasterizer
:
public
GPUDelegate
{
class
Rasterizer
Direct
:
public
GPUDelegate
{
public:
explicit
Rasterizer
();
~
Rasterizer
()
override
;
explicit
Rasterizer
Direct
();
~
Rasterizer
Direct
()
override
;
base
::
WeakPtr
<
Rasterizer
>
GetWeakPtr
();
base
::
WeakPtr
<
Rasterizer
Direct
>
GetWeakPtr
();
void
OnAcceleratedWidgetAvailable
(
gfx
::
AcceleratedWidget
widget
)
override
;
void
OnOutputSurfaceDestroyed
()
override
;
...
...
@@ -45,14 +44,14 @@ class Rasterizer : public GPUDelegate {
scoped_refptr
<
gfx
::
GLSurface
>
surface_
;
scoped_refptr
<
gfx
::
GLContext
>
context_
;
s
coped_ptr
<
GaneshContext
>
ganesh_context
_
;
scoped_ptr
<
GaneshSurface
>
ganesh_surface
_
;
s
kia
::
RefPtr
<
const
GrGLInterface
>
gr_gl_interface
_
;
GaneshCanvas
ganesh_canvas
_
;
compositor
::
PaintContext
paint_context_
;
base
::
WeakPtrFactory
<
Rasterizer
>
weak_factory_
;
base
::
WeakPtrFactory
<
Rasterizer
Direct
>
weak_factory_
;
DISALLOW_COPY_AND_ASSIGN
(
Rasterizer
);
DISALLOW_COPY_AND_ASSIGN
(
Rasterizer
Direct
);
};
}
// namespace shell
...
...
sky/shell/gpu/
direct/ganesh_context
.cc
→
sky/shell/gpu/
ganesh_canvas
.cc
浏览文件 @
33e56114
...
...
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/gpu/
direct/ganesh_context
.h"
#include "sky/shell/gpu/
ganesh_canvas
.h"
#include "base/logging.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "ui/gl/gl_bindings_skia_in_process.h"
namespace
sky
{
namespace
shell
{
...
...
@@ -22,21 +21,50 @@ const size_t kMaxGaneshResourceCacheBytes = 96 * 1024 * 1024;
}
// namespace
GaneshContext
::
GaneshContext
(
scoped_refptr
<
gfx
::
GLContext
>
gl_context
)
:
gl_context_
(
gl_context
)
{
skia
::
RefPtr
<
const
GrGLInterface
>
interface
=
skia
::
AdoptRef
(
gfx
::
CreateInProcessSkiaGLBinding
());
DCHECK
(
interface
);
gr_context_
=
skia
::
AdoptRef
(
GrContext
::
Create
(
kOpenGL_GrBackend
,
reinterpret_cast
<
GrBackendContext
>
(
interface
.
get
())));
DCHECK
(
gr_context_
)
<<
"Failed to create GrContext."
;
gr_context_
->
setResourceCacheLimits
(
kMaxGaneshResourceCacheCount
,
kMaxGaneshResourceCacheBytes
);
GaneshCanvas
::
GaneshCanvas
()
{
}
GaneshContext
::~
GaneshContext
()
{
gr_context_
->
abandonContext
();
GaneshCanvas
::~
GaneshCanvas
()
{
}
void
GaneshCanvas
::
SetGrGLInterface
(
const
GrGLInterface
*
interface
)
{
sk_surface_
.
clear
();
if
(
interface
)
{
gr_context_
=
skia
::
AdoptRef
(
GrContext
::
Create
(
kOpenGL_GrBackend
,
reinterpret_cast
<
GrBackendContext
>
(
interface
)));
DCHECK
(
gr_context_
);
gr_context_
->
setResourceCacheLimits
(
kMaxGaneshResourceCacheCount
,
kMaxGaneshResourceCacheBytes
);
}
else
if
(
gr_context_
)
{
gr_context_
->
abandonContext
();
gr_context_
.
clear
();
}
}
SkCanvas
*
GaneshCanvas
::
GetCanvas
(
int32_t
fbo
,
const
SkISize
&
size
)
{
DCHECK
(
IsValid
());
if
(
sk_surface_
&&
sk_surface_
->
width
()
==
size
.
width
()
&&
sk_surface_
->
height
()
==
size
.
height
())
return
sk_surface_
->
getCanvas
();
GrBackendRenderTargetDesc
desc
;
desc
.
fWidth
=
size
.
width
();
desc
.
fHeight
=
size
.
height
();
desc
.
fConfig
=
kSkia8888_GrPixelConfig
;
desc
.
fOrigin
=
kBottomLeft_GrSurfaceOrigin
;
desc
.
fRenderTargetHandle
=
fbo
;
skia
::
RefPtr
<
GrRenderTarget
>
target
=
skia
::
AdoptRef
(
gr_context_
->
textureProvider
()
->
wrapBackendRenderTarget
(
desc
));
DCHECK
(
target
);
sk_surface_
=
skia
::
AdoptRef
(
SkSurface
::
NewRenderTargetDirect
(
target
.
get
()));
DCHECK
(
sk_surface_
);
return
sk_surface_
->
getCanvas
();
}
bool
GaneshCanvas
::
IsValid
()
{
return
gr_context_
;
}
}
// namespace shell
...
...
sky/shell/gpu/
direct/ganesh_context
.h
→
sky/shell/gpu/
ganesh_canvas
.h
浏览文件 @
33e56114
...
...
@@ -2,36 +2,38 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_GPU_
DIRECT_GANESH_CONTEXT
_H_
#define SKY_SHELL_GPU_
DIRECT_GANESH_CONTEXT
_H_
#ifndef SKY_SHELL_GPU_
GANESH_CANVAS
_H_
#define SKY_SHELL_GPU_
GANESH_CANVAS
_H_
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/core/SkSurface.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/gl/GrGLInterface.h"
#include "third_party/skia/include/gpu/GrContext.h"
#include "ui/gl/gl_context.h"
namespace
sky
{
namespace
shell
{
// GaneshContext holds the top-level context object for Ganesh (known as
// GrContext). We construct the GrContext using the OpenGL interface provided by
// gfx::GLContext.
class
GaneshContext
{
class
GaneshCanvas
{
public:
explicit
GaneshContext
(
scoped_refptr
<
gfx
::
GLContext
>
gl_context
);
~
GaneshC
ontext
();
GaneshCanvas
(
);
~
GaneshC
anvas
();
GrContext
*
gr
()
const
{
return
gr_context_
.
get
();
}
void
SetGrGLInterface
(
const
GrGLInterface
*
interface
);
SkCanvas
*
GetCanvas
(
int32_t
fbo
,
const
SkISize
&
size
);
bool
IsValid
();
private:
scoped_refptr
<
gfx
::
GLContext
>
gl_context_
;
skia
::
RefPtr
<
GrContext
>
gr_context_
;
skia
::
RefPtr
<
SkSurface
>
sk_surface_
;
DISALLOW_COPY_AND_ASSIGN
(
GaneshC
ontext
);
DISALLOW_COPY_AND_ASSIGN
(
GaneshC
anvas
);
};
}
// namespace shell
}
// namespace sky
#endif // SKY_SHELL_GPU_
DIRECT_GANESH_CONTEXT
_H_
#endif // SKY_SHELL_GPU_
GANESH_CANVAS
_H_
sky/shell/gpu/mojo/rasterizer_mojo.cc
0 → 100644
浏览文件 @
33e56114
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/gpu/mojo/rasterizer_mojo.h"
#include "base/trace_event/trace_event.h"
#include "mojo/public/c/gpu/MGL/mgl.h"
#include "mojo/public/c/gpu/MGL/mgl_onscreen.h"
#include "mojo/skia/gl_bindings_skia.h"
#include "third_party/skia/include/core/SkCanvas.h"
namespace
sky
{
namespace
shell
{
namespace
{
void
ContextLostThunk
(
void
*
closure
)
{
static_cast
<
RasterizerMojo
*>
(
closure
)
->
OnContextLost
();
}
}
// namespace
RasterizerMojo
::
RasterizerMojo
()
{
}
RasterizerMojo
::~
RasterizerMojo
()
{
}
void
RasterizerMojo
::
OnAcceleratedWidgetAvailable
(
gfx
::
AcceleratedWidget
widget
)
{
}
void
RasterizerMojo
::
OnOutputSurfaceDestroyed
()
{
}
void
RasterizerMojo
::
Draw
(
scoped_ptr
<
compositor
::
LayerTree
>
layer_tree
)
{
TRACE_EVENT0
(
"sky"
,
"RasterizerMojo::Draw"
);
MGLResizeSurface
(
layer_tree
->
frame_size
().
width
(),
layer_tree
->
frame_size
().
height
());
SkCanvas
*
canvas
=
ganesh_canvas_
.
GetCanvas
(
0
,
layer_tree
->
frame_size
());
canvas
->
clear
(
SK_ColorGREEN
);
canvas
->
flush
();
MGLSwapBuffers
();
}
void
RasterizerMojo
::
OnContextProviderAvailable
(
mojo
::
InterfacePtrInfo
<
mojo
::
ContextProvider
>
context_provider
)
{
context_provider_
=
mojo
::
MakeProxy
(
context_provider
.
Pass
());
context_provider_
->
Create
(
nullptr
,
base
::
Bind
(
&
RasterizerMojo
::
OnContextCreated
,
base
::
Unretained
(
this
)));
gr_gl_interface_
=
skia
::
AdoptRef
(
skia_bindings
::
CreateMojoSkiaGLBinding
());
}
void
RasterizerMojo
::
OnContextCreated
(
mojo
::
CommandBufferPtr
command_buffer
)
{
context_
=
MGLCreateContext
(
MGL_API_VERSION_GLES2
,
command_buffer
.
PassInterface
().
PassHandle
().
release
().
value
(),
MGL_NO_CONTEXT
,
&
ContextLostThunk
,
this
,
mojo
::
Environment
::
GetDefaultAsyncWaiter
());
MGLMakeCurrent
(
context_
);
ganesh_canvas_
.
SetGrGLInterface
(
gr_gl_interface_
.
get
());
}
void
RasterizerMojo
::
OnContextLost
()
{
ganesh_canvas_
.
SetGrGLInterface
(
nullptr
);
MGLDestroyContext
(
context_
);
context_
=
nullptr
;
context_provider_
->
Create
(
nullptr
,
base
::
Bind
(
&
RasterizerMojo
::
OnContextCreated
,
base
::
Unretained
(
this
)));
}
}
// namespace shell
}
// namespace sky
sky/shell/gpu/mojo/rasterizer_mojo.h
0 → 100644
浏览文件 @
33e56114
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_
#define SKY_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_
#include "mojo/public/c/gpu/MGL/mgl.h"
#include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h"
#include "skia/ext/refptr.h"
#include "sky/compositor/paint_context.h"
#include "sky/shell/gpu/ganesh_canvas.h"
#include "sky/shell/gpu_delegate.h"
#include "ui/gfx/native_widget_types.h"
namespace
sky
{
namespace
shell
{
class
RasterizerMojo
:
public
GPUDelegate
{
public:
explicit
RasterizerMojo
();
~
RasterizerMojo
()
override
;
void
OnAcceleratedWidgetAvailable
(
gfx
::
AcceleratedWidget
widget
)
override
;
void
OnOutputSurfaceDestroyed
()
override
;
void
Draw
(
scoped_ptr
<
compositor
::
LayerTree
>
layer_tree
)
override
;
void
OnContextProviderAvailable
(
mojo
::
InterfacePtrInfo
<
mojo
::
ContextProvider
>
context_provder
);
void
OnContextLost
();
private:
SkCanvas
*
GetCanvas
(
const
SkISize
&
size
);
void
OnContextCreated
(
mojo
::
CommandBufferPtr
command_buffer
);
mojo
::
ContextProviderPtr
context_provider_
;
skia
::
RefPtr
<
GrGLInterface
>
gr_gl_interface_
;
MGLContext
context_
;
GaneshCanvas
ganesh_canvas_
;
DISALLOW_COPY_AND_ASSIGN
(
RasterizerMojo
);
};
}
// namespace shell
}
// namespace sky
#endif // SKY_SHELL_GPU_MOJO_RASTERIZER_MOJO_H_
sky/shell/platform/android/sky_main.cc
浏览文件 @
33e56114
...
...
@@ -78,7 +78,7 @@ static void Init(JNIEnv* env,
mojo
::
embedder
::
Init
(
std
::
unique_ptr
<
mojo
::
embedder
::
PlatformSupport
>
(
new
mojo
::
embedder
::
SimplePlatformSupport
()));
Shell
::
Init
(
make_scoped_ptr
(
new
ServiceProviderContext
(
Shell
::
Init
Standalone
(
make_scoped_ptr
(
new
ServiceProviderContext
(
g_java_message_loop
.
Get
()
->
task_runner
())));
InitializeTracing
();
...
...
sky/shell/platform/linux/main_linux.cc
浏览文件 @
33e56114
...
...
@@ -31,7 +31,7 @@ int main(int argc, const char* argv[]) {
mojo
::
embedder
::
Init
(
std
::
unique_ptr
<
mojo
::
embedder
::
PlatformSupport
>
(
new
mojo
::
embedder
::
SimplePlatformSupport
()));
sky
::
shell
::
Shell
::
Init
(
make_scoped_ptr
(
sky
::
shell
::
Shell
::
Init
Standalone
(
make_scoped_ptr
(
new
sky
::
shell
::
ServiceProviderContext
(
message_loop
.
task_runner
())));
if
(
!
sky
::
shell
::
InitForTesting
())
{
...
...
sky/shell/platform/mac/platform_mac.mm
浏览文件 @
33e56114
...
...
@@ -65,7 +65,7 @@ int PlatformMacMain(int argc,
mojo
::
embedder
::
Init
(
std
::
unique_ptr
<
mojo
::
embedder
::
PlatformSupport
>
(
new
mojo
::
embedder
::
SimplePlatformSupport
()));
sky
::
shell
::
Shell
::
Init
(
make_scoped_ptr
(
sky
::
shell
::
Shell
::
Init
Standalone
(
make_scoped_ptr
(
new
sky
::
shell
::
ServiceProviderContext
(
message_loop
->
task_runner
())));
result
=
callback
();
...
...
sky/shell/platform/mojo/BUILD.gn
浏览文件 @
33e56114
...
...
@@ -9,10 +9,14 @@ mojo_native_application("mojo") {
output_name = "sky_shell"
sources = [
"content_handler_impl.cc",
"content_handler_impl.h",
"main_mojo.cc",
"platform_service_provider_mojo.cc",
"platform_view_mojo.cc",
"platform_view_mojo.h",
"sky_application_impl.cc",
"sky_application_impl.h",
]
deps = [
...
...
@@ -25,15 +29,16 @@ mojo_native_application("mojo") {
"//mojo/public/cpp/system",
"//mojo/public/cpp/utility",
"//mojo/public/interfaces/application",
"//mojo/services/asset_bundle/interfaces",
"//mojo/services/content_handler/interfaces",
"//mojo/services/gpu/interfaces",
"//mojo/services/input_events/interfaces",
"//mojo/services/navigation/interfaces",
"//mojo/services/network/interfaces",
"//mojo/services/native_viewport/interfaces",
"//mojo/services/service_registry/interfaces",
"//mojo/services/surfaces/interfaces",
"//mojo/services/view_manager/cpp",
"//mojo/services/view_manager/interfaces",
"//mojo/services/ui/views/interfaces",
"//services/asset_bundle:lib",
"//services/sky/compositor",
"//skia",
...
...
@@ -44,4 +49,11 @@ mojo_native_application("mojo") {
"//third_party/icu",
"//url",
]
if (is_android) {
ldflags = [
"-lGLESv2",
"-lEGL",
]
}
}
sky/shell/platform/mojo/content_handler_impl.cc
0 → 100644
浏览文件 @
33e56114
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/platform/mojo/content_handler_impl.h"
#include "sky/shell/platform/mojo/sky_application_impl.h"
namespace
sky
{
namespace
shell
{
ContentHandlerImpl
::
ContentHandlerImpl
(
mojo
::
InterfaceRequest
<
mojo
::
ContentHandler
>
request
)
:
binding_
(
this
,
request
.
Pass
())
{
}
ContentHandlerImpl
::~
ContentHandlerImpl
()
{
}
void
ContentHandlerImpl
::
StartApplication
(
mojo
::
InterfaceRequest
<
mojo
::
Application
>
application
,
mojo
::
URLResponsePtr
response
)
{
new
SkyApplicationImpl
(
application
.
Pass
(),
response
.
Pass
());
}
}
// namespace shell
}
// namespace sky
sky/shell/platform/mojo/content_handler_impl.h
0 → 100644
浏览文件 @
33e56114
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_MOJO_CONTENT_HANDLER_IMPL_H_
#define SKY_SHELL_PLATFORM_MOJO_CONTENT_HANDLER_IMPL_H_
#include "base/message_loop/message_loop.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/shell.mojom.h"
#include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
namespace
sky
{
namespace
shell
{
class
ContentHandlerImpl
:
public
mojo
::
ContentHandler
{
public:
explicit
ContentHandlerImpl
(
mojo
::
InterfaceRequest
<
mojo
::
ContentHandler
>
request
);
~
ContentHandlerImpl
()
override
;
private:
// Overridden from ContentHandler:
void
StartApplication
(
mojo
::
InterfaceRequest
<
mojo
::
Application
>
application
,
mojo
::
URLResponsePtr
response
)
override
;
mojo
::
StrongBinding
<
mojo
::
ContentHandler
>
binding_
;
DISALLOW_COPY_AND_ASSIGN
(
ContentHandlerImpl
);
};
}
// namespace shell
}
// namespace sky
#endif // SKY_SHELL_PLATFORM_MOJO_CONTENT_HANDLER_IMPL_H_
sky/shell/platform/mojo/main_mojo.cc
浏览文件 @
33e56114
// Copyright 201
4
The Chromium Authors. All rights reserved.
// Copyright 201
5
The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
...
...
@@ -16,6 +16,7 @@
#include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
#include "sky/shell/shell.h"
#include "sky/shell/service_provider.h"
#include "sky/shell/platform/mojo/content_handler_impl.h"
namespace
sky
{
namespace
shell
{
...
...
@@ -45,6 +46,7 @@ class MojoApp : public mojo::ApplicationDelegate,
// Overridden from InterfaceFactory<ContentHandler>
void
Create
(
mojo
::
ApplicationConnection
*
connection
,
mojo
::
InterfaceRequest
<
mojo
::
ContentHandler
>
request
)
override
{
new
ContentHandlerImpl
(
request
.
Pass
());
}
mojo
::
TracingImpl
tracing_
;
...
...
sky/shell/platform/mojo/platform_view_mojo.cc
浏览文件 @
33e56114
...
...
@@ -11,9 +11,63 @@ PlatformView* PlatformView::Create(const Config& config) {
return
new
PlatformViewMojo
(
config
);
}
PlatformViewMojo
::
PlatformViewMojo
(
const
Config
&
config
)
:
PlatformView
(
config
)
{}
PlatformViewMojo
::
PlatformViewMojo
(
const
Config
&
config
)
:
PlatformView
(
config
),
dispatcher_binding_
(
this
)
{
}
PlatformViewMojo
::~
PlatformViewMojo
()
{
}
void
PlatformViewMojo
::
Init
(
mojo
::
ApplicationImpl
*
app
)
{
app
->
ConnectToService
(
"mojo:native_viewport_service"
,
&
viewport_
);
mojo
::
NativeViewportEventDispatcherPtr
ptr
;
dispatcher_binding_
.
Bind
(
GetProxy
(
&
ptr
));
viewport_
->
SetEventDispatcher
(
ptr
.
Pass
());
mojo
::
SizePtr
size
=
mojo
::
Size
::
New
();
size
->
width
=
800
;
size
->
height
=
600
;
viewport_
->
Create
(
size
.
Clone
(),
mojo
::
SurfaceConfiguration
::
New
(),
[
this
](
mojo
::
ViewportMetricsPtr
metrics
)
{
OnMetricsChanged
(
metrics
.
Pass
());
});
viewport_
->
Show
();
viewport_
->
GetContextProvider
(
GetProxy
(
&
context_provider_
));
PlatformViewMojo
::~
PlatformViewMojo
()
{}
// TODO(abarth): Move the to GPU thread.
context_provider_
.
PassInterface
();
}
void
PlatformViewMojo
::
Run
(
const
mojo
::
String
&
url
,
mojo
::
asset_bundle
::
AssetBundlePtr
bundle
)
{
ConnectToEngine
(
mojo
::
GetProxy
(
&
sky_engine_
));
sky_engine_
->
RunFromAssetBundle
(
url
,
bundle
.
Pass
());
}
void
PlatformViewMojo
::
OnMetricsChanged
(
mojo
::
ViewportMetricsPtr
metrics
)
{
DCHECK
(
metrics
);
viewport_
->
RequestMetrics
(
[
this
](
mojo
::
ViewportMetricsPtr
metrics
)
{
OnMetricsChanged
(
metrics
.
Pass
());
});
sky
::
ViewportMetricsPtr
sky_metrics
=
sky
::
ViewportMetrics
::
New
();
sky_metrics
->
physical_width
=
metrics
->
size
->
width
;
sky_metrics
->
physical_height
=
metrics
->
size
->
height
;
sky_metrics
->
device_pixel_ratio
=
metrics
->
device_pixel_ratio
;
sky_engine_
->
OnViewportMetricsChanged
(
sky_metrics
.
Pass
());
}
void
PlatformViewMojo
::
OnEvent
(
mojo
::
EventPtr
event
,
const
mojo
::
Callback
<
void
()
>&
callback
)
{
DCHECK
(
event
);
callback
.
Run
();
}
}
// namespace shell
}
// namespace sky
sky/shell/platform/mojo/platform_view_mojo.h
浏览文件 @
33e56114
...
...
@@ -5,17 +5,39 @@
#ifndef SKY_SHELL_PLATFORM_MOJO_PLATFORM_VIEW_MOJO_H_
#define SKY_SHELL_PLATFORM_MOJO_PLATFORM_VIEW_MOJO_H_
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
#include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h"
#include "mojo/services/native_viewport/interfaces/native_viewport.mojom.h"
#include "sky/shell/platform_view.h"
namespace
sky
{
namespace
shell
{
class
PlatformViewMojo
:
public
PlatformView
{
class
PlatformViewMojo
:
public
PlatformView
,
public
mojo
::
NativeViewportEventDispatcher
{
public:
explicit
PlatformViewMojo
(
const
Config
&
config
);
~
PlatformViewMojo
()
override
;
void
Init
(
mojo
::
ApplicationImpl
*
app
);
void
Run
(
const
mojo
::
String
&
url
,
mojo
::
asset_bundle
::
AssetBundlePtr
bundle
);
private:
void
OnMetricsChanged
(
mojo
::
ViewportMetricsPtr
metrics
);
// mojo::NativeViewportEventDispatcher
void
OnEvent
(
mojo
::
EventPtr
event
,
const
mojo
::
Callback
<
void
()
>&
callback
)
override
;
mojo
::
NativeViewportPtr
viewport_
;
mojo
::
ContextProviderPtr
context_provider_
;
mojo
::
Binding
<
NativeViewportEventDispatcher
>
dispatcher_binding_
;
sky
::
SkyEnginePtr
sky_engine_
;
DISALLOW_COPY_AND_ASSIGN
(
PlatformViewMojo
);
};
...
...
sky/shell/platform/mojo/sky_application_impl.cc
0 → 100644
浏览文件 @
33e56114
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "sky/shell/platform/mojo/sky_application_impl.h"
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/cpp/utility/run_loop.h"
#include "sky/shell/shell.h"
namespace
sky
{
namespace
shell
{
SkyApplicationImpl
::
SkyApplicationImpl
(
mojo
::
InterfaceRequest
<
mojo
::
Application
>
application
,
mojo
::
URLResponsePtr
response
)
:
app_
(
this
,
application
.
Pass
()),
initial_response_
(
response
.
Pass
())
{
}
SkyApplicationImpl
::~
SkyApplicationImpl
()
{
}
void
SkyApplicationImpl
::
Initialize
(
mojo
::
ApplicationImpl
*
app
)
{
DCHECK
(
initial_response_
);
UnpackInitialResponse
();
shell_view_
.
reset
(
new
ShellView
(
Shell
::
Shared
()));
PlatformViewMojo
*
view
=
platform_view
();
view
->
Init
(
app
);
view
->
Run
(
app_
.
url
(),
bundle_
.
Pass
());
}
bool
SkyApplicationImpl
::
ConfigureIncomingConnection
(
mojo
::
ApplicationConnection
*
connection
)
{
return
true
;
}
void
SkyApplicationImpl
::
UnpackInitialResponse
()
{
DCHECK
(
initial_response_
);
DCHECK
(
!
bundle_
);
mojo
::
asset_bundle
::
AssetUnpackerPtr
unpacker
;
app_
.
ConnectToService
(
"mojo:asset_bundle"
,
&
unpacker
);
unpacker
->
UnpackZipStream
(
initial_response_
->
body
.
Pass
(),
mojo
::
GetProxy
(
&
bundle_
));
initial_response_
=
nullptr
;
}
}
// namespace shell
}
// namespace sky
sky/shell/platform/mojo/sky_application_impl.h
0 → 100644
浏览文件 @
33e56114
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SKY_SHELL_PLATFORM_MOJO_SKY_APPLICATION_IMPL_H_
#define SKY_SHELL_PLATFORM_MOJO_SKY_APPLICATION_IMPL_H_
#include "base/message_loop/message_loop.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/shell.mojom.h"
#include "mojo/services/asset_bundle/interfaces/asset_bundle.mojom.h"
#include "mojo/services/content_handler/interfaces/content_handler.mojom.h"
#include "sky/shell/platform/mojo/platform_view_mojo.h"
#include "sky/shell/shell_view.h"
namespace
sky
{
namespace
shell
{
class
SkyApplicationImpl
:
public
mojo
::
ApplicationDelegate
{
public:
SkyApplicationImpl
(
mojo
::
InterfaceRequest
<
mojo
::
Application
>
application
,
mojo
::
URLResponsePtr
response
);
~
SkyApplicationImpl
()
override
;
private:
// mojo::ApplicationDelegate
void
Initialize
(
mojo
::
ApplicationImpl
*
app
)
override
;
bool
ConfigureIncomingConnection
(
mojo
::
ApplicationConnection
*
connection
)
override
;
PlatformViewMojo
*
platform_view
()
{
return
static_cast
<
PlatformViewMojo
*>
(
shell_view_
->
view
());
}
void
UnpackInitialResponse
();
mojo
::
ApplicationImpl
app_
;
mojo
::
URLResponsePtr
initial_response_
;
mojo
::
asset_bundle
::
AssetBundlePtr
bundle_
;
scoped_ptr
<
ShellView
>
shell_view_
;
};
}
// namespace shell
}
// namespace sky
#endif // SKY_SHELL_PLATFORM_MOJO_SKY_APPLICATION_IMPL_H_
sky/shell/shell.cc
浏览文件 @
33e56114
...
...
@@ -74,11 +74,16 @@ Shell::Shell(scoped_ptr<ServiceProviderContext> service_provider_context)
Shell
::~
Shell
()
{
}
void
Shell
::
Init
(
scoped_ptr
<
ServiceProviderContext
>
service_provider_context
)
{
void
Shell
::
InitStandalone
(
scoped_ptr
<
ServiceProviderContext
>
service_provider_context
)
{
CHECK
(
base
::
i18n
::
InitializeICU
());
#if !defined(OS_LINUX)
CHECK
(
gfx
::
GLSurface
::
InitializeOneOff
());
#endif
Init
(
service_provider_context
.
Pass
());
}
void
Shell
::
Init
(
scoped_ptr
<
ServiceProviderContext
>
service_provider_context
)
{
base
::
DiscardableMemoryAllocator
::
SetInstance
(
&
g_discardable
.
Get
());
g_shell
=
new
Shell
(
service_provider_context
.
Pass
());
...
...
sky/shell/shell.h
浏览文件 @
33e56114
...
...
@@ -21,8 +21,13 @@ class Shell {
public:
~
Shell
();
// Init the shell to stand alone from MojoShell.
static
void
InitStandalone
(
scoped_ptr
<
ServiceProviderContext
>
service_provider_context
);
// Init the shell to run inside MojoShell.
static
void
Init
(
scoped_ptr
<
ServiceProviderContext
>
service_provider_context
);
static
Shell
&
Shared
();
base
::
SingleThreadTaskRunner
*
gpu_task_runner
()
const
{
...
...
sky/shell/shell_view.cc
浏览文件 @
33e56114
...
...
@@ -6,7 +6,7 @@
#include "base/bind.h"
#include "base/single_thread_task_runner.h"
#include "sky/shell/gpu/direct/rasterizer.h"
#include "sky/shell/gpu/direct/rasterizer
_direct
.h"
#include "sky/shell/platform_view.h"
#include "sky/shell/shell.h"
#include "sky/shell/ui/engine.h"
...
...
@@ -23,7 +23,7 @@ void Drop(scoped_ptr<T> ptr) { }
ShellView
::
ShellView
(
Shell
&
shell
)
:
shell_
(
shell
)
{
shell_
.
tracing_controller
().
RegisterShellView
(
this
);
rasterizer_
.
reset
(
new
Rasterizer
());
rasterizer_
.
reset
(
new
Rasterizer
Direct
());
CreateEngine
();
CreatePlatformView
();
}
...
...
@@ -31,7 +31,7 @@ ShellView::ShellView(Shell& shell)
ShellView
::~
ShellView
()
{
shell_
.
tracing_controller
().
UnregisterShellView
(
this
);
shell_
.
gpu_task_runner
()
->
PostTask
(
FROM_HERE
,
base
::
Bind
(
&
Drop
<
Rasterizer
>
,
base
::
Passed
(
&
rasterizer_
)));
base
::
Bind
(
&
Drop
<
Rasterizer
Direct
>
,
base
::
Passed
(
&
rasterizer_
)));
shell_
.
ui_task_runner
()
->
PostTask
(
FROM_HERE
,
base
::
Bind
(
&
Drop
<
Engine
>
,
base
::
Passed
(
&
engine_
)));
}
...
...
sky/shell/shell_view.h
浏览文件 @
33e56114
...
...
@@ -14,7 +14,7 @@ namespace sky {
namespace
shell
{
class
Engine
;
class
PlatformView
;
class
Rasterizer
;
class
Rasterizer
Direct
;
class
Shell
;
class
ShellView
{
...
...
@@ -33,7 +33,7 @@ class ShellView {
Shell
&
shell_
;
scoped_ptr
<
PlatformView
>
view_
;
scoped_ptr
<
Rasterizer
>
rasterizer_
;
scoped_ptr
<
Rasterizer
Direct
>
rasterizer_
;
scoped_ptr
<
Engine
>
engine_
;
DISALLOW_COPY_AND_ASSIGN
(
ShellView
);
...
...
sky/shell/ui/engine.cc
浏览文件 @
33e56114
...
...
@@ -233,6 +233,15 @@ void Engine::RunFromBundle(const mojo::String& path) {
weak_factory_
.
GetWeakPtr
(),
path_str
));
}
void
Engine
::
RunFromAssetBundle
(
const
mojo
::
String
&
url
,
mojo
::
asset_bundle
::
AssetBundlePtr
bundle
)
{
std
::
string
url_str
=
url
;
root_bundle_
=
bundle
.
Pass
();
root_bundle_
->
GetAsStream
(
kSnapshotKey
,
base
::
Bind
(
&
Engine
::
RunFromSnapshotStream
,
weak_factory_
.
GetWeakPtr
(),
url_str
));
}
void
Engine
::
OnActivityPaused
()
{
activity_running_
=
false
;
StopAnimator
();
...
...
sky/shell/ui/engine.h
浏览文件 @
33e56114
...
...
@@ -77,6 +77,8 @@ class Engine : public UIDelegate,
void
RunFromPrecompiledSnapshot
(
const
mojo
::
String
&
bundle_path
)
override
;
void
RunFromSnapshot
(
const
mojo
::
String
&
path
)
override
;
void
RunFromBundle
(
const
mojo
::
String
&
path
)
override
;
void
RunFromAssetBundle
(
const
mojo
::
String
&
url
,
mojo
::
asset_bundle
::
AssetBundlePtr
bundle
)
override
;
void
OnActivityPaused
()
override
;
void
OnActivityResumed
()
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录