Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
39bc40f4
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,发现更多精彩内容 >>
提交
39bc40f4
编写于
11月 16, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2062 from abarth/feature_parity
Bring sky_shell.mojo up to feature parity with sky_viewer.mojo
上级
e57bec96
ae58ba7c
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
79 addition
and
35 deletion
+79
-35
sky/services/engine/BUILD.gn
sky/services/engine/BUILD.gn
+1
-0
sky/services/engine/sky_engine.mojom
sky/services/engine/sky_engine.mojom
+2
-0
sky/shell/platform/mojo/main_mojo.cc
sky/shell/platform/mojo/main_mojo.cc
+11
-1
sky/shell/platform/mojo/platform_view_mojo.cc
sky/shell/platform/mojo/platform_view_mojo.cc
+6
-8
sky/shell/platform/mojo/platform_view_mojo.h
sky/shell/platform/mojo/platform_view_mojo.h
+2
-1
sky/shell/platform/mojo/sky_application_impl.cc
sky/shell/platform/mojo/sky_application_impl.cc
+18
-5
sky/shell/platform/mojo/sky_application_impl.h
sky/shell/platform/mojo/sky_application_impl.h
+6
-4
sky/shell/shell.cc
sky/shell/shell.cc
+12
-4
sky/shell/shell.h
sky/shell/shell.h
+8
-2
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+2
-5
sky/shell/ui/internals.cc
sky/shell/ui/internals.cc
+9
-4
sky/shell/ui/internals.h
sky/shell/ui/internals.h
+2
-1
未找到文件。
sky/services/engine/BUILD.gn
浏览文件 @
39bc40f4
...
...
@@ -13,6 +13,7 @@ mojom("interfaces") {
deps = [
"//mojo/public/interfaces/application",
"//mojo/services/asset_bundle/interfaces",
"//mojo/services/service_registry/interfaces",
"//sky/services/pointer:interfaces",
]
}
sky/services/engine/sky_engine.mojom
浏览文件 @
39bc40f4
...
...
@@ -7,6 +7,7 @@ module sky;
import "mojo/public/interfaces/application/service_provider.mojom";
import "mojo/public/interfaces/application/shell.mojom";
import "mojo/services/asset_bundle/interfaces/asset_bundle.mojom";
import "mojo/services/service_registry/interfaces/service_registry.mojom";
import "sky/services/engine/input_event.mojom";
import "sky/services/pointer/pointer.mojom";
...
...
@@ -22,6 +23,7 @@ struct ViewportMetrics {
struct ServicesData {
mojo.Shell? shell;
mojo.ServiceRegistry? service_registry;
mojo.ServiceProvider? services_provided_by_embedder;
mojo.ServiceProvider&? services_provided_to_embedder;
};
...
...
sky/shell/platform/mojo/main_mojo.cc
浏览文件 @
39bc40f4
...
...
@@ -19,6 +19,12 @@
namespace
sky
{
namespace
shell
{
namespace
{
// Instruct the DartVM to report type errors.
const
char
kEnableCheckedMode
[]
=
"--enable-checked-mode"
;
}
// namespace
class
MojoApp
:
public
mojo
::
ApplicationDelegate
,
public
mojo
::
InterfaceFactory
<
mojo
::
ContentHandler
>
{
...
...
@@ -31,7 +37,11 @@ class MojoApp : public mojo::ApplicationDelegate,
void
Initialize
(
mojo
::
ApplicationImpl
*
app
)
override
{
mojo
::
icu
::
Initialize
(
app
);
tracing_
.
Initialize
(
app
);
Shell
::
Init
();
Shell
::
Settings
settings
;
settings
.
enable_dart_checked_mode
=
app
->
HasArg
(
kEnableCheckedMode
);
Shell
::
Init
(
settings
);
}
bool
ConfigureIncomingConnection
(
...
...
sky/shell/platform/mojo/platform_view_mojo.cc
浏览文件 @
39bc40f4
...
...
@@ -54,17 +54,16 @@ PlatformViewMojo::PlatformViewMojo(const Config& config)
PlatformViewMojo
::~
PlatformViewMojo
()
{
}
void
PlatformViewMojo
::
Init
(
mojo
::
ShellPtr
shell
)
{
mojo
::
ConnectToService
(
shell
.
get
(),
"mojo:native_viewport_service"
,
&
viewport_
);
void
PlatformViewMojo
::
Init
(
mojo
::
Shell
*
shell
)
{
mojo
::
ConnectToService
(
shell
,
"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
=
80
0
;
size
->
height
=
6
0
0
;
size
->
width
=
32
0
;
size
->
height
=
6
4
0
;
viewport_
->
Create
(
size
.
Clone
(),
...
...
@@ -88,13 +87,12 @@ void PlatformViewMojo::Init(mojo::ShellPtr shell) {
ConnectToEngine
(
mojo
::
GetProxy
(
&
sky_engine_
));
ServicesDataPtr
services
=
ServicesData
::
New
();
services
->
shell
=
shell
.
Pass
();
sky_engine_
->
SetServices
(
services
.
Pass
());
}
void
PlatformViewMojo
::
Run
(
const
mojo
::
String
&
url
,
ServicesDataPtr
services
,
mojo
::
asset_bundle
::
AssetBundlePtr
bundle
)
{
sky_engine_
->
SetServices
(
services
.
Pass
());
sky_engine_
->
RunFromAssetBundle
(
url
,
bundle
.
Pass
());
}
...
...
sky/shell/platform/mojo/platform_view_mojo.h
浏览文件 @
39bc40f4
...
...
@@ -21,9 +21,10 @@ class PlatformViewMojo : public PlatformView,
explicit
PlatformViewMojo
(
const
Config
&
config
);
~
PlatformViewMojo
()
override
;
void
Init
(
mojo
::
Shell
Ptr
shell
);
void
Init
(
mojo
::
Shell
*
shell
);
void
Run
(
const
mojo
::
String
&
url
,
ServicesDataPtr
services
,
mojo
::
asset_bundle
::
AssetBundlePtr
bundle
);
private:
...
...
sky/shell/platform/mojo/sky_application_impl.cc
浏览文件 @
39bc40f4
...
...
@@ -27,16 +27,29 @@ void SkyApplicationImpl::Initialize(mojo::ShellPtr shell,
DCHECK
(
initial_response_
);
UnpackInitialResponse
(
shell
.
get
());
shell_view_
.
reset
(
new
ShellView
(
Shell
::
Shared
()));
PlatformViewMojo
*
view
=
platform_view
();
view
->
Init
(
shell
.
Pass
());
view
->
Run
(
url
,
bundle_
.
Pass
());
platform_view
()
->
Init
(
shell
.
get
());
shell_
=
shell
.
Pass
();
}
void
SkyApplicationImpl
::
AcceptConnection
(
const
mojo
::
String
&
requestor_url
,
mojo
::
InterfaceRequest
<
mojo
::
ServiceProvider
>
services
,
mojo
::
ServiceProviderPtr
exposed
_services
,
mojo
::
InterfaceRequest
<
mojo
::
ServiceProvider
>
outgoing_
services
,
mojo
::
ServiceProviderPtr
incoming
_services
,
const
mojo
::
String
&
resolved_url
)
{
if
(
!
bundle_
)
{
LOG
(
INFO
)
<<
"Cannot handle multiple connections yet."
;
return
;
}
mojo
::
ServiceRegistryPtr
service_registry
;
if
(
incoming_services
)
mojo
::
ConnectToService
(
incoming_services
.
get
(),
&
service_registry
);
ServicesDataPtr
services
=
ServicesData
::
New
();
services
->
shell
=
shell_
.
Pass
();
services
->
service_registry
=
service_registry
.
Pass
();
platform_view
()
->
Run
(
resolved_url
,
services
.
Pass
(),
bundle_
.
Pass
());
}
void
SkyApplicationImpl
::
RequestQuit
()
{
...
...
sky/shell/platform/mojo/sky_application_impl.h
浏览文件 @
39bc40f4
...
...
@@ -28,10 +28,11 @@ class SkyApplicationImpl : public mojo::Application {
void
Initialize
(
mojo
::
ShellPtr
shell
,
mojo
::
Array
<
mojo
::
String
>
args
,
const
mojo
::
String
&
url
)
override
;
void
AcceptConnection
(
const
mojo
::
String
&
requestor_url
,
mojo
::
InterfaceRequest
<
mojo
::
ServiceProvider
>
services
,
mojo
::
ServiceProviderPtr
exposed_services
,
const
mojo
::
String
&
resolved_url
)
override
;
void
AcceptConnection
(
const
mojo
::
String
&
requestor_url
,
mojo
::
InterfaceRequest
<
mojo
::
ServiceProvider
>
outgoing_services
,
mojo
::
ServiceProviderPtr
incoming_services
,
const
mojo
::
String
&
resolved_url
)
override
;
void
RequestQuit
()
override
;
PlatformViewMojo
*
platform_view
()
{
...
...
@@ -42,6 +43,7 @@ class SkyApplicationImpl : public mojo::Application {
mojo
::
StrongBinding
<
mojo
::
Application
>
binding_
;
mojo
::
URLResponsePtr
initial_response_
;
mojo
::
ShellPtr
shell_
;
mojo
::
asset_bundle
::
AssetBundlePtr
bundle_
;
scoped_ptr
<
ShellView
>
shell_view_
;
};
...
...
sky/shell/shell.cc
浏览文件 @
39bc40f4
...
...
@@ -7,6 +7,7 @@
#include <memory>
#include "base/bind.h"
#include "base/command_line.h"
#include "base/i18n/icu_util.h"
#include "base/lazy_instance.h"
#include "base/memory/discardable_memory.h"
...
...
@@ -14,6 +15,7 @@
#include "base/single_thread_task_runner.h"
#include "mojo/message_pump/message_pump_mojo.h"
#include "sky/shell/ui/engine.h"
#include "sky/shell/switches.h"
#include "ui/gl/gl_surface.h"
namespace
sky
{
...
...
@@ -49,7 +51,7 @@ base::LazyInstance<NonDiscardableMemoryAllocator> g_discardable;
}
// namespace
Shell
::
Shell
()
{
Shell
::
Shell
(
const
Settings
&
settings
)
:
settings_
(
settings
)
{
DCHECK
(
!
g_shell
);
base
::
Thread
::
Options
options
;
...
...
@@ -78,12 +80,18 @@ void Shell::InitStandalone() {
#if !defined(OS_LINUX)
CHECK
(
gfx
::
GLSurface
::
InitializeOneOff
());
#endif
Init
();
base
::
CommandLine
&
command_line
=
*
base
::
CommandLine
::
ForCurrentProcess
();
Settings
settings
;
settings
.
enable_dart_checked_mode
=
command_line
.
HasSwitch
(
switches
::
kEnableCheckedMode
);
Init
(
settings
);
}
void
Shell
::
Init
()
{
void
Shell
::
Init
(
const
Settings
&
settings
)
{
base
::
DiscardableMemoryAllocator
::
SetInstance
(
&
g_discardable
.
Get
());
g_shell
=
new
Shell
();
g_shell
=
new
Shell
(
settings
);
}
Shell
&
Shell
::
Shared
()
{
...
...
sky/shell/shell.h
浏览文件 @
39bc40f4
...
...
@@ -19,10 +19,14 @@ class Shell {
public:
~
Shell
();
struct
Settings
{
bool
enable_dart_checked_mode
=
false
;
};
// Init the shell to stand alone from MojoShell.
static
void
InitStandalone
();
// Init the shell to run inside MojoShell.
static
void
Init
();
static
void
Init
(
const
Settings
&
settings
);
static
Shell
&
Shared
();
...
...
@@ -38,10 +42,11 @@ class Shell {
return
io_task_runner_
.
get
();
}
const
Settings
&
settings
()
{
return
settings_
;
}
TracingController
&
tracing_controller
();
private:
explicit
Shell
();
explicit
Shell
(
const
Settings
&
settings
);
void
InitGPU
(
const
base
::
Thread
::
Options
&
options
);
void
InitUI
(
const
base
::
Thread
::
Options
&
options
);
...
...
@@ -54,6 +59,7 @@ class Shell {
scoped_refptr
<
base
::
SingleThreadTaskRunner
>
ui_task_runner_
;
scoped_refptr
<
base
::
SingleThreadTaskRunner
>
io_task_runner_
;
Settings
settings_
;
TracingController
tracing_controller_
;
DISALLOW_COPY_AND_ASSIGN
(
Shell
);
...
...
sky/shell/ui/engine.cc
浏览文件 @
39bc40f4
...
...
@@ -5,7 +5,6 @@
#include "sky/shell/ui/engine.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/threading/worker_pool.h"
#include "base/time/time.h"
...
...
@@ -19,8 +18,7 @@
#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/switches.h"
#include "sky/shell/switches.h"
#include "sky/shell/shell.h"
#include "sky/shell/ui/animator.h"
#include "sky/shell/ui/internals.h"
#include "sky/shell/ui/platform_impl.h"
...
...
@@ -75,9 +73,8 @@ base::WeakPtr<Engine> Engine::GetWeakPtr() {
void
Engine
::
Init
()
{
TRACE_EVENT0
(
"flutter"
,
"Engine::Init"
);
base
::
CommandLine
&
command_line
=
*
base
::
CommandLine
::
ForCurrentProcess
();
blink
::
WebRuntimeFeatures
::
enableDartCheckedMode
(
command_line
.
HasSwitch
(
switches
::
kEnableCheckedMode
)
);
Shell
::
Shared
().
settings
().
enable_dart_checked_mode
);
DCHECK
(
!
g_platform_impl
);
g_platform_impl
=
new
PlatformImpl
();
...
...
sky/shell/ui/internals.cc
浏览文件 @
39bc40f4
...
...
@@ -36,6 +36,11 @@ void TakeShellProxyHandle(Dart_NativeArguments args) {
args
,
GetInternals
()
->
TakeShellProxy
().
value
());
}
void
TakeServiceRegistry
(
Dart_NativeArguments
args
)
{
Dart_SetIntegerReturnValue
(
args
,
GetInternals
()
->
TakeServiceRegistry
().
value
());
}
void
TakeServicesProvidedByEmbedder
(
Dart_NativeArguments
args
)
{
Dart_SetIntegerReturnValue
(
args
,
GetInternals
()
->
TakeServicesProvidedByEmbedder
().
value
());
...
...
@@ -46,10 +51,6 @@ void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) {
args
,
GetInternals
()
->
TakeServicesProvidedToEmbedder
().
value
());
}
void
TakeServiceRegistry
(
Dart_NativeArguments
args
)
{
Dart_SetIntegerReturnValue
(
args
,
0
);
}
static
DartLibraryNatives
*
g_natives
;
void
EnsureNatives
()
{
...
...
@@ -119,6 +120,10 @@ mojo::Handle Internals::TakeShellProxy() {
return
services_
?
services_
->
shell
.
PassInterface
().
PassHandle
().
release
()
:
mojo
::
Handle
();
}
mojo
::
Handle
Internals
::
TakeServiceRegistry
()
{
return
services_
?
services_
->
service_registry
.
PassInterface
().
PassHandle
().
release
()
:
mojo
::
Handle
();
}
mojo
::
Handle
Internals
::
TakeServicesProvidedByEmbedder
()
{
return
service_provider_
.
PassInterface
().
PassHandle
().
release
();
}
...
...
sky/shell/ui/internals.h
浏览文件 @
39bc40f4
...
...
@@ -31,9 +31,10 @@ class Internals
mojo
::
asset_bundle
::
AssetBundlePtr
root_bundle
);
mojo
::
Handle
TakeShellProxy
();
mojo
::
Handle
TakeServiceRegistry
();
mojo
::
Handle
TakeServicesProvidedByEmbedder
();
mojo
::
Handle
TakeRootBundleHandle
();
mojo
::
Handle
TakeServicesProvidedToEmbedder
();
mojo
::
Handle
TakeRootBundleHandle
();
private:
explicit
Internals
(
ServicesDataPtr
services
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录