Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_43355755
engine
提交
61dcfbc0
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,发现更多精彩内容 >>
提交
61dcfbc0
编写于
8月 24, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add support for skyx to sky_viewer.mojo
Fixes #753
上级
1646afe3
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
48 addition
and
7 deletion
+48
-7
services/sky/BUILD.gn
services/sky/BUILD.gn
+1
-0
services/sky/document_view.cc
services/sky/document_view.cc
+31
-4
services/sky/document_view.h
services/sky/document_view.h
+6
-0
services/sky/internals.cc
services/sky/internals.cc
+8
-1
services/sky/internals.h
services/sky/internals.h
+1
-0
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+1
-2
未找到文件。
services/sky/BUILD.gn
浏览文件 @
61dcfbc0
...
...
@@ -47,6 +47,7 @@ mojo_native_application("sky") {
"//mojo/services/surfaces/public/interfaces",
"//mojo/services/view_manager/public/cpp",
"//mojo/services/view_manager/public/interfaces",
"//services/asset_bundle:lib",
"//services/sky/compositor",
"//skia",
"//sky/engine/public/sky",
...
...
services/sky/document_view.cc
浏览文件 @
61dcfbc0
...
...
@@ -6,6 +6,7 @@
#include "base/bind.h"
#include "base/location.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/string_util.h"
#include "base/thread_task_runner_handle.h"
...
...
@@ -17,6 +18,7 @@
#include "mojo/services/view_manager/public/cpp/view.h"
#include "mojo/services/view_manager/public/cpp/view_manager.h"
#include "mojo/services/view_manager/public/interfaces/view_manager.mojom.h"
#include "services/asset_bundle/asset_unpacker_job.h"
#include "services/sky/compositor/layer.h"
#include "services/sky/compositor/layer_host.h"
#include "services/sky/compositor/rasterizer_bitmap.h"
...
...
@@ -34,9 +36,13 @@
#include "third_party/skia/include/core/SkDevice.h"
#include "ui/events/gestures/gesture_recognizer.h"
using
mojo
::
asset_bundle
::
AssetUnpackerJob
;
namespace
sky
{
namespace
{
const
char
kSnapshotKey
[]
=
"snapshot_blob.bin"
;
ui
::
EventType
ConvertEventTypeToUIEventType
(
blink
::
WebInputEvent
::
Type
type
)
{
if
(
type
==
blink
::
WebInputEvent
::
PointerDown
)
return
ui
::
ET_TOUCH_PRESSED
;
...
...
@@ -133,17 +139,34 @@ void DocumentView::OnEmbed(
void
DocumentView
::
OnViewManagerDisconnected
(
mojo
::
ViewManager
*
view_manager
)
{
// TODO(aa): Need to figure out how shutdown works.
}
void
DocumentView
::
LoadFromSnapshotStream
(
String
name
,
mojo
::
ScopedDataPipeConsumerHandle
snapshot
)
{
if
(
sky_view_
)
sky_view_
->
RunFromSnapshot
(
name
,
snapshot
.
Pass
());
}
void
DocumentView
::
Load
(
mojo
::
URLResponsePtr
response
)
{
String
name
=
String
::
fromUTF8
(
response
->
url
);
library_provider_
.
reset
(
new
DartLibraryProviderImpl
(
network_service_
.
get
(),
CreatePrefetchedLibraryIfNeeded
(
name
,
response
.
Pass
())));
sky_view_
=
blink
::
SkyView
::
Create
(
this
);
layer_host_
.
reset
(
new
LayerHost
(
this
));
root_layer_
=
make_scoped_refptr
(
new
Layer
(
this
));
root_layer_
->
set_rasterizer
(
CreateRasterizer
());
layer_host_
->
SetRootLayer
(
root_layer_
);
String
name
=
String
::
fromUTF8
(
response
->
url
);
if
(
name
.
endsWith
(
".skyx"
))
{
AssetUnpackerJob
*
unpacker
=
new
AssetUnpackerJob
(
mojo
::
GetProxy
(
&
root_bundle_
),
base
::
MessageLoop
::
current
()
->
task_runner
());
unpacker
->
Unpack
(
response
->
body
.
Pass
());
root_bundle_
->
GetAsStream
(
kSnapshotKey
,
base
::
Bind
(
&
DocumentView
::
LoadFromSnapshotStream
,
weak_factory_
.
GetWeakPtr
(),
name
));
return
;
}
library_provider_
.
reset
(
new
DartLibraryProviderImpl
(
network_service_
.
get
(),
CreatePrefetchedLibraryIfNeeded
(
name
,
response
.
Pass
())));
sky_view_
->
RunFromLibrary
(
name
,
library_provider_
.
get
());
}
...
...
@@ -163,6 +186,10 @@ void DocumentView::GetPixelsForTesting(std::vector<unsigned char>* pixels) {
return
bitmap_rasterizer_
->
GetPixelsForTesting
(
pixels
);
}
mojo
::
ScopedMessagePipeHandle
DocumentView
::
TakeRootBundleHandle
()
{
return
root_bundle_
.
PassInterface
().
PassHandle
();
}
mojo
::
ScopedMessagePipeHandle
DocumentView
::
TakeServicesProvidedToEmbedder
()
{
return
services_provided_to_embedder_
.
PassMessagePipe
();
}
...
...
services/sky/document_view.h
浏览文件 @
61dcfbc0
...
...
@@ -11,6 +11,7 @@
#include "mojo/public/cpp/application/service_provider_impl.h"
#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/application.mojom.h"
#include "mojo/services/asset_bundle/public/interfaces/asset_bundle.mojom.h"
#include "mojo/services/content_handler/public/interfaces/content_handler.mojom.h"
#include "mojo/services/navigation/public/interfaces/navigation.mojom.h"
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
...
...
@@ -70,6 +71,7 @@ class DocumentView : public blink::ServiceProvider,
void
GetPixelsForTesting
(
std
::
vector
<
unsigned
char
>*
pixels
);
mojo
::
ScopedMessagePipeHandle
TakeRootBundleHandle
();
mojo
::
ScopedMessagePipeHandle
TakeServicesProvidedToEmbedder
();
mojo
::
ScopedMessagePipeHandle
TakeServicesProvidedByEmbedder
();
mojo
::
ScopedMessagePipeHandle
TakeServiceRegistry
();
...
...
@@ -104,6 +106,9 @@ class DocumentView : public blink::ServiceProvider,
float
GetDevicePixelRatio
()
const
;
scoped_ptr
<
Rasterizer
>
CreateRasterizer
();
void
LoadFromSnapshotStream
(
String
name
,
mojo
::
ScopedDataPipeConsumerHandle
snapshot
);
void
UpdateRootSizeAndViewportMetrics
(
const
mojo
::
Rect
&
new_bounds
);
void
InitServiceRegistry
();
...
...
@@ -115,6 +120,7 @@ class DocumentView : public blink::ServiceProvider,
mojo
::
ServiceProviderPtr
services_provided_by_embedder_
;
mojo
::
NetworkServicePtr
network_service_
;
mojo
::
Shell
*
shell_
;
mojo
::
asset_bundle
::
AssetBundlePtr
root_bundle_
;
mojo
::
NavigatorHostPtr
navigator_host_
;
std
::
unique_ptr
<
blink
::
SkyView
>
sky_view_
;
mojo
::
View
*
root_
;
...
...
services/sky/internals.cc
浏览文件 @
61dcfbc0
...
...
@@ -31,7 +31,8 @@ void NotifyTestComplete(Dart_NativeArguments args) {
}
void
TakeRootBundleHandle
(
Dart_NativeArguments
args
)
{
Dart_SetIntegerReturnValue
(
args
,
0
);
Dart_SetIntegerReturnValue
(
args
,
GetInternals
()
->
TakeRootBundleHandle
().
value
());
}
void
TakeShellProxyHandle
(
Dart_NativeArguments
args
)
{
...
...
@@ -100,6 +101,12 @@ Internals::Internals(DocumentView* document_view)
Internals
::~
Internals
()
{
}
mojo
::
Handle
Internals
::
TakeRootBundleHandle
()
{
if
(
!
document_view_
)
return
mojo
::
Handle
();
return
document_view_
->
TakeRootBundleHandle
().
release
();
}
mojo
::
Handle
Internals
::
TakeServicesProvidedToEmbedder
()
{
if
(
!
document_view_
)
return
mojo
::
Handle
();
...
...
services/sky/internals.h
浏览文件 @
61dcfbc0
...
...
@@ -28,6 +28,7 @@ class Internals : public base::SupportsUserData::Data,
mojo
::
ServiceProviderPtr
exposed_services
)
override
;
mojo
::
Handle
TakeShellProxyHandle
();
mojo
::
Handle
TakeRootBundleHandle
();
mojo
::
Handle
TakeServicesProvidedToEmbedder
();
mojo
::
Handle
TakeServicesProvidedByEmbedder
();
mojo
::
Handle
TakeServiceRegistry
();
...
...
sky/shell/ui/engine.cc
浏览文件 @
61dcfbc0
...
...
@@ -30,11 +30,10 @@
namespace
sky
{
namespace
shell
{
namespace
{
const
char
kSnapshotKey
[]
=
"snapshot_blob.bin"
;
namespace
{
void
Ignored
(
bool
)
{
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录