Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
989b29a6
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,发现更多精彩内容 >>
提交
989b29a6
编写于
3月 23, 2016
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2543 from abarth/update_mojo2
Update to mojo 891577b0517de5aeca538d99669787c6dc72412a
上级
7a68885c
3187dd13
变更
85
隐藏空白更改
内联
并排
Showing
85 changed file
with
872 addition
and
610 deletion
+872
-610
DEPS
DEPS
+1
-1
mojo/VERSION
mojo/VERSION
+1
-1
mojo/android/javatests/src/org/chromium/mojo/HandleMock.java
mojo/android/javatests/src/org/chromium/mojo/HandleMock.java
+8
-0
mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
...tests/src/org/chromium/mojo/system/impl/CoreImplTest.java
+15
-0
mojo/android/system/core_impl.cc
mojo/android/system/core_impl.cc
+20
-1
mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java
...id/system/src/org/chromium/mojo/system/impl/CoreImpl.java
+22
-0
mojo/android/system/src/org/chromium/mojo/system/impl/SharedBufferHandleImpl.java
...org/chromium/mojo/system/impl/SharedBufferHandleImpl.java
+7
-0
mojo/application/application_runner_chromium.cc
mojo/application/application_runner_chromium.cc
+4
-3
mojo/application/application_runner_chromium.h
mojo/application/application_runner_chromium.h
+6
-3
mojo/dart/packages/mojo/lib/mojo/application.mojom.dart
mojo/dart/packages/mojo/lib/mojo/application.mojom.dart
+9
-9
mojo/dart/packages/mojo/lib/mojo/application_connector.mojom.dart
...t/packages/mojo/lib/mojo/application_connector.mojom.dart
+6
-6
mojo/dart/packages/mojo/lib/mojo/bindings/types/mojom_files.mojom.dart
...kages/mojo/lib/mojo/bindings/types/mojom_files.mojom.dart
+3
-3
mojo/dart/packages/mojo/lib/mojo/bindings/types/mojom_types.mojom.dart
...kages/mojo/lib/mojo/bindings/types/mojom_types.mojom.dart
+54
-26
mojo/dart/packages/mojo/lib/mojo/bindings/types/service_describer.mojom.dart
...mojo/lib/mojo/bindings/types/service_describer.mojom.dart
+36
-36
mojo/dart/packages/mojo/lib/mojo/service_provider.mojom.dart
mojo/dart/packages/mojo/lib/mojo/service_provider.mojom.dart
+3
-3
mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart
mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart
+6
-6
mojo/dart/packages/mojo/lib/src/buffer.dart
mojo/dart/packages/mojo/lib/src/buffer.dart
+25
-0
mojo/dart/packages/mojo/sdk_ext/src/natives.dart
mojo/dart/packages/mojo/sdk_ext/src/natives.dart
+13
-0
mojo/data_pipe_utils/data_pipe_drainer.h
mojo/data_pipe_utils/data_pipe_drainer.h
+2
-1
mojo/data_pipe_utils/data_pipe_utils.cc
mojo/data_pipe_utils/data_pipe_utils.cc
+14
-0
mojo/data_pipe_utils/data_pipe_utils.h
mojo/data_pipe_utils/data_pipe_utils.h
+6
-1
mojo/data_pipe_utils/data_pipe_utils_internal.h
mojo/data_pipe_utils/data_pipe_utils_internal.h
+1
-1
mojo/edk/embedder/embedder.cc
mojo/edk/embedder/embedder.cc
+7
-5
mojo/edk/embedder/embedder.h
mojo/edk/embedder/embedder.h
+2
-1
mojo/edk/embedder/embedder_unittest.cc
mojo/edk/embedder/embedder_unittest.cc
+2
-1
mojo/edk/embedder/entrypoints.cc
mojo/edk/embedder/entrypoints.cc
+6
-4
mojo/edk/embedder/multiprocess_embedder_unittest.cc
mojo/edk/embedder/multiprocess_embedder_unittest.cc
+4
-2
mojo/edk/embedder/system_impl_private_entrypoints.cc
mojo/edk/embedder/system_impl_private_entrypoints.cc
+4
-1
mojo/edk/platform/test_stopwatch.h
mojo/edk/platform/test_stopwatch.h
+1
-1
mojo/edk/platform/thread_utils.h
mojo/edk/platform/thread_utils.h
+1
-1
mojo/edk/platform/time_ticks.h
mojo/edk/platform/time_ticks.h
+1
-1
mojo/edk/system/async_waiter.h
mojo/edk/system/async_waiter.h
+1
-1
mojo/edk/system/awakable.h
mojo/edk/system/awakable.h
+1
-1
mojo/edk/system/awakable_list.h
mojo/edk/system/awakable_list.h
+1
-1
mojo/edk/system/channel.h
mojo/edk/system/channel.h
+0
-1
mojo/edk/system/core.cc
mojo/edk/system/core.cc
+106
-85
mojo/edk/system/core.h
mojo/edk/system/core.h
+21
-12
mojo/edk/system/core_test_base.h
mojo/edk/system/core_test_base.h
+1
-1
mojo/edk/system/data_pipe.h
mojo/edk/system/data_pipe.h
+2
-1
mojo/edk/system/data_pipe_impl.h
mojo/edk/system/data_pipe_impl.h
+1
-1
mojo/edk/system/dispatcher.h
mojo/edk/system/dispatcher.h
+2
-1
mojo/edk/system/handle_signals_state.h
mojo/edk/system/handle_signals_state.h
+1
-1
mojo/edk/system/handle_table.cc
mojo/edk/system/handle_table.cc
+9
-3
mojo/edk/system/handle_table.h
mojo/edk/system/handle_table.h
+11
-13
mojo/edk/system/mapping_table.h
mojo/edk/system/mapping_table.h
+1
-1
mojo/edk/system/message_pipe.h
mojo/edk/system/message_pipe.h
+2
-1
mojo/edk/system/message_pipe_endpoint.h
mojo/edk/system/message_pipe_endpoint.h
+2
-1
mojo/edk/system/options_validation.h
mojo/edk/system/options_validation.h
+0
-1
mojo/edk/system/test/perf_log.h
mojo/edk/system/test/perf_log.h
+0
-3
mojo/edk/system/test/timeouts.h
mojo/edk/system/test/timeouts.h
+1
-1
mojo/edk/system/waiter.h
mojo/edk/system/waiter.h
+2
-1
mojo/edk/system/waiter_test_utils.h
mojo/edk/system/waiter_test_utils.h
+3
-1
mojo/message_pump/handle_watcher.h
mojo/message_pump/handle_watcher.h
+3
-2
mojo/message_pump/handle_watcher_unittest.cc
mojo/message_pump/handle_watcher_unittest.cc
+1
-1
mojo/message_pump/message_pump_mojo.cc
mojo/message_pump/message_pump_mojo.cc
+2
-0
mojo/message_pump/message_pump_mojo.h
mojo/message_pump/message_pump_mojo.h
+3
-1
mojo/message_pump/message_pump_mojo_handler.h
mojo/message_pump/message_pump_mojo_handler.h
+2
-1
mojo/message_pump/message_pump_mojo_unittest.cc
mojo/message_pump/message_pump_mojo_unittest.cc
+1
-1
mojo/services/authentication/interfaces/authentication.mojom
mojo/services/authentication/interfaces/authentication.mojom
+19
-1
mojo/services/log/cpp/lib/log_client.cc
mojo/services/log/cpp/lib/log_client.cc
+1
-0
mojo/services/media/audio/interfaces/audio_track.mojom
mojo/services/media/audio/interfaces/audio_track.mojom
+2
-2
mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.cc
...es/media/common/cpp/circular_buffer_media_pipe_adapter.cc
+9
-9
mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.h
...ces/media/common/cpp/circular_buffer_media_pipe_adapter.h
+16
-16
mojo/services/media/common/interfaces/BUILD.gn
mojo/services/media/common/interfaces/BUILD.gn
+0
-1
mojo/services/media/common/interfaces/media_pipe.mojom
mojo/services/media/common/interfaces/media_pipe.mojom
+0
-98
mojo/services/media/common/interfaces/media_transport.mojom
mojo/services/media/common/interfaces/media_transport.mojom
+69
-3
mojo/services/media/control/interfaces/media_factory.mojom
mojo/services/media/control/interfaces/media_factory.mojom
+4
-0
mojo/services/media/control/interfaces/media_player.mojom
mojo/services/media/control/interfaces/media_player.mojom
+5
-0
mojo/services/media/control/interfaces/media_source.mojom
mojo/services/media/control/interfaces/media_source.mojom
+7
-1
mojo/services/media/core/interfaces/BUILD.gn
mojo/services/media/core/interfaces/BUILD.gn
+12
-0
mojo/services/media/core/interfaces/media_type_converter.mojom
...services/media/core/interfaces/media_type_converter.mojom
+21
-0
mojo/services/mojo_services.gni
mojo/services/mojo_services.gni
+1
-0
mojo/services/ui/views/cpp/formatting.cc
mojo/services/ui/views/cpp/formatting.cc
+5
-2
mojo/services/ui/views/cpp/formatting.h
mojo/services/ui/views/cpp/formatting.h
+2
-0
mojo/services/ui/views/interfaces/BUILD.gn
mojo/services/ui/views/interfaces/BUILD.gn
+3
-0
mojo/services/ui/views/interfaces/layouts.mojom
mojo/services/ui/views/interfaces/layouts.mojom
+1
-4
mojo/services/ui/views/interfaces/view_associates.mojom
mojo/services/ui/views/interfaces/view_associates.mojom
+3
-2
mojo/services/ui/views/interfaces/view_containers.mojom
mojo/services/ui/views/interfaces/view_containers.mojom
+152
-0
mojo/services/ui/views/interfaces/view_token.mojom
mojo/services/ui/views/interfaces/view_token.mojom
+33
-0
mojo/services/ui/views/interfaces/view_tree_token.mojom
mojo/services/ui/views/interfaces/view_tree_token.mojom
+21
-0
mojo/services/ui/views/interfaces/view_trees.mojom
mojo/services/ui/views/interfaces/view_trees.mojom
+8
-77
mojo/services/ui/views/interfaces/views.mojom
mojo/services/ui/views/interfaces/views.mojom
+7
-130
sky/packages/sky_services/pubspec.yaml
sky/packages/sky_services/pubspec.yaml
+1
-1
sky/shell/platform/mojo/view_impl.cc
sky/shell/platform/mojo/view_impl.cc
+0
-5
sky/shell/platform/mojo/view_impl.h
sky/shell/platform/mojo/view_impl.h
+0
-2
未找到文件。
DEPS
浏览文件 @
989b29a6
...
...
@@ -19,7 +19,7 @@
vars = {
'chromium_git': 'https://chromium.googlesource.com',
'mojo_sdk_revision': '
5c0d7cd229bff7e2dfbcdea8310592ec90482919
',
'mojo_sdk_revision': '
8d13caec84db234e320129722d2f0d5d873def11
',
'base_revision': '6c89618151eb0e23d330778e6d6ea16fc6105010',
'skia_revision': 'ddf0713f0ba4ea75ca49a4ed6b4249eef72da1ce',
...
...
mojo/VERSION
浏览文件 @
989b29a6
b76db373e90403dbf8f63d86efb80f07ae9b128c
\ No newline at end of file
891577b0517de5aeca538d99669787c6dc72412a
\ No newline at end of file
mojo/android/javatests/src/org/chromium/mojo/HandleMock.java
浏览文件 @
989b29a6
...
...
@@ -226,4 +226,12 @@ public class HandleMock implements UntypedHandle, MessagePipeHandle,
// Do nothing.
}
/**
* @see SharedBufferHandle#getBufferInformation()
*/
@Override
public
BufferInformation
getBufferInformation
()
{
// Do nothing.
return
null
;
}
}
mojo/android/javatests/src/org/chromium/mojo/system/impl/CoreImplTest.java
浏览文件 @
989b29a6
...
...
@@ -24,6 +24,8 @@ import org.chromium.mojo.system.MojoResult;
import
org.chromium.mojo.system.Pair
;
import
org.chromium.mojo.system.ResultAnd
;
import
org.chromium.mojo.system.SharedBufferHandle
;
import
org.chromium.mojo.system.SharedBufferHandle.BufferInformation
;
import
org.chromium.mojo.system.SharedBufferHandle.BufferInformationFlags
;
import
java.nio.ByteBuffer
;
import
java.util.ArrayList
;
...
...
@@ -535,6 +537,19 @@ public class CoreImplTest extends MojoTestCase {
checkSharing
(
newHandle
,
handle
);
}
/**
* Testing {@link SharedBufferHandle}.
*/
@SmallTest
public
void
testSharedBufferInformation
()
{
Core
core
=
CoreImpl
.
getInstance
();
SharedBufferHandle
handle
=
core
.
createSharedBuffer
(
null
,
8
);
addHandleToClose
(
handle
);
BufferInformation
information
=
handle
.
getBufferInformation
();
assertEquals
(
BufferInformationFlags
.
NONE
,
information
.
getFlags
());
assertEquals
(
8
,
information
.
getBufferSize
());
}
/**
* Testing that invalid handle can be used with this implementation.
*/
...
...
mojo/android/system/core_impl.cc
浏览文件 @
989b29a6
...
...
@@ -14,7 +14,13 @@
#include "base/message_loop/message_loop.h"
#include "jni/CoreImpl_jni.h"
#include "mojo/public/c/environment/async_waiter.h"
#include "mojo/public/c/system/core.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/c/system/wait.h"
#include "mojo/public/cpp/environment/environment.h"
namespace
{
...
...
@@ -400,6 +406,19 @@ static jint GetNativeBufferOffset(JNIEnv* env,
return
alignment
-
offset
;
}
static
jobject
GetBufferInformation
(
JNIEnv
*
env
,
jobject
jcaller
,
jint
mojo_handle
)
{
MojoBufferInformation
buffer_information
;
MojoResult
result
=
MojoGetBufferInformation
(
static_cast
<
MojoHandle
>
(
mojo_handle
),
&
buffer_information
,
sizeof
(
buffer_information
));
return
Java_CoreImpl_newResultAndBufferInformation
(
env
,
result
,
buffer_information
.
flags
,
buffer_information
.
num_bytes
)
.
Release
();
}
bool
RegisterCoreImpl
(
JNIEnv
*
env
)
{
return
RegisterNativesImpl
(
env
);
}
...
...
mojo/android/system/src/org/chromium/mojo/system/impl/CoreImpl.java
浏览文件 @
989b29a6
...
...
@@ -19,6 +19,8 @@ import org.chromium.mojo.system.Pair;
import
org.chromium.mojo.system.ResultAnd
;
import
org.chromium.mojo.system.RunLoop
;
import
org.chromium.mojo.system.SharedBufferHandle
;
import
org.chromium.mojo.system.SharedBufferHandle.BufferInformation
;
import
org.chromium.mojo.system.SharedBufferHandle.BufferInformationFlags
;
import
org.chromium.mojo.system.SharedBufferHandle.DuplicateOptions
;
import
org.chromium.mojo.system.SharedBufferHandle.MapFlags
;
import
org.chromium.mojo.system.UntypedHandle
;
...
...
@@ -469,6 +471,17 @@ public class CoreImpl implements Core, AsyncWaiter {
}
}
/**
* @see SharedBufferHandle#getBufferInformation()
*/
BufferInformation
getBufferInformation
(
SharedBufferHandleImpl
handle
)
{
ResultAnd
<
BufferInformation
>
result
=
nativeGetBufferInformation
(
handle
.
getMojoHandle
());
if
(
result
.
getMojoResult
()
!=
MojoResult
.
OK
)
{
throw
new
MojoException
(
result
.
getMojoResult
());
}
return
result
.
getValue
();
}
/**
* @return the mojo handle associated to the given handle, considering invalid handles.
*/
...
...
@@ -565,6 +578,13 @@ public class CoreImpl implements Core, AsyncWaiter {
return
new
ResultAnd
<>(
mojoResult
,
buffer
);
}
@CalledByNative
private
static
ResultAnd
<
BufferInformation
>
newResultAndBufferInformation
(
int
mojoResult
,
int
flags
,
long
bufferSize
)
{
return
new
ResultAnd
<>(
mojoResult
,
new
BufferInformation
(
new
BufferInformationFlags
(
flags
),
bufferSize
));
}
/**
* Trivial alias for Pair<Integer, Integer>. This is needed because our jni generator is unable
* to handle class that contains space.
...
...
@@ -645,4 +665,6 @@ public class CoreImpl implements Core, AsyncWaiter {
private
native
void
nativeCancelAsyncWait
(
long
mId
,
long
dataPtr
);
private
native
int
nativeGetNativeBufferOffset
(
ByteBuffer
buffer
,
int
alignment
);
private
native
ResultAnd
<
BufferInformation
>
nativeGetBufferInformation
(
int
mojoHandle
);
}
mojo/android/system/src/org/chromium/mojo/system/impl/SharedBufferHandleImpl.java
浏览文件 @
989b29a6
...
...
@@ -59,4 +59,11 @@ class SharedBufferHandleImpl extends HandleBase implements SharedBufferHandle {
mCore
.
unmap
(
buffer
);
}
/**
* @see SharedBufferHandle#getBufferInformation()
*/
@Override
public
BufferInformation
getBufferInformation
()
{
return
mCore
.
getBufferInformation
(
this
);
}
}
mojo/application/application_runner_chromium.cc
浏览文件 @
989b29a6
...
...
@@ -7,11 +7,12 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/debug/stack_trace.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "mojo/message_pump/message_pump_mojo.h"
#include "mojo/public/cpp/application/application_delegate.h"
#include "mojo/public/cpp/application/application_impl.h"
#include "mojo/public/cpp/system/handle.h"
#include "mojo/public/cpp/system/message_pipe.h"
namespace
mojo
{
...
...
@@ -23,7 +24,7 @@ void ApplicationImpl::Terminate() {
ApplicationRunnerChromium
::
ApplicationRunnerChromium
(
ApplicationDelegate
*
delegate
)
:
delegate_
(
scoped_ptr
<
ApplicationDelegate
>
(
delegate
)
),
:
delegate_
(
delegate
),
message_loop_type_
(
base
::
MessageLoop
::
TYPE_CUSTOM
),
has_run_
(
false
)
{}
...
...
@@ -50,7 +51,7 @@ MojoResult ApplicationRunnerChromium::Run(
#endif
{
s
coped
_ptr
<
base
::
MessageLoop
>
loop
;
s
td
::
unique
_ptr
<
base
::
MessageLoop
>
loop
;
if
(
message_loop_type_
==
base
::
MessageLoop
::
TYPE_CUSTOM
)
loop
.
reset
(
new
base
::
MessageLoop
(
common
::
MessagePumpMojo
::
Create
()));
else
...
...
mojo/application/application_runner_chromium.h
浏览文件 @
989b29a6
...
...
@@ -5,9 +5,12 @@
#ifndef MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_
#define MOJO_APPLICATION_APPLICATION_RUNNER_CHROMIUM_H_
#include "base/memory/scoped_ptr.h"
#include <memory>
#include "base/message_loop/message_loop.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
@@ -38,7 +41,7 @@ class ApplicationRunnerChromium {
MojoResult
Run
(
MojoHandle
application_request
);
private:
s
coped
_ptr
<
ApplicationDelegate
>
delegate_
;
s
td
::
unique
_ptr
<
ApplicationDelegate
>
delegate_
;
// MessageLoop type. TYPE_CUSTOM is default (MessagePumpMojo will be used as
// the underlying message pump).
...
...
mojo/dart/packages/mojo/lib/mojo/application.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -293,9 +293,9 @@ class _ApplicationRequestQuitParams extends bindings.Struct {
}
}
const
int
_
Application_i
nitializeName
=
0
;
const
int
_
Application_a
cceptConnectionName
=
1
;
const
int
_
Application_r
equestQuitName
=
2
;
const
int
_
applicationMethodI
nitializeName
=
0
;
const
int
_
applicationMethodA
cceptConnectionName
=
1
;
const
int
_
applicationMethodR
equestQuitName
=
2
;
class
_ApplicationServiceDescription
implements
service_describer
.
ServiceDescription
{
dynamic
getTopLevelInterface
([
Function
responseFactory
])
=>
...
...
@@ -363,7 +363,7 @@ class _ApplicationProxyCalls implements Application {
params
.
shell
=
shell
;
params
.
args
=
args
;
params
.
url
=
url
;
_proxyImpl
.
sendMessage
(
params
,
_
Application_i
nitializeName
);
_proxyImpl
.
sendMessage
(
params
,
_
applicationMethodI
nitializeName
);
}
void
acceptConnection
(
String
requestorUrl
,
Object
services
,
Object
exposedServices
,
String
resolvedUrl
)
{
if
(!
_proxyImpl
.
isBound
)
{
...
...
@@ -375,7 +375,7 @@ class _ApplicationProxyCalls implements Application {
params
.
services
=
services
;
params
.
exposedServices
=
exposedServices
;
params
.
resolvedUrl
=
resolvedUrl
;
_proxyImpl
.
sendMessage
(
params
,
_
Application_a
cceptConnectionName
);
_proxyImpl
.
sendMessage
(
params
,
_
applicationMethodA
cceptConnectionName
);
}
void
requestQuit
()
{
if
(!
_proxyImpl
.
isBound
)
{
...
...
@@ -383,7 +383,7 @@ class _ApplicationProxyCalls implements Application {
return
;
}
var
params
=
new
_ApplicationRequestQuitParams
();
_proxyImpl
.
sendMessage
(
params
,
_
Application_r
equestQuitName
);
_proxyImpl
.
sendMessage
(
params
,
_
applicationMethodR
equestQuitName
);
}
}
...
...
@@ -475,17 +475,17 @@ class ApplicationStub extends bindings.Stub {
}
assert
(
_impl
!=
null
);
switch
(
message
.
header
.
type
)
{
case
_
Application_i
nitializeName:
case
_
applicationMethodI
nitializeName:
var
params
=
_ApplicationInitializeParams
.
deserialize
(
message
.
payload
);
_impl
.
initialize
(
params
.
shell
,
params
.
args
,
params
.
url
);
break
;
case
_
Application_a
cceptConnectionName:
case
_
applicationMethodA
cceptConnectionName:
var
params
=
_ApplicationAcceptConnectionParams
.
deserialize
(
message
.
payload
);
_impl
.
acceptConnection
(
params
.
requestorUrl
,
params
.
services
,
params
.
exposedServices
,
params
.
resolvedUrl
);
break
;
case
_
Application_r
equestQuitName:
case
_
applicationMethodR
equestQuitName:
_impl
.
requestQuit
();
break
;
default
:
...
...
mojo/dart/packages/mojo/lib/mojo/application_connector.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -178,8 +178,8 @@ class _ApplicationConnectorDuplicateParams extends bindings.Struct {
}
}
const
int
_
ApplicationConnector_c
onnectToApplicationName
=
0
;
const
int
_
ApplicationConnector_d
uplicateName
=
1
;
const
int
_
applicationConnectorMethodC
onnectToApplicationName
=
0
;
const
int
_
applicationConnectorMethodD
uplicateName
=
1
;
class
_ApplicationConnectorServiceDescription
implements
service_describer
.
ServiceDescription
{
dynamic
getTopLevelInterface
([
Function
responseFactory
])
=>
...
...
@@ -246,7 +246,7 @@ class _ApplicationConnectorProxyCalls implements ApplicationConnector {
params
.
applicationUrl
=
applicationUrl
;
params
.
services
=
services
;
params
.
exposedServices
=
exposedServices
;
_proxyImpl
.
sendMessage
(
params
,
_
ApplicationConnector_c
onnectToApplicationName
);
_proxyImpl
.
sendMessage
(
params
,
_
applicationConnectorMethodC
onnectToApplicationName
);
}
void
duplicate
(
Object
applicationConnectorRequest
)
{
if
(!
_proxyImpl
.
isBound
)
{
...
...
@@ -255,7 +255,7 @@ class _ApplicationConnectorProxyCalls implements ApplicationConnector {
}
var
params
=
new
_ApplicationConnectorDuplicateParams
();
params
.
applicationConnectorRequest
=
applicationConnectorRequest
;
_proxyImpl
.
sendMessage
(
params
,
_
ApplicationConnector_d
uplicateName
);
_proxyImpl
.
sendMessage
(
params
,
_
applicationConnectorMethodD
uplicateName
);
}
}
...
...
@@ -347,12 +347,12 @@ class ApplicationConnectorStub extends bindings.Stub {
}
assert
(
_impl
!=
null
);
switch
(
message
.
header
.
type
)
{
case
_
ApplicationConnector_c
onnectToApplicationName:
case
_
applicationConnectorMethodC
onnectToApplicationName:
var
params
=
_ApplicationConnectorConnectToApplicationParams
.
deserialize
(
message
.
payload
);
_impl
.
connectToApplication
(
params
.
applicationUrl
,
params
.
services
,
params
.
exposedServices
);
break
;
case
_
ApplicationConnector_d
uplicateName:
case
_
applicationConnectorMethodD
uplicateName:
var
params
=
_ApplicationConnectorDuplicateParams
.
deserialize
(
message
.
payload
);
_impl
.
duplicate
(
params
.
applicationConnectorRequest
);
...
...
mojo/dart/packages/mojo/lib/mojo/bindings/types/mojom_files.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -19,7 +19,7 @@ class MojomFile extends bindings.Struct {
List
<
mojom_types_mojom
.
Attribute
>
attributes
=
null
;
List
<
String
>
imports
=
null
;
KeysByType
declaredMojomObjects
=
null
;
List
<
int
>
serializedRuntimeTypeInfo
=
null
;
String
serializedRuntimeTypeInfo
=
null
;
MojomFile
()
:
super
(
kVersions
.
last
.
size
);
...
...
@@ -104,7 +104,7 @@ class MojomFile extends bindings.Struct {
}
if
(
mainDataHeader
.
version
>=
0
)
{
result
.
serializedRuntimeTypeInfo
=
decoder0
.
decode
Uint8Array
(
56
,
bindings
.
kArrayNullable
,
bindings
.
kUnspecifiedArrayLength
);
result
.
serializedRuntimeTypeInfo
=
decoder0
.
decode
String
(
56
,
true
);
}
return
result
;
}
...
...
@@ -168,7 +168,7 @@ class MojomFile extends bindings.Struct {
rethrow
;
}
try
{
encoder0
.
encode
Uint8Array
(
serializedRuntimeTypeInfo
,
56
,
bindings
.
kArrayNullable
,
bindings
.
kUnspecifiedArrayLength
);
encoder0
.
encode
String
(
serializedRuntimeTypeInfo
,
56
,
true
);
}
on
bindings
.
MojoCodecError
catch
(
e
)
{
e
.
message
=
"Error encountered while encoding field "
"serializedRuntimeTypeInfo of struct MojomFile:
$e
"
;
...
...
mojo/dart/packages/mojo/lib/mojo/bindings/types/mojom_types.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -766,12 +766,14 @@ class TypeReference extends bindings.Struct {
class
StructField
extends
bindings
.
Struct
{
static
const
List
<
bindings
.
StructDataHeader
>
kVersions
=
const
[
const
bindings
.
StructDataHeader
(
56
,
0
)
const
bindings
.
StructDataHeader
(
64
,
0
)
];
DeclarationData
declData
=
null
;
Type
type
=
null
;
DefaultFieldValue
defaultValue
=
null
;
int
offset
=
0
;
int
bit
=
0
;
int
minVersion
=
0
;
StructField
()
:
super
(
kVersions
.
last
.
size
);
...
...
@@ -829,6 +831,14 @@ class StructField extends bindings.Struct {
result
.
offset
=
decoder0
.
decodeInt32
(
48
);
}
if
(
mainDataHeader
.
version
>=
0
)
{
result
.
bit
=
decoder0
.
decodeInt8
(
52
);
}
if
(
mainDataHeader
.
version
>=
0
)
{
result
.
minVersion
=
decoder0
.
decodeUint32
(
56
);
}
return
result
;
}
...
...
@@ -862,6 +872,20 @@ class StructField extends bindings.Struct {
"offset of struct StructField:
$e
"
;
rethrow
;
}
try
{
encoder0
.
encodeInt8
(
bit
,
52
);
}
on
bindings
.
MojoCodecError
catch
(
e
)
{
e
.
message
=
"Error encountered while encoding field "
"bit of struct StructField:
$e
"
;
rethrow
;
}
try
{
encoder0
.
encodeUint32
(
minVersion
,
56
);
}
on
bindings
.
MojoCodecError
catch
(
e
)
{
e
.
message
=
"Error encountered while encoding field "
"minVersion of struct StructField:
$e
"
;
rethrow
;
}
}
String
toString
()
{
...
...
@@ -869,7 +893,9 @@ class StructField extends bindings.Struct {
"declData:
$declData
"
", "
"type:
$type
"
", "
"defaultValue:
$defaultValue
"
", "
"offset:
$offset
"
")"
;
"offset:
$offset
"
", "
"bit:
$bit
"
", "
"minVersion:
$minVersion
"
")"
;
}
Map
toJson
()
{
...
...
@@ -878,6 +904,8 @@ class StructField extends bindings.Struct {
map
[
"type"
]
=
type
;
map
[
"defaultValue"
]
=
defaultValue
;
map
[
"offset"
]
=
offset
;
map
[
"bit"
]
=
bit
;
map
[
"minVersion"
]
=
minVersion
;
return
map
;
}
}
...
...
@@ -2887,7 +2915,7 @@ enum TypeTag {
}
class
Type
extends
bindings
.
Union
{
static
final
_tag
_to_i
nt
=
const
{
static
final
_tag
ToI
nt
=
const
{
TypeTag
.
simpleType
:
0
,
TypeTag
.
stringType
:
1
,
TypeTag
.
arrayType
:
2
,
...
...
@@ -2896,7 +2924,7 @@ class Type extends bindings.Union {
TypeTag
.
typeReference
:
5
,
};
static
final
_int
_to_t
ag
=
const
{
static
final
_int
ToT
ag
=
const
{
0
:
TypeTag
.
simpleType
,
1
:
TypeTag
.
stringType
,
2
:
TypeTag
.
arrayType
,
...
...
@@ -2984,7 +3012,7 @@ class Type extends bindings.Union {
Type
result
=
new
Type
();
TypeTag
tag
=
_int
_to_t
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
TypeTag
tag
=
_int
ToT
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
switch
(
tag
)
{
case
TypeTag
.
simpleType
:
...
...
@@ -3029,7 +3057,7 @@ class Type extends bindings.Union {
void
encode
(
bindings
.
Encoder
encoder0
,
int
offset
)
{
encoder0
.
encodeUint32
(
16
,
offset
);
encoder0
.
encodeUint32
(
_tag
_to_i
nt
[
_tag
],
offset
+
4
);
encoder0
.
encodeUint32
(
_tag
ToI
nt
[
_tag
],
offset
+
4
);
switch
(
_tag
)
{
case
TypeTag
.
simpleType
:
encoder0
.
encodeEnum
(
simpleType
,
offset
+
8
);
...
...
@@ -3093,14 +3121,14 @@ enum UserDefinedTypeTag {
}
class
UserDefinedType
extends
bindings
.
Union
{
static
final
_tag
_to_i
nt
=
const
{
static
final
_tag
ToI
nt
=
const
{
UserDefinedTypeTag
.
enumType
:
0
,
UserDefinedTypeTag
.
structType
:
1
,
UserDefinedTypeTag
.
unionType
:
2
,
UserDefinedTypeTag
.
interfaceType
:
3
,
};
static
final
_int
_to_t
ag
=
const
{
static
final
_int
ToT
ag
=
const
{
0
:
UserDefinedTypeTag
.
enumType
,
1
:
UserDefinedTypeTag
.
structType
,
2
:
UserDefinedTypeTag
.
unionType
,
...
...
@@ -3164,7 +3192,7 @@ class UserDefinedType extends bindings.Union {
UserDefinedType
result
=
new
UserDefinedType
();
UserDefinedTypeTag
tag
=
_int
_to_t
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
UserDefinedTypeTag
tag
=
_int
ToT
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
switch
(
tag
)
{
case
UserDefinedTypeTag
.
enumType
:
...
...
@@ -3196,7 +3224,7 @@ class UserDefinedType extends bindings.Union {
void
encode
(
bindings
.
Encoder
encoder0
,
int
offset
)
{
encoder0
.
encodeUint32
(
16
,
offset
);
encoder0
.
encodeUint32
(
_tag
_to_i
nt
[
_tag
],
offset
+
4
);
encoder0
.
encodeUint32
(
_tag
ToI
nt
[
_tag
],
offset
+
4
);
switch
(
_tag
)
{
case
UserDefinedTypeTag
.
enumType
:
encoder0
.
encodeStruct
(
enumType
,
offset
+
8
,
false
);
...
...
@@ -3246,12 +3274,12 @@ enum DefaultFieldValueTag {
}
class
DefaultFieldValue
extends
bindings
.
Union
{
static
final
_tag
_to_i
nt
=
const
{
static
final
_tag
ToI
nt
=
const
{
DefaultFieldValueTag
.
value
:
0
,
DefaultFieldValueTag
.
defaultKeyword
:
1
,
};
static
final
_int
_to_t
ag
=
const
{
static
final
_int
ToT
ag
=
const
{
0
:
DefaultFieldValueTag
.
value
,
1
:
DefaultFieldValueTag
.
defaultKeyword
,
};
...
...
@@ -3291,7 +3319,7 @@ class DefaultFieldValue extends bindings.Union {
DefaultFieldValue
result
=
new
DefaultFieldValue
();
DefaultFieldValueTag
tag
=
_int
_to_t
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
DefaultFieldValueTag
tag
=
_int
ToT
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
switch
(
tag
)
{
case
DefaultFieldValueTag
.
value
:
var
decoder1
=
decoder0
.
decodePointer
(
offset
+
8
,
false
);
...
...
@@ -3312,7 +3340,7 @@ class DefaultFieldValue extends bindings.Union {
void
encode
(
bindings
.
Encoder
encoder0
,
int
offset
)
{
encoder0
.
encodeUint32
(
16
,
offset
);
encoder0
.
encodeUint32
(
_tag
_to_i
nt
[
_tag
],
offset
+
4
);
encoder0
.
encodeUint32
(
_tag
ToI
nt
[
_tag
],
offset
+
4
);
switch
(
_tag
)
{
case
DefaultFieldValueTag
.
value
:
encoder0
.
encodeNestedUnion
(
value
,
offset
+
8
,
false
);
...
...
@@ -3351,13 +3379,13 @@ enum ValueTag {
}
class
Value
extends
bindings
.
Union
{
static
final
_tag
_to_i
nt
=
const
{
static
final
_tag
ToI
nt
=
const
{
ValueTag
.
literalValue
:
0
,
ValueTag
.
userValueReference
:
1
,
ValueTag
.
builtinValue
:
2
,
};
static
final
_int
_to_t
ag
=
const
{
static
final
_int
ToT
ag
=
const
{
0
:
ValueTag
.
literalValue
,
1
:
ValueTag
.
userValueReference
,
2
:
ValueTag
.
builtinValue
,
...
...
@@ -3409,7 +3437,7 @@ class Value extends bindings.Union {
Value
result
=
new
Value
();
ValueTag
tag
=
_int
_to_t
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
ValueTag
tag
=
_int
ToT
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
switch
(
tag
)
{
case
ValueTag
.
literalValue
:
var
decoder1
=
decoder0
.
decodePointer
(
offset
+
8
,
false
);
...
...
@@ -3438,7 +3466,7 @@ class Value extends bindings.Union {
void
encode
(
bindings
.
Encoder
encoder0
,
int
offset
)
{
encoder0
.
encodeUint32
(
16
,
offset
);
encoder0
.
encodeUint32
(
_tag
_to_i
nt
[
_tag
],
offset
+
4
);
encoder0
.
encodeUint32
(
_tag
ToI
nt
[
_tag
],
offset
+
4
);
switch
(
_tag
)
{
case
ValueTag
.
literalValue
:
encoder0
.
encodeNestedUnion
(
literalValue
,
offset
+
8
,
false
);
...
...
@@ -3492,7 +3520,7 @@ enum LiteralValueTag {
}
class
LiteralValue
extends
bindings
.
Union
{
static
final
_tag
_to_i
nt
=
const
{
static
final
_tag
ToI
nt
=
const
{
LiteralValueTag
.
boolValue
:
0
,
LiteralValueTag
.
doubleValue
:
1
,
LiteralValueTag
.
floatValue
:
2
,
...
...
@@ -3507,7 +3535,7 @@ class LiteralValue extends bindings.Union {
LiteralValueTag
.
uint64Value
:
11
,
};
static
final
_int
_to_t
ag
=
const
{
static
final
_int
ToT
ag
=
const
{
0
:
LiteralValueTag
.
boolValue
,
1
:
LiteralValueTag
.
doubleValue
,
2
:
LiteralValueTag
.
floatValue
,
...
...
@@ -3667,7 +3695,7 @@ class LiteralValue extends bindings.Union {
LiteralValue
result
=
new
LiteralValue
();
LiteralValueTag
tag
=
_int
_to_t
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
LiteralValueTag
tag
=
_int
ToT
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
switch
(
tag
)
{
case
LiteralValueTag
.
boolValue
:
...
...
@@ -3727,7 +3755,7 @@ class LiteralValue extends bindings.Union {
void
encode
(
bindings
.
Encoder
encoder0
,
int
offset
)
{
encoder0
.
encodeUint32
(
16
,
offset
);
encoder0
.
encodeUint32
(
_tag
_to_i
nt
[
_tag
],
offset
+
4
);
encoder0
.
encodeUint32
(
_tag
ToI
nt
[
_tag
],
offset
+
4
);
switch
(
_tag
)
{
case
LiteralValueTag
.
boolValue
:
encoder0
.
encodeBool
(
boolValue
,
offset
+
8
,
0
);
...
...
@@ -3825,12 +3853,12 @@ enum UserDefinedValueTag {
}
class
UserDefinedValue
extends
bindings
.
Union
{
static
final
_tag
_to_i
nt
=
const
{
static
final
_tag
ToI
nt
=
const
{
UserDefinedValueTag
.
enumValue
:
0
,
UserDefinedValueTag
.
declaredConstant
:
1
,
};
static
final
_int
_to_t
ag
=
const
{
static
final
_int
ToT
ag
=
const
{
0
:
UserDefinedValueTag
.
enumValue
,
1
:
UserDefinedValueTag
.
declaredConstant
,
};
...
...
@@ -3870,7 +3898,7 @@ class UserDefinedValue extends bindings.Union {
UserDefinedValue
result
=
new
UserDefinedValue
();
UserDefinedValueTag
tag
=
_int
_to_t
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
UserDefinedValueTag
tag
=
_int
ToT
ag
[
decoder0
.
decodeUint32
(
offset
+
4
)];
switch
(
tag
)
{
case
UserDefinedValueTag
.
enumValue
:
...
...
@@ -3892,7 +3920,7 @@ class UserDefinedValue extends bindings.Union {
void
encode
(
bindings
.
Encoder
encoder0
,
int
offset
)
{
encoder0
.
encodeUint32
(
16
,
offset
);
encoder0
.
encodeUint32
(
_tag
_to_i
nt
[
_tag
],
offset
+
4
);
encoder0
.
encodeUint32
(
_tag
ToI
nt
[
_tag
],
offset
+
4
);
switch
(
_tag
)
{
case
UserDefinedValueTag
.
enumValue
:
encoder0
.
encodeStruct
(
enumValue
,
offset
+
8
,
false
);
...
...
mojo/dart/packages/mojo/lib/mojo/bindings/types/service_describer.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -556,7 +556,7 @@ class ServiceDescriptionGetAllTypeDefinitionsResponseParams extends bindings.Str
}
}
const
int
_
ServiceDescriber_d
escribeServiceName
=
0
;
const
int
_
serviceDescriberMethodD
escribeServiceName
=
0
;
class
_ServiceDescriberServiceDescription
implements
ServiceDescription
{
dynamic
getTopLevelInterface
([
Function
responseFactory
])
=>
...
...
@@ -621,7 +621,7 @@ class _ServiceDescriberProxyCalls implements ServiceDescriber {
var
params
=
new
_ServiceDescriberDescribeServiceParams
();
params
.
interfaceName
=
interfaceName
;
params
.
descriptionRequest
=
descriptionRequest
;
_proxyImpl
.
sendMessage
(
params
,
_
ServiceDescriber_d
escribeServiceName
);
_proxyImpl
.
sendMessage
(
params
,
_
serviceDescriberMethodD
escribeServiceName
);
}
}
...
...
@@ -713,7 +713,7 @@ class ServiceDescriberStub extends bindings.Stub {
}
assert
(
_impl
!=
null
);
switch
(
message
.
header
.
type
)
{
case
_
ServiceDescriber_d
escribeServiceName:
case
_
serviceDescriberMethodD
escribeServiceName:
var
params
=
_ServiceDescriberDescribeServiceParams
.
deserialize
(
message
.
payload
);
_impl
.
describeService
(
params
.
interfaceName
,
params
.
descriptionRequest
);
...
...
@@ -747,9 +747,9 @@ class ServiceDescriberStub extends bindings.Stub {
}
}
const
int
_
ServiceDescription_g
etTopLevelInterfaceName
=
0
;
const
int
_
ServiceDescription_g
etTypeDefinitionName
=
1
;
const
int
_
ServiceDescription_g
etAllTypeDefinitionsName
=
2
;
const
int
_
serviceDescriptionMethodG
etTopLevelInterfaceName
=
0
;
const
int
_
serviceDescriptionMethodG
etTypeDefinitionName
=
1
;
const
int
_
serviceDescriptionMethodG
etAllTypeDefinitionsName
=
2
;
class
_ServiceDescriptionServiceDescription
implements
ServiceDescription
{
dynamic
getTopLevelInterface
([
Function
responseFactory
])
=>
...
...
@@ -790,7 +790,7 @@ class _ServiceDescriptionProxyImpl extends bindings.Proxy {
void
handleResponse
(
bindings
.
ServiceMessage
message
)
{
switch
(
message
.
header
.
type
)
{
case
_
ServiceDescription_g
etTopLevelInterfaceName:
case
_
serviceDescriptionMethodG
etTopLevelInterfaceName:
var
r
=
ServiceDescriptionGetTopLevelInterfaceResponseParams
.
deserialize
(
message
.
payload
);
if
(!
message
.
header
.
hasRequestId
)
{
...
...
@@ -810,7 +810,7 @@ class _ServiceDescriptionProxyImpl extends bindings.Proxy {
}
c
.
complete
(
r
);
break
;
case
_
ServiceDescription_g
etTypeDefinitionName:
case
_
serviceDescriptionMethodG
etTypeDefinitionName:
var
r
=
ServiceDescriptionGetTypeDefinitionResponseParams
.
deserialize
(
message
.
payload
);
if
(!
message
.
header
.
hasRequestId
)
{
...
...
@@ -830,7 +830,7 @@ class _ServiceDescriptionProxyImpl extends bindings.Proxy {
}
c
.
complete
(
r
);
break
;
case
_
ServiceDescription_g
etAllTypeDefinitionsName:
case
_
serviceDescriptionMethodG
etAllTypeDefinitionsName:
var
r
=
ServiceDescriptionGetAllTypeDefinitionsResponseParams
.
deserialize
(
message
.
payload
);
if
(!
message
.
header
.
hasRequestId
)
{
...
...
@@ -872,7 +872,7 @@ class _ServiceDescriptionProxyCalls implements ServiceDescription {
var
params
=
new
_ServiceDescriptionGetTopLevelInterfaceParams
();
return
_proxyImpl
.
sendMessageWithRequestId
(
params
,
_
ServiceDescription_g
etTopLevelInterfaceName
,
_
serviceDescriptionMethodG
etTopLevelInterfaceName
,
-
1
,
bindings
.
MessageHeader
.
kMessageExpectsResponse
);
}
...
...
@@ -881,7 +881,7 @@ class _ServiceDescriptionProxyCalls implements ServiceDescription {
params
.
typeKey
=
typeKey
;
return
_proxyImpl
.
sendMessageWithRequestId
(
params
,
_
ServiceDescription_g
etTypeDefinitionName
,
_
serviceDescriptionMethodG
etTypeDefinitionName
,
-
1
,
bindings
.
MessageHeader
.
kMessageExpectsResponse
);
}
...
...
@@ -889,7 +889,7 @@ class _ServiceDescriptionProxyCalls implements ServiceDescription {
var
params
=
new
_ServiceDescriptionGetAllTypeDefinitionsParams
();
return
_proxyImpl
.
sendMessageWithRequestId
(
params
,
_
ServiceDescription_g
etAllTypeDefinitionsName
,
_
serviceDescriptionMethodG
etAllTypeDefinitionsName
,
-
1
,
bindings
.
MessageHeader
.
kMessageExpectsResponse
);
}
...
...
@@ -974,20 +974,20 @@ class ServiceDescriptionStub extends bindings.Stub {
}
ServiceDescriptionGetTopLevelInterfaceResponseParams
_
S
erviceDescriptionGetTopLevelInterfaceResponseParamsFactory
(
mojom_types_mojom
.
MojomInterface
mojomInterface
)
{
var
mojo_factory_
result
=
new
ServiceDescriptionGetTopLevelInterfaceResponseParams
();
mojo_factory_
result
.
mojomInterface
=
mojomInterface
;
return
mojo_factory_
result
;
ServiceDescriptionGetTopLevelInterfaceResponseParams
_
s
erviceDescriptionGetTopLevelInterfaceResponseParamsFactory
(
mojom_types_mojom
.
MojomInterface
mojomInterface
)
{
var
result
=
new
ServiceDescriptionGetTopLevelInterfaceResponseParams
();
result
.
mojomInterface
=
mojomInterface
;
return
result
;
}
ServiceDescriptionGetTypeDefinitionResponseParams
_
S
erviceDescriptionGetTypeDefinitionResponseParamsFactory
(
mojom_types_mojom
.
UserDefinedType
type
)
{
var
mojo_factory_
result
=
new
ServiceDescriptionGetTypeDefinitionResponseParams
();
mojo_factory_
result
.
type
=
type
;
return
mojo_factory_
result
;
ServiceDescriptionGetTypeDefinitionResponseParams
_
s
erviceDescriptionGetTypeDefinitionResponseParamsFactory
(
mojom_types_mojom
.
UserDefinedType
type
)
{
var
result
=
new
ServiceDescriptionGetTypeDefinitionResponseParams
();
result
.
type
=
type
;
return
result
;
}
ServiceDescriptionGetAllTypeDefinitionsResponseParams
_
S
erviceDescriptionGetAllTypeDefinitionsResponseParamsFactory
(
Map
<
String
,
mojom_types_mojom
.
UserDefinedType
>
definitions
)
{
var
mojo_factory_
result
=
new
ServiceDescriptionGetAllTypeDefinitionsResponseParams
();
mojo_factory_
result
.
definitions
=
definitions
;
return
mojo_factory_
result
;
ServiceDescriptionGetAllTypeDefinitionsResponseParams
_
s
erviceDescriptionGetAllTypeDefinitionsResponseParamsFactory
(
Map
<
String
,
mojom_types_mojom
.
UserDefinedType
>
definitions
)
{
var
result
=
new
ServiceDescriptionGetAllTypeDefinitionsResponseParams
();
result
.
definitions
=
definitions
;
return
result
;
}
dynamic
handleMessage
(
bindings
.
ServiceMessage
message
)
{
...
...
@@ -998,14 +998,14 @@ class ServiceDescriptionStub extends bindings.Stub {
}
assert
(
_impl
!=
null
);
switch
(
message
.
header
.
type
)
{
case
_
ServiceDescription_g
etTopLevelInterfaceName:
var
response
=
_impl
.
getTopLevelInterface
(
_
S
erviceDescriptionGetTopLevelInterfaceResponseParamsFactory
);
case
_
serviceDescriptionMethodG
etTopLevelInterfaceName:
var
response
=
_impl
.
getTopLevelInterface
(
_
s
erviceDescriptionGetTopLevelInterfaceResponseParamsFactory
);
if
(
response
is
Future
)
{
return
response
.
then
((
response
)
{
if
(
response
!=
null
)
{
return
buildResponseWithId
(
response
,
_
ServiceDescription_g
etTopLevelInterfaceName
,
_
serviceDescriptionMethodG
etTopLevelInterfaceName
,
message
.
header
.
requestId
,
bindings
.
MessageHeader
.
kMessageIsResponse
);
}
...
...
@@ -1013,21 +1013,21 @@ class ServiceDescriptionStub extends bindings.Stub {
}
else
if
(
response
!=
null
)
{
return
buildResponseWithId
(
response
,
_
ServiceDescription_g
etTopLevelInterfaceName
,
_
serviceDescriptionMethodG
etTopLevelInterfaceName
,
message
.
header
.
requestId
,
bindings
.
MessageHeader
.
kMessageIsResponse
);
}
break
;
case
_
ServiceDescription_g
etTypeDefinitionName:
case
_
serviceDescriptionMethodG
etTypeDefinitionName:
var
params
=
_ServiceDescriptionGetTypeDefinitionParams
.
deserialize
(
message
.
payload
);
var
response
=
_impl
.
getTypeDefinition
(
params
.
typeKey
,
_
S
erviceDescriptionGetTypeDefinitionResponseParamsFactory
);
var
response
=
_impl
.
getTypeDefinition
(
params
.
typeKey
,
_
s
erviceDescriptionGetTypeDefinitionResponseParamsFactory
);
if
(
response
is
Future
)
{
return
response
.
then
((
response
)
{
if
(
response
!=
null
)
{
return
buildResponseWithId
(
response
,
_
ServiceDescription_g
etTypeDefinitionName
,
_
serviceDescriptionMethodG
etTypeDefinitionName
,
message
.
header
.
requestId
,
bindings
.
MessageHeader
.
kMessageIsResponse
);
}
...
...
@@ -1035,19 +1035,19 @@ class ServiceDescriptionStub extends bindings.Stub {
}
else
if
(
response
!=
null
)
{
return
buildResponseWithId
(
response
,
_
ServiceDescription_g
etTypeDefinitionName
,
_
serviceDescriptionMethodG
etTypeDefinitionName
,
message
.
header
.
requestId
,
bindings
.
MessageHeader
.
kMessageIsResponse
);
}
break
;
case
_
ServiceDescription_g
etAllTypeDefinitionsName:
var
response
=
_impl
.
getAllTypeDefinitions
(
_
S
erviceDescriptionGetAllTypeDefinitionsResponseParamsFactory
);
case
_
serviceDescriptionMethodG
etAllTypeDefinitionsName:
var
response
=
_impl
.
getAllTypeDefinitions
(
_
s
erviceDescriptionGetAllTypeDefinitionsResponseParamsFactory
);
if
(
response
is
Future
)
{
return
response
.
then
((
response
)
{
if
(
response
!=
null
)
{
return
buildResponseWithId
(
response
,
_
ServiceDescription_g
etAllTypeDefinitionsName
,
_
serviceDescriptionMethodG
etAllTypeDefinitionsName
,
message
.
header
.
requestId
,
bindings
.
MessageHeader
.
kMessageIsResponse
);
}
...
...
@@ -1055,7 +1055,7 @@ class ServiceDescriptionStub extends bindings.Stub {
}
else
if
(
response
!=
null
)
{
return
buildResponseWithId
(
response
,
_
ServiceDescription_g
etAllTypeDefinitionsName
,
_
serviceDescriptionMethodG
etAllTypeDefinitionsName
,
message
.
header
.
requestId
,
bindings
.
MessageHeader
.
kMessageIsResponse
);
}
...
...
mojo/dart/packages/mojo/lib/mojo/service_provider.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -93,7 +93,7 @@ class _ServiceProviderConnectToServiceParams extends bindings.Struct {
}
}
const
int
_
ServiceProvider_c
onnectToServiceName
=
0
;
const
int
_
serviceProviderMethodC
onnectToServiceName
=
0
;
class
_ServiceProviderServiceDescription
implements
service_describer
.
ServiceDescription
{
dynamic
getTopLevelInterface
([
Function
responseFactory
])
=>
...
...
@@ -158,7 +158,7 @@ class _ServiceProviderProxyCalls implements ServiceProvider {
var
params
=
new
_ServiceProviderConnectToServiceParams
();
params
.
interfaceName
=
interfaceName
;
params
.
pipe
=
pipe
;
_proxyImpl
.
sendMessage
(
params
,
_
ServiceProvider_c
onnectToServiceName
);
_proxyImpl
.
sendMessage
(
params
,
_
serviceProviderMethodC
onnectToServiceName
);
}
}
...
...
@@ -250,7 +250,7 @@ class ServiceProviderStub extends bindings.Stub {
}
assert
(
_impl
!=
null
);
switch
(
message
.
header
.
type
)
{
case
_
ServiceProvider_c
onnectToServiceName:
case
_
serviceProviderMethodC
onnectToServiceName:
var
params
=
_ServiceProviderConnectToServiceParams
.
deserialize
(
message
.
payload
);
_impl
.
connectToService
(
params
.
interfaceName
,
params
.
pipe
);
...
...
mojo/dart/packages/mojo/lib/mojo/shell.mojom.dart
浏览文件 @
989b29a6
...
...
@@ -179,8 +179,8 @@ class _ShellCreateApplicationConnectorParams extends bindings.Struct {
}
}
const
int
_
Shell_c
onnectToApplicationName
=
0
;
const
int
_
Shell_c
reateApplicationConnectorName
=
1
;
const
int
_
shellMethodC
onnectToApplicationName
=
0
;
const
int
_
shellMethodC
reateApplicationConnectorName
=
1
;
class
_ShellServiceDescription
implements
service_describer
.
ServiceDescription
{
dynamic
getTopLevelInterface
([
Function
responseFactory
])
=>
...
...
@@ -247,7 +247,7 @@ class _ShellProxyCalls implements Shell {
params
.
applicationUrl
=
applicationUrl
;
params
.
services
=
services
;
params
.
exposedServices
=
exposedServices
;
_proxyImpl
.
sendMessage
(
params
,
_
Shell_c
onnectToApplicationName
);
_proxyImpl
.
sendMessage
(
params
,
_
shellMethodC
onnectToApplicationName
);
}
void
createApplicationConnector
(
Object
applicationConnectorRequest
)
{
if
(!
_proxyImpl
.
isBound
)
{
...
...
@@ -256,7 +256,7 @@ class _ShellProxyCalls implements Shell {
}
var
params
=
new
_ShellCreateApplicationConnectorParams
();
params
.
applicationConnectorRequest
=
applicationConnectorRequest
;
_proxyImpl
.
sendMessage
(
params
,
_
Shell_c
reateApplicationConnectorName
);
_proxyImpl
.
sendMessage
(
params
,
_
shellMethodC
reateApplicationConnectorName
);
}
}
...
...
@@ -348,12 +348,12 @@ class ShellStub extends bindings.Stub {
}
assert
(
_impl
!=
null
);
switch
(
message
.
header
.
type
)
{
case
_
Shell_c
onnectToApplicationName:
case
_
shellMethodC
onnectToApplicationName:
var
params
=
_ShellConnectToApplicationParams
.
deserialize
(
message
.
payload
);
_impl
.
connectToApplication
(
params
.
applicationUrl
,
params
.
services
,
params
.
exposedServices
);
break
;
case
_
Shell_c
reateApplicationConnectorName:
case
_
shellMethodC
reateApplicationConnectorName:
var
params
=
_ShellCreateApplicationConnectorParams
.
deserialize
(
message
.
payload
);
_impl
.
createApplicationConnector
(
params
.
applicationConnectorRequest
);
...
...
mojo/dart/packages/mojo/lib/src/buffer.dart
浏览文件 @
989b29a6
...
...
@@ -4,6 +4,14 @@
part of
core
;
class
MojoSharedBufferInformation
{
final
int
flags
;
final
int
sizeInBytes
;
MojoSharedBufferInformation
(
this
.
flags
,
this
.
sizeInBytes
);
}
class
MojoSharedBuffer
{
static
const
int
createFlagNone
=
0
;
static
const
int
duplicateFlagNone
=
0
;
...
...
@@ -46,6 +54,23 @@ class MojoSharedBuffer {
return
dupe
;
}
MojoSharedBufferInformation
get
information
{
if
(
handle
==
null
)
{
_status
=
MojoResult
.
kInvalidArgument
;
return
null
;
}
List
result
=
MojoSharedBufferNatives
.
GetInformation
(
handle
.
h
);
if
(
result
[
0
]
!=
MojoResult
.
kOk
)
{
_status
=
result
[
0
];
return
null
;
}
return
new
MojoSharedBufferInformation
(
result
[
1
],
result
[
2
]);
}
int
close
()
{
if
(
handle
==
null
)
{
_status
=
MojoResult
.
kInvalidArgument
;
...
...
mojo/dart/packages/mojo/sdk_ext/src/natives.dart
浏览文件 @
989b29a6
...
...
@@ -540,4 +540,17 @@ class MojoSharedBufferNatives {
/// set to [MojoSharedBuffer.mapFlagNone] (equal to 0).
static
List
Map
(
int
bufferHandleToken
,
int
offset
,
int
numBytes
,
int
flags
)
native
"MojoSharedBuffer_Map"
;
/// Returns information about [bufferHandleToken].
///
/// Returns a list of exactly 3 elements:
/// 1. The result integer, encoded as specified in [MojoResult]. In
/// particular, [MojoResult.kOk] signals a successful operation.
/// 2. The flags of the buffer (currently unused).
/// 3. The size of the buffer (in bytes).
///
/// The [bufferHandleToken] must be a handle created by [Create].
static
List
GetInformation
(
int
bufferHandleToken
)
native
"MojoSharedBuffer_GetInformation"
;
}
mojo/data_pipe_utils/data_pipe_drainer.h
浏览文件 @
989b29a6
...
...
@@ -5,9 +5,10 @@
#ifndef MOJO_DATA_PIPE_UTILS_DATA_PIPE_DRAINER_H_
#define MOJO_DATA_PIPE_UTILS_DATA_PIPE_DRAINER_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "mojo/message_pump/handle_watcher.h"
#include "mojo/public/cpp/system/
cor
e.h"
#include "mojo/public/cpp/system/
data_pip
e.h"
namespace
mojo
{
namespace
common
{
...
...
mojo/data_pipe_utils/data_pipe_utils.cc
浏览文件 @
989b29a6
...
...
@@ -11,6 +11,7 @@
#include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event.h"
#include "mojo/data_pipe_utils/data_pipe_utils_internal.h"
#include "mojo/public/cpp/system/wait.h"
namespace
mojo
{
namespace
common
{
...
...
@@ -111,5 +112,18 @@ bool BlockingCopyFromString(const std::string& source,
}
}
ScopedDataPipeConsumerHandle
WriteStringToConsumerHandle
(
const
std
::
string
&
source
)
{
TRACE_EVENT0
(
"data_pipe_utils"
,
"WriteStringToConsumerHandle"
);
static
const
size_t
max_buffer_size
=
2
*
1024
*
1024
;
// 2MB
CHECK_LE
(
static_cast
<
uint32_t
>
(
source
.
size
()),
max_buffer_size
);
MojoCreateDataPipeOptions
options
=
{
sizeof
(
MojoCreateDataPipeOptions
),
MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE
,
1
,
source
.
size
()};
DataPipe
pipe
(
options
);
BlockingCopyFromString
(
source
,
pipe
.
producer_handle
.
Pass
());
return
pipe
.
consumer_handle
.
Pass
();
}
}
// namespace common
}
// namespace mojo
mojo/data_pipe_utils/data_pipe_utils.h
浏览文件 @
989b29a6
...
...
@@ -11,7 +11,7 @@
#include "base/callback_forward.h"
#include "base/files/scoped_file.h"
#include "base/threading/platform_thread.h"
#include "mojo/public/cpp/system/
cor
e.h"
#include "mojo/public/cpp/system/
data_pip
e.h"
namespace
base
{
class
FilePath
;
...
...
@@ -55,6 +55,11 @@ base::ScopedFILE BlockingCopyToTempFile(ScopedDataPipeConsumerHandle source);
// Returns true on success, false on failure.
bool
BlockingCopyToFile
(
ScopedDataPipeConsumerHandle
source
,
FILE
*
fp
);
// Copies the string |contents| to a temporary data pipe and returns the
// consumer handle.
ScopedDataPipeConsumerHandle
WriteStringToConsumerHandle
(
const
std
::
string
&
source
);
}
// namespace common
}
// namespace mojo
...
...
mojo/data_pipe_utils/data_pipe_utils_internal.h
浏览文件 @
989b29a6
...
...
@@ -6,7 +6,7 @@
#define MOJO_DATA_PIPE_UTILS_DATA_PIPE_UTILS_INTERNAL_H_
#include "base/callback_forward.h"
#include "mojo/public/cpp/system/
cor
e.h"
#include "mojo/public/cpp/system/
data_pip
e.h"
namespace
mojo
{
namespace
common
{
...
...
mojo/edk/embedder/embedder.cc
浏览文件 @
989b29a6
...
...
@@ -6,12 +6,13 @@
#include "base/logging.h"
#include "mojo/edk/embedder/embedder_internal.h"
//#include "mojo/edk/embedder/platform_support.h"
#include "mojo/edk/system/configuration.h"
#include "mojo/edk/system/core.h"
#include "mojo/edk/system/platform_handle_dispatcher.h"
#include "mojo/edk/util/ref_ptr.h"
using
mojo
::
platform
::
ScopedPlatformHandle
;
using
mojo
::
util
::
RefPtr
;
namespace
mojo
{
namespace
embedder
{
...
...
@@ -69,10 +70,11 @@ MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
DCHECK
(
platform_handle
);
DCHECK
(
internal
::
g_core
);
auto
dispatcher
=
internal
::
g_core
->
GetDispatcher
(
platform_handle_wrapper_handle
);
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
system
::
Dispatcher
>
dispatcher
;
MojoResult
result
=
internal
::
g_core
->
GetDispatcher
(
platform_handle_wrapper_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
if
(
dispatcher
->
GetType
()
!=
system
::
Dispatcher
::
Type
::
PLATFORM_HANDLE
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
...
...
mojo/edk/embedder/embedder.h
浏览文件 @
989b29a6
...
...
@@ -9,7 +9,8 @@
#include <memory>
#include "mojo/edk/platform/scoped_platform_handle.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/result.h"
namespace
mojo
{
...
...
mojo/edk/embedder/embedder_unittest.cc
浏览文件 @
989b29a6
...
...
@@ -12,7 +12,8 @@
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/edk/util/waitable_event.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/cpp/system/handle.h"
#include "mojo/public/cpp/system/macros.h"
#include "mojo/public/cpp/system/message_pipe.h"
...
...
mojo/edk/embedder/entrypoints.cc
浏览文件 @
989b29a6
...
...
@@ -6,8 +6,10 @@
#include "mojo/edk/system/core.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/
functions
.h"
#include "mojo/public/c/system/
handle
.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/c/system/wait.h"
using
mojo
::
embedder
::
internal
::
g_core
;
using
mojo
::
system
::
MakeUserPointer
;
...
...
@@ -24,9 +26,9 @@ MojoResult MojoClose(MojoHandle handle) {
}
MojoResult
MojoWait
(
MojoHandle
handle
,
MojoHandleSignals
signals
,
MojoDeadline
deadline
,
MojoHandleSignalsState
*
signals_state
)
{
MojoHandleSignals
signals
,
MojoDeadline
deadline
,
MojoHandleSignalsState
*
signals_state
)
{
return
g_core
->
Wait
(
handle
,
signals
,
deadline
,
MakeUserPointer
(
signals_state
));
}
...
...
mojo/edk/embedder/multiprocess_embedder_unittest.cc
浏览文件 @
989b29a6
...
...
@@ -19,11 +19,13 @@
#include "mojo/edk/util/command_line.h"
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/edk/util/waitable_event.h"
#include "mojo/public/c/system/functions.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/c/system/wait.h"
#include "mojo/public/cpp/system/handle.h"
#include "mojo/public/cpp/system/macros.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/public/cpp/system/wait.h"
#include "testing/gtest/include/gtest/gtest.h"
using
mojo
::
platform
::
PlatformHandleWatcher
;
...
...
mojo/edk/embedder/system_impl_private_entrypoints.cc
浏览文件 @
989b29a6
...
...
@@ -9,8 +9,11 @@
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/
functions
.h"
#include "mojo/public/c/system/
handle
.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/c/system/wait.h"
#include "mojo/public/platform/native/system_impl_private.h"
using
mojo
::
embedder
::
internal
::
g_core
;
...
...
mojo/edk/platform/test_stopwatch.h
浏览文件 @
989b29a6
...
...
@@ -7,7 +7,7 @@
#ifndef MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_
#define MOJO_EDK_PLATFORM_TEST_STOPWATCH_H_
#include "mojo/public/c/system/t
ypes
.h"
#include "mojo/public/c/system/t
ime
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/platform/thread_utils.h
浏览文件 @
989b29a6
...
...
@@ -5,7 +5,7 @@
#ifndef MOJO_EDK_PLATFORM_THREAD_UTILS_H_
#define MOJO_EDK_PLATFORM_THREAD_UTILS_H_
#include "mojo/public/c/system/t
ypes
.h"
#include "mojo/public/c/system/t
ime
.h"
namespace
mojo
{
namespace
platform
{
...
...
mojo/edk/platform/time_ticks.h
浏览文件 @
989b29a6
...
...
@@ -5,7 +5,7 @@
#ifndef MOJO_EDK_PLATFORM_TIME_TICKS_H_
#define MOJO_EDK_PLATFORM_TIME_TICKS_H_
#include "mojo/public/c/system/t
ypes
.h"
#include "mojo/public/c/system/t
ime
.h"
namespace
mojo
{
namespace
platform
{
...
...
mojo/edk/system/async_waiter.h
浏览文件 @
989b29a6
...
...
@@ -8,7 +8,7 @@
#include <functional>
#include "mojo/edk/system/awakable.h"
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/awakable.h
浏览文件 @
989b29a6
...
...
@@ -7,7 +7,7 @@
#include <stdint.h>
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
namespace
mojo
{
namespace
system
{
...
...
mojo/edk/system/awakable_list.h
浏览文件 @
989b29a6
...
...
@@ -9,7 +9,7 @@
#include <vector>
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
handle
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/channel.h
浏览文件 @
989b29a6
...
...
@@ -22,7 +22,6 @@
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/edk/util/thread_checker.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/core.cc
浏览文件 @
989b29a6
...
...
@@ -96,12 +96,13 @@ MojoHandle Core::AddDispatcher(Dispatcher* dispatcher) {
return
handle_table_
.
AddDispatcher
(
dispatcher
);
}
RefPtr
<
Dispatcher
>
Core
::
GetDispatcher
(
MojoHandle
handle
)
{
MojoResult
Core
::
GetDispatcher
(
MojoHandle
handle
,
RefPtr
<
Dispatcher
>*
dispatcher
)
{
if
(
handle
==
MOJO_HANDLE_INVALID
)
return
nullptr
;
return
MOJO_RESULT_INVALID_ARGUMENT
;
MutexLocker
locker
(
&
handle_table_mutex_
);
return
RefPtr
<
Dispatcher
>
(
handle_table_
.
GetDispatcher
(
handle
)
);
return
handle_table_
.
GetDispatcher
(
handle
,
dispatcher
);
}
MojoResult
Core
::
GetAndRemoveDispatcher
(
MojoHandle
handle
,
...
...
@@ -116,14 +117,16 @@ MojoResult Core::GetAndRemoveDispatcher(MojoHandle handle,
MojoResult
Core
::
AsyncWait
(
MojoHandle
handle
,
MojoHandleSignals
signals
,
const
std
::
function
<
void
(
MojoResult
)
>&
callback
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
handle
));
DCHECK
(
dispatcher
);
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
std
::
unique_ptr
<
AsyncWaiter
>
waiter
(
new
AsyncWaiter
(
callback
));
MojoResult
rv
=
dispatcher
->
AddAwakable
(
waiter
.
get
(),
signals
,
0
,
nullptr
);
if
(
r
v
==
MOJO_RESULT_OK
)
result
=
dispatcher
->
AddAwakable
(
waiter
.
get
(),
signals
,
0
,
nullptr
);
if
(
r
esult
==
MOJO_RESULT_OK
)
ignore_result
(
waiter
.
release
());
return
r
v
;
return
r
esult
;
}
MojoTimeTicks
Core
::
GetTimeTicksNow
()
{
...
...
@@ -156,11 +159,11 @@ MojoResult Core::Wait(MojoHandle handle,
UserPointer
<
MojoHandleSignalsState
>
signals_state
)
{
uint32_t
unused
=
static_cast
<
uint32_t
>
(
-
1
);
HandleSignalsState
hss
;
MojoResult
r
v
=
WaitManyInternal
(
&
handle
,
&
signals
,
1
,
deadline
,
&
unused
,
signals_state
.
IsNull
()
?
nullptr
:
&
hss
);
if
(
r
v
!=
MOJO_RESULT_INVALID_ARGUMENT
&&
!
signals_state
.
IsNull
())
MojoResult
r
esult
=
WaitManyInternal
(
&
handle
,
&
signals
,
1
,
deadline
,
&
unused
,
signals_state
.
IsNull
()
?
nullptr
:
&
hss
);
if
(
r
esult
!=
MOJO_RESULT_INVALID_ARGUMENT
&&
!
signals_state
.
IsNull
())
signals_state
.
Put
(
hss
);
return
r
v
;
return
r
esult
;
}
MojoResult
Core
::
WaitMany
(
UserPointer
<
const
MojoHandle
>
handles
,
...
...
@@ -178,26 +181,26 @@ MojoResult Core::WaitMany(UserPointer<const MojoHandle> handles,
UserPointer
<
const
MojoHandleSignals
>::
Reader
signals_reader
(
signals
,
num_handles
);
uint32_t
index
=
static_cast
<
uint32_t
>
(
-
1
);
MojoResult
r
v
;
MojoResult
r
esult
;
if
(
signals_states
.
IsNull
())
{
r
v
=
WaitManyInternal
(
handles_reader
.
GetPointer
(),
signals_reader
.
GetPointer
(),
num_handles
,
deadline
,
&
index
,
nullptr
);
r
esult
=
WaitManyInternal
(
handles_reader
.
GetPointer
(),
signals_reader
.
GetPointer
(),
num_handles
,
deadline
,
&
index
,
nullptr
);
}
else
{
UserPointer
<
MojoHandleSignalsState
>::
Writer
signals_states_writer
(
signals_states
,
num_handles
);
// Note: The |reinterpret_cast| is safe, since |HandleSignalsState| is a
// subclass of |MojoHandleSignalsState| that doesn't add any data members.
r
v
=
WaitManyInternal
(
handles_reader
.
GetPointer
(),
signals_reader
.
GetPointer
(),
num_handles
,
deadline
,
&
index
,
reinterpret_cast
<
HandleSignalsState
*>
(
signals_states_writer
.
GetPointer
()));
if
(
r
v
!=
MOJO_RESULT_INVALID_ARGUMENT
)
r
esult
=
WaitManyInternal
(
handles_reader
.
GetPointer
(),
signals_reader
.
GetPointer
(),
num_handles
,
deadline
,
&
index
,
reinterpret_cast
<
HandleSignalsState
*>
(
signals_states_writer
.
GetPointer
()));
if
(
r
esult
!=
MOJO_RESULT_INVALID_ARGUMENT
)
signals_states_writer
.
Commit
();
}
if
(
index
!=
static_cast
<
uint32_t
>
(
-
1
)
&&
!
result_index
.
IsNull
())
result_index
.
Put
(
index
);
return
r
v
;
return
r
esult
;
}
MojoResult
Core
::
CreateMessagePipe
(
...
...
@@ -249,9 +252,10 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
UserPointer
<
const
MojoHandle
>
handles
,
uint32_t
num_handles
,
MojoWriteMessageFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
message_pipe_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
message_pipe_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
// Easy case: not sending any handles.
if
(
num_handles
==
0
)
...
...
@@ -289,8 +293,7 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
return
result
;
}
MojoResult
rv
=
dispatcher
->
WriteMessage
(
bytes
,
num_bytes
,
&
transports
,
flags
);
result
=
dispatcher
->
WriteMessage
(
bytes
,
num_bytes
,
&
transports
,
flags
);
// We need to release the dispatcher locks before we take the handle table
// lock.
...
...
@@ -299,7 +302,7 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
{
MutexLocker
locker
(
&
handle_table_mutex_
);
if
(
r
v
==
MOJO_RESULT_OK
)
{
if
(
r
esult
==
MOJO_RESULT_OK
)
{
handle_table_
.
RemoveBusyHandles
(
handles_reader
.
GetPointer
(),
num_handles
);
}
else
{
handle_table_
.
RestoreBusyHandles
(
handles_reader
.
GetPointer
(),
...
...
@@ -307,7 +310,7 @@ MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
}
}
return
r
v
;
return
r
esult
;
}
MojoResult
Core
::
ReadMessage
(
MojoHandle
message_pipe_handle
,
...
...
@@ -316,23 +319,23 @@ MojoResult Core::ReadMessage(MojoHandle message_pipe_handle,
UserPointer
<
MojoHandle
>
handles
,
UserPointer
<
uint32_t
>
num_handles
,
MojoReadMessageFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
message_pipe_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
message_pipe_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
uint32_t
num_handles_value
=
num_handles
.
IsNull
()
?
0
:
num_handles
.
Get
();
MojoResult
rv
;
if
(
num_handles_value
==
0
)
{
// Easy case: won't receive any handles.
r
v
=
dispatcher
->
ReadMessage
(
bytes
,
num_bytes
,
nullptr
,
&
num_handles_value
,
flags
);
r
esult
=
dispatcher
->
ReadMessage
(
bytes
,
num_bytes
,
nullptr
,
&
num_handles_value
,
flags
);
}
else
{
DispatcherVector
dispatchers
;
r
v
=
dispatcher
->
ReadMessage
(
bytes
,
num_bytes
,
&
dispatchers
,
&
num_handles_value
,
flags
);
r
esult
=
dispatcher
->
ReadMessage
(
bytes
,
num_bytes
,
&
dispatchers
,
&
num_handles_value
,
flags
);
if
(
!
dispatchers
.
empty
())
{
DCHECK_EQ
(
r
v
,
MOJO_RESULT_OK
);
DCHECK_EQ
(
r
esult
,
MOJO_RESULT_OK
);
DCHECK
(
!
num_handles
.
IsNull
());
DCHECK_LE
(
dispatchers
.
size
(),
static_cast
<
size_t
>
(
num_handles_value
));
...
...
@@ -354,15 +357,15 @@ MojoResult Core::ReadMessage(MojoHandle message_pipe_handle,
if
(
dispatchers
[
i
])
dispatchers
[
i
]
->
Close
();
}
if
(
r
v
==
MOJO_RESULT_OK
)
r
v
=
MOJO_RESULT_RESOURCE_EXHAUSTED
;
if
(
r
esult
==
MOJO_RESULT_OK
)
r
esult
=
MOJO_RESULT_RESOURCE_EXHAUSTED
;
}
}
}
if
(
!
num_handles
.
IsNull
())
num_handles
.
Put
(
num_handles_value
);
return
r
v
;
return
r
esult
;
}
MojoResult
Core
::
CreateDataPipe
(
...
...
@@ -406,9 +409,10 @@ MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle,
UserPointer
<
const
void
>
elements
,
UserPointer
<
uint32_t
>
num_bytes
,
MojoWriteDataFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
data_pipe_producer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
data_pipe_producer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
WriteData
(
elements
,
num_bytes
,
flags
);
}
...
...
@@ -417,18 +421,20 @@ MojoResult Core::BeginWriteData(MojoHandle data_pipe_producer_handle,
UserPointer
<
void
*>
buffer
,
UserPointer
<
uint32_t
>
buffer_num_bytes
,
MojoWriteDataFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
data_pipe_producer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
data_pipe_producer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
BeginWriteData
(
buffer
,
buffer_num_bytes
,
flags
);
}
MojoResult
Core
::
EndWriteData
(
MojoHandle
data_pipe_producer_handle
,
uint32_t
num_bytes_written
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
data_pipe_producer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
data_pipe_producer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
EndWriteData
(
num_bytes_written
);
}
...
...
@@ -437,9 +443,10 @@ MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle,
UserPointer
<
void
>
elements
,
UserPointer
<
uint32_t
>
num_bytes
,
MojoReadDataFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
data_pipe_consumer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
data_pipe_consumer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
ReadData
(
elements
,
num_bytes
,
flags
);
}
...
...
@@ -448,18 +455,20 @@ MojoResult Core::BeginReadData(MojoHandle data_pipe_consumer_handle,
UserPointer
<
const
void
*>
buffer
,
UserPointer
<
uint32_t
>
buffer_num_bytes
,
MojoReadDataFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
data_pipe_consumer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
data_pipe_consumer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
BeginReadData
(
buffer
,
buffer_num_bytes
,
flags
);
}
MojoResult
Core
::
EndReadData
(
MojoHandle
data_pipe_consumer_handle
,
uint32_t
num_bytes_read
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
data_pipe_consumer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
data_pipe_consumer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
EndReadData
(
num_bytes_read
);
}
...
...
@@ -496,14 +505,14 @@ MojoResult Core::DuplicateBufferHandle(
MojoHandle
buffer_handle
,
UserPointer
<
const
MojoDuplicateBufferHandleOptions
>
options
,
UserPointer
<
MojoHandle
>
new_buffer_handle
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
buffer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
buffer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
// Don't verify |options| here; that's the dispatcher's job.
RefPtr
<
Dispatcher
>
new_dispatcher
;
MojoResult
result
=
dispatcher
->
DuplicateBufferHandle
(
options
,
&
new_dispatcher
);
result
=
dispatcher
->
DuplicateBufferHandle
(
options
,
&
new_dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
...
...
@@ -521,9 +530,10 @@ MojoResult Core::DuplicateBufferHandle(
MojoResult
Core
::
GetBufferInformation
(
MojoHandle
buffer_handle
,
UserPointer
<
MojoBufferInformation
>
info
,
uint32_t
info_num_bytes
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
buffer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
buffer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
return
dispatcher
->
GetBufferInformation
(
info
,
info_num_bytes
);
}
...
...
@@ -533,12 +543,13 @@ MojoResult Core::MapBuffer(MojoHandle buffer_handle,
uint64_t
num_bytes
,
UserPointer
<
void
*>
buffer
,
MojoMapBufferFlags
flags
)
{
RefPtr
<
Dispatcher
>
dispatcher
(
GetDispatcher
(
buffer_handle
));
if
(
!
dispatcher
)
return
MOJO_RESULT_INVALID_ARGUMENT
;
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
GetDispatcher
(
buffer_handle
,
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
std
::
unique_ptr
<
PlatformSharedBufferMapping
>
mapping
;
MojoResult
result
=
dispatcher
->
MapBuffer
(
offset
,
num_bytes
,
flags
,
&
mapping
);
result
=
dispatcher
->
MapBuffer
(
offset
,
num_bytes
,
flags
,
&
mapping
);
if
(
result
!=
MOJO_RESULT_OK
)
return
result
;
...
...
@@ -575,13 +586,23 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
DispatcherVector
dispatchers
;
dispatchers
.
reserve
(
num_handles
);
for
(
uint32_t
i
=
0
;
i
<
num_handles
;
i
++
)
{
RefPtr
<
Dispatcher
>
dispatcher
=
GetDispatcher
(
handles
[
i
]);
if
(
!
dispatcher
)
{
*
result_index
=
i
;
return
MOJO_RESULT_INVALID_ARGUMENT
;
{
MutexLocker
locker
(
&
handle_table_mutex_
);
for
(
uint32_t
i
=
0
;
i
<
num_handles
;
i
++
)
{
if
(
handles
[
i
]
==
MOJO_HANDLE_INVALID
)
{
*
result_index
=
i
;
return
MOJO_RESULT_INVALID_ARGUMENT
;
}
RefPtr
<
Dispatcher
>
dispatcher
;
MojoResult
result
=
handle_table_
.
GetDispatcher
(
handles
[
i
],
&
dispatcher
);
if
(
result
!=
MOJO_RESULT_OK
)
{
*
result_index
=
i
;
return
result
;
}
dispatchers
.
push_back
(
std
::
move
(
dispatcher
));
}
dispatchers
.
push_back
(
dispatcher
);
}
// TODO(vtl): Should make the waiter live (permanently) in TLS.
...
...
@@ -589,21 +610,21 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
waiter
.
Init
();
uint32_t
i
;
MojoResult
r
v
=
MOJO_RESULT_OK
;
MojoResult
r
esult
=
MOJO_RESULT_OK
;
for
(
i
=
0
;
i
<
num_handles
;
i
++
)
{
r
v
=
dispatchers
[
i
]
->
AddAwakable
(
r
esult
=
dispatchers
[
i
]
->
AddAwakable
(
&
waiter
,
signals
[
i
],
i
,
signals_states
?
&
signals_states
[
i
]
:
nullptr
);
if
(
r
v
!=
MOJO_RESULT_OK
)
{
if
(
r
esult
!=
MOJO_RESULT_OK
)
{
*
result_index
=
i
;
break
;
}
}
uint32_t
num_added
=
i
;
if
(
r
v
==
MOJO_RESULT_ALREADY_EXISTS
)
r
v
=
MOJO_RESULT_OK
;
// The i-th one is already "triggered".
else
if
(
r
v
==
MOJO_RESULT_OK
)
r
v
=
waiter
.
Wait
(
deadline
,
result_index
);
if
(
r
esult
==
MOJO_RESULT_ALREADY_EXISTS
)
r
esult
=
MOJO_RESULT_OK
;
// The i-th one is already "triggered".
else
if
(
r
esult
==
MOJO_RESULT_OK
)
r
esult
=
waiter
.
Wait
(
deadline
,
result_index
);
// Make sure no other dispatchers try to wake |waiter| for the current
// |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be
...
...
@@ -617,7 +638,7 @@ MojoResult Core::WaitManyInternal(const MojoHandle* handles,
signals_states
[
i
]
=
dispatchers
[
i
]
->
GetHandleSignalsState
();
}
return
r
v
;
return
r
esult
;
}
}
// namespace system
...
...
mojo/edk/system/core.h
浏览文件 @
989b29a6
...
...
@@ -17,8 +17,10 @@
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
@@ -48,16 +50,16 @@ class Core {
// |MOJO_HANDLE_INVALID| on failure, namely if the handle table is full.
MojoHandle
AddDispatcher
(
Dispatcher
*
dispatcher
);
// Looks up the dispatcher for the given handle. Returns null if the handle is
// invalid.
util
::
RefPtr
<
Dispatcher
>
GetDispatcher
(
MojoHandle
handle
);
// Looks up the dispatcher for the given handle. On success, gets the
// dispatcher for a given handle. On failure, returns an appropriate result
// and leaves |dispatcher| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if
// the handle is invalid or |MOJO_RESULT_BUSY| if the handle is marked as
// busy.
MojoResult
GetDispatcher
(
MojoHandle
handle
,
util
::
RefPtr
<
Dispatcher
>*
dispatcher
);
// Like |GetDispatcher()|, but also removes the handle from the handle table.
// On success, gets the dispatcher for a given handle (which should not be
// |MOJO_HANDLE_INVALID|) and removes it. (On failure, returns an appropriate
// result (and leaves |dispatcher| alone), namely
// |MOJO_RESULT_INVALID_ARGUMENT| if there's no dispatcher for the given
// handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.)
// Like |GetDispatcher()|, but on success also removes the handle from the
// handle table.
MojoResult
GetAndRemoveDispatcher
(
MojoHandle
handle
,
util
::
RefPtr
<
Dispatcher
>*
dispatcher
);
...
...
@@ -81,10 +83,17 @@ class Core {
// of these methods is to look at the header files defining the corresponding
// API functions, referenced below.
// These methods correspond to the API functions defined in
// "mojo/public/c/system/functions.h":
// This method corresponds to the API function defined in
// "mojo/public/c/system/time.h":
MojoTimeTicks
GetTimeTicksNow
();
// This method corresponds to the API function defined in
// "mojo/public/c/system/handle.h":
MojoResult
Close
(
MojoHandle
handle
);
// These methods correspond to the API functions defined in
// "mojo/public/c/system/wait.h":
MojoResult
Wait
(
MojoHandle
handle
,
MojoHandleSignals
signals
,
MojoDeadline
deadline
,
...
...
mojo/edk/system/core_test_base.h
浏览文件 @
989b29a6
...
...
@@ -9,7 +9,7 @@
#include "mojo/edk/util/mutex.h"
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
handle
.h"
#include "mojo/public/cpp/system/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
...
...
mojo/edk/system/data_pipe.h
浏览文件 @
989b29a6
...
...
@@ -18,7 +18,8 @@
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/data_pipe_impl.h
浏览文件 @
989b29a6
...
...
@@ -17,7 +17,7 @@
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/macros.h"
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
namespace
mojo
{
namespace
system
{
...
...
mojo/edk/system/dispatcher.h
浏览文件 @
989b29a6
...
...
@@ -21,8 +21,9 @@
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/buffer.h"
#include "mojo/public/c/system/data_pipe.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/handle_signals_state.h
浏览文件 @
989b29a6
...
...
@@ -5,7 +5,7 @@
#ifndef MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
#define MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
handle
.h"
namespace
mojo
{
namespace
system
{
...
...
mojo/edk/system/handle_table.cc
浏览文件 @
989b29a6
...
...
@@ -34,13 +34,19 @@ HandleTable::~HandleTable() {
// the singleton |Core|, which lives forever), except in tests.
}
Dispatcher
*
HandleTable
::
GetDispatcher
(
MojoHandle
handle
)
{
MojoResult
HandleTable
::
GetDispatcher
(
MojoHandle
handle
,
RefPtr
<
Dispatcher
>*
dispatcher
)
{
DCHECK_NE
(
handle
,
MOJO_HANDLE_INVALID
);
DCHECK
(
dispatcher
);
HandleToEntryMap
::
iterator
it
=
handle_to_entry_map_
.
find
(
handle
);
if
(
it
==
handle_to_entry_map_
.
end
())
return
nullptr
;
return
it
->
second
.
dispatcher
.
get
();
return
MOJO_RESULT_INVALID_ARGUMENT
;
if
(
it
->
second
.
busy
)
return
MOJO_RESULT_BUSY
;
*
dispatcher
=
it
->
second
.
dispatcher
;
return
MOJO_RESULT_OK
;
}
MojoResult
HandleTable
::
GetAndRemoveDispatcher
(
MojoHandle
handle
,
...
...
mojo/edk/system/handle_table.h
浏览文件 @
989b29a6
...
...
@@ -10,7 +10,8 @@
#include <vector>
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
@@ -41,19 +42,16 @@ class HandleTable {
HandleTable
();
~
HandleTable
();
// Gets the dispatcher for a given handle (which should not be
// |MOJO_HANDLE_INVALID|). Returns null if there's no dispatcher for the given
// handle.
// WARNING: For efficiency, this returns a dumb pointer. If you're going to
// use the result outside |Core|'s lock, you MUST take a reference (e.g., by
// storing the result inside a |util::RefPtr|).
Dispatcher
*
GetDispatcher
(
MojoHandle
handle
);
// On success, gets the dispatcher for a given handle (which should not be
// |MOJO_HANDLE_INVALID|) and removes it. (On failure, returns an appropriate
// result (and leaves |dispatcher| alone), namely
// |MOJO_RESULT_INVALID_ARGUMENT| if there's no dispatcher for the given
// handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.)
// |MOJO_HANDLE_INVALID|). On failure, returns an appropriate result (and
// leaves |dispatcher| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if
// there's no dispatcher for the given handle or |MOJO_RESULT_BUSY| if the
// handle is marked as busy.
MojoResult
GetDispatcher
(
MojoHandle
handle
,
util
::
RefPtr
<
Dispatcher
>*
dispatcher
);
// Like |GetDispatcher()|, but on success also removes the handle from the
// handle table.
MojoResult
GetAndRemoveDispatcher
(
MojoHandle
handle
,
util
::
RefPtr
<
Dispatcher
>*
dispatcher
);
...
...
mojo/edk/system/mapping_table.h
浏览文件 @
989b29a6
...
...
@@ -11,7 +11,7 @@
#include <unordered_map>
#include <vector>
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/message_pipe.h
浏览文件 @
989b29a6
...
...
@@ -21,8 +21,9 @@
#include "mojo/edk/util/mutex.h"
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/message_pipe_endpoint.h
浏览文件 @
989b29a6
...
...
@@ -13,8 +13,9 @@
#include "mojo/edk/system/dispatcher.h"
#include "mojo/edk/system/memory.h"
#include "mojo/edk/system/message_in_transit.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/message_pipe.h"
#include "mojo/public/c/system/
types
.h"
#include "mojo/public/c/system/
result
.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/options_validation.h
浏览文件 @
989b29a6
...
...
@@ -18,7 +18,6 @@
#include "base/logging.h"
#include "mojo/edk/system/memory.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/test/perf_log.h
浏览文件 @
989b29a6
...
...
@@ -7,9 +7,6 @@
#ifndef MOJO_EDK_SYSTEM_TEST_PERF_LOG_H_
#define MOJO_EDK_SYSTEM_TEST_PERF_LOG_H_
//#include "mojo/public/c/system/types.h"
//#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
namespace
system
{
namespace
test
{
...
...
mojo/edk/system/test/timeouts.h
浏览文件 @
989b29a6
...
...
@@ -7,7 +7,7 @@
#ifndef MOJO_EDK_SYSTEM_TEST_TIMEOUTS_H_
#define MOJO_EDK_SYSTEM_TEST_TIMEOUTS_H_
#include "mojo/public/c/system/t
ypes
.h"
#include "mojo/public/c/system/t
ime
.h"
namespace
mojo
{
namespace
system
{
...
...
mojo/edk/system/waiter.h
浏览文件 @
989b29a6
...
...
@@ -11,7 +11,8 @@
#include "mojo/edk/util/cond_var.h"
#include "mojo/edk/util/mutex.h"
#include "mojo/edk/util/thread_annotations.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/edk/system/waiter_test_utils.h
浏览文件 @
989b29a6
...
...
@@ -12,7 +12,9 @@
#include "mojo/edk/system/test/simple_test_thread.h"
#include "mojo/edk/system/waiter.h"
#include "mojo/edk/util/ref_ptr.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/c/system/handle.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/cpp/system/macros.h"
namespace
mojo
{
...
...
mojo/message_pump/handle_watcher.h
浏览文件 @
989b29a6
...
...
@@ -5,11 +5,12 @@
#ifndef MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_
#define MOJO_MESSAGE_PUMP_HANDLE_WATCHER_H_
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/cpp/system/handle.h"
namespace
base
{
class
Thread
;
...
...
mojo/message_pump/handle_watcher_unittest.cc
浏览文件 @
989b29a6
...
...
@@ -15,7 +15,7 @@
#include "base/threading/thread.h"
#include "mojo/message_pump/message_pump_mojo.h"
#include "mojo/message_pump/time_helper.h"
#include "mojo/public/cpp/system/
cor
e.h"
#include "mojo/public/cpp/system/
message_pip
e.h"
#include "mojo/public/cpp/test_support/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
...
...
mojo/message_pump/message_pump_mojo.cc
浏览文件 @
989b29a6
...
...
@@ -13,6 +13,8 @@
#include "base/time/time.h"
#include "mojo/message_pump/message_pump_mojo_handler.h"
#include "mojo/message_pump/time_helper.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/public/cpp/system/wait.h"
namespace
mojo
{
namespace
common
{
...
...
mojo/message_pump/message_pump_mojo.h
浏览文件 @
989b29a6
...
...
@@ -15,7 +15,9 @@
#include "base/observer_list.h"
#include "base/synchronization/lock.h"
#include "base/time/time.h"
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/c/system/time.h"
#include "mojo/public/cpp/system/handle.h"
namespace
mojo
{
namespace
common
{
...
...
mojo/message_pump/message_pump_mojo_handler.h
浏览文件 @
989b29a6
...
...
@@ -5,7 +5,8 @@
#ifndef MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_HANDLER_H_
#define MOJO_MESSAGE_PUMP_MESSAGE_PUMP_MOJO_HANDLER_H_
#include "mojo/public/cpp/system/core.h"
#include "mojo/public/c/system/result.h"
#include "mojo/public/cpp/system/handle.h"
namespace
mojo
{
namespace
common
{
...
...
mojo/message_pump/message_pump_mojo_unittest.cc
浏览文件 @
989b29a6
...
...
@@ -7,7 +7,7 @@
#include "base/message_loop/message_loop_test.h"
#include "base/run_loop.h"
#include "mojo/message_pump/message_pump_mojo_handler.h"
#include "mojo/public/cpp/system/
cor
e.h"
#include "mojo/public/cpp/system/
message_pip
e.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace
mojo
{
...
...
mojo/services/authentication/interfaces/authentication.mojom
浏览文件 @
989b29a6
...
...
@@ -18,7 +18,7 @@ interface AuthenticationService {
SelectAccount(bool return_last_selected) => (string? username, string? error);
// Requests an oauth2 token for the given Google account with the given
// scopes. In case of error,
username
will be null and error will contain a
// scopes. In case of error,
token
will be null and error will contain a
// description of the error.
GetOAuth2Token(string username, array<string> scopes) =>
(string? token, string? error);
...
...
@@ -27,4 +27,22 @@ interface AuthenticationService {
// token is refused by a server component before requesting a new token to
// clear the token from any cache.
ClearOAuth2Token(string token);
// Requests an oauth2 device code response for the given set of scopes. In
// case of error, all response parameters other than error, namely
// verifcation_url, device_code and user_code will be null and error will
// contain a description of the error. To provision FNL like systems with
// Google account credentials, invoke GetOAuth2DeviceCode() method followed by
// AddAccount() instead of using SelectAccount(), which only works for
// Android.
GetOAuth2DeviceCode(array<string> scopes) => (string? verification_url,
string? device_code,
string? user_code,
string? error);
// Exchanges an oauth2 device code to a refresh token for the granted user,
// and stores it locally in a secure storage location on FNL. For future
// GetOAuth2Token requests, a new access token is minted from this refresh
// token and returned to the calling mojo app.
AddAccount(string device_code) => (string? username, string? error);
};
mojo/services/log/cpp/lib/log_client.cc
浏览文件 @
989b29a6
...
...
@@ -14,6 +14,7 @@
#include "mojo/public/cpp/bindings/lib/message_builder.h"
#include "mojo/public/cpp/system/macros.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/public/cpp/system/time.h"
#include "mojo/services/log/interfaces/entry.mojom.h"
#include "mojo/services/log/interfaces/log.mojom.h"
...
...
mojo/services/media/audio/interfaces/audio_track.mojom
浏览文件 @
989b29a6
...
...
@@ -6,7 +6,7 @@
module mojo.media;
import "mojo/services/media/common/interfaces/media_common.mojom";
import "mojo/services/media/common/interfaces/media_
pipe
.mojom";
import "mojo/services/media/common/interfaces/media_
transport
.mojom";
import "mojo/services/media/common/interfaces/media_types.mojom";
import "mojo/services/media/common/interfaces/rate_control.mojom";
...
...
@@ -48,7 +48,7 @@ interface AudioTrack {
Describe() => (AudioTrackDescriptor descriptor);
// Set the configuration, receive a pipe to send data to in return.
Configure(AudioTrackConfiguration configuration, Media
Pipe
& pipe);
Configure(AudioTrackConfiguration configuration, Media
Consumer
& pipe);
// Request the rate control interface for this AudioTrack
GetRateControl(RateControl& rate_control);
...
...
mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.cc
浏览文件 @
989b29a6
...
...
@@ -6,7 +6,7 @@
#include "mojo/public/cpp/utility/run_loop.h"
#include "mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.h"
#include "mojo/services/media/common/interfaces/media_common.mojom.h"
#include "mojo/services/media/common/interfaces/media_
pipe
.mojom.h"
#include "mojo/services/media/common/interfaces/media_
transport
.mojom.h"
namespace
mojo
{
namespace
media
{
...
...
@@ -26,20 +26,20 @@ CircularBufferMediaPipeAdapter::MappedPacket::~MappedPacket() {
CircularBufferMediaPipeAdapter
::
PacketState
::
PacketState
(
uint64_t
post_consume_rd
,
uint32_t
seq_num
,
const
Media
Pipe
::
SendPacketCallback
&
cbk
)
const
Media
Consumer
::
SendPacketCallback
&
cbk
)
:
post_consume_rd_
(
post_consume_rd
),
seq_num_
(
seq_num
),
cbk_
(
cbk
)
{}
CircularBufferMediaPipeAdapter
::
PacketState
::~
PacketState
()
{
}
CircularBufferMediaPipeAdapter
::
CircularBufferMediaPipeAdapter
(
Media
Pipe
Ptr
pipe
)
Media
Consumer
Ptr
pipe
)
:
pipe_
(
pipe
.
Pass
())
,
thiz_
(
new
CircularBufferMediaPipeAdapter
*
(
this
))
{
MOJO_DCHECK
(
pipe_
);
MOJO_DCHECK
(
RunLoop
::
current
());
pipe_flush_cbk_
=
Media
Pipe
::
FlushCallback
(
pipe_flush_cbk_
=
Media
Consumer
::
FlushCallback
(
[
this
]
()
{
HandleFlush
();
});
...
...
@@ -117,7 +117,7 @@ void CircularBufferMediaPipeAdapter::Init(uint64_t size) {
// TODO(johngro) : We should not have to send the buffer size, it should be an
// intrinsic property of the buffer itself and be query-able via the handle.
pipe_
->
SetBuffer
(
duplicated_handle
.
Pass
(),
buffer_size_
);
pipe_
->
SetBuffer
(
duplicated_handle
.
Pass
(),
buffer_size_
,
[]()
{}
);
}
void
CircularBufferMediaPipeAdapter
::
SetSignalCallback
(
SignalCbk
cbk
)
{
...
...
@@ -244,7 +244,7 @@ MediaResult CircularBufferMediaPipeAdapter::CreateMediaPacket(
MediaResult
CircularBufferMediaPipeAdapter
::
SendMediaPacket
(
MappedPacket
*
packet
,
const
Media
Pipe
::
SendPacketCallback
&
cbk
)
{
const
Media
Consumer
::
SendPacketCallback
&
cbk
)
{
MOJO_DCHECK
(
packet
&&
!
packet
->
packet_
.
is_null
());
if
(
!
packet
||
packet
->
packet_
.
is_null
())
{
return
MediaResult
::
INVALID_ARGUMENT
;
...
...
@@ -297,7 +297,7 @@ MediaResult CircularBufferMediaPipeAdapter::SendMediaPacket(
pipe_
->
SendPacket
(
packet
->
packet_
.
Pass
(),
[
this
,
seq_num
](
Media
Pipe
::
SendResult
result
)
{
[
this
,
seq_num
](
Media
Consumer
::
SendResult
result
)
{
HandleSendPacket
(
seq_num
,
result
);
});
...
...
@@ -346,8 +346,8 @@ MediaResult CircularBufferMediaPipeAdapter::Flush() {
void
CircularBufferMediaPipeAdapter
::
HandleSendPacket
(
uint32_t
seq_num
,
Media
Pipe
::
SendResult
result
)
{
Media
Pipe
::
SendPacketCallback
cbk
;
Media
Consumer
::
SendResult
result
)
{
Media
Consumer
::
SendPacketCallback
cbk
;
do
{
// There should be at least one element in the in-flight queue, and the
...
...
mojo/services/media/common/cpp/circular_buffer_media_pipe_adapter.h
浏览文件 @
989b29a6
...
...
@@ -13,13 +13,13 @@
#include "mojo/public/cpp/bindings/callback.h"
#include "mojo/public/cpp/environment/logging.h"
#include "mojo/services/media/common/interfaces/media_common.mojom.h"
#include "mojo/services/media/common/interfaces/media_
pipe
.mojom.h"
#include "mojo/services/media/common/interfaces/media_
transport
.mojom.h"
namespace
mojo
{
namespace
media
{
// A class to help producers of media with the bookkeeping involved in using the
// shared buffer provided by a Media
Pipe
mojo interface in a circular buffer
// shared buffer provided by a Media
Consumer
mojo interface in a circular buffer
// fashion.
//
class
CircularBufferMediaPipeAdapter
{
...
...
@@ -73,14 +73,14 @@ class CircularBufferMediaPipeAdapter {
/**
* Constructor
*
* Create an adapter which will take ownership of the provided Media
Pipe
* Create an adapter which will take ownership of the provided Media
Consumer
* interface and assist in the process of generating MediaPackets and
* marshalling them to the other side of the Media
Pipe
.
* marshalling them to the other side of the Media
Consumer
.
*
* @param pipe A pointer to the Media
Pipe interface which will be used as the
* target for MediaPackets.
* @param pipe A pointer to the Media
Consumer interface which will be used as
* t
he t
arget for MediaPackets.
*/
explicit
CircularBufferMediaPipeAdapter
(
Media
Pipe
Ptr
pipe
);
explicit
CircularBufferMediaPipeAdapter
(
Media
Consumer
Ptr
pipe
);
/**
* Destructor
...
...
@@ -91,7 +91,7 @@ class CircularBufferMediaPipeAdapter {
* Init
*
* Allocate a shared memory buffer of the specified size and begin the process
* of marshalling it to the other side of the Media
Pipe
.
* of marshalling it to the other side of the Media
Consumer
.
*
* @param size The size in bytes of the shared memory buffer to allocate.
*/
...
...
@@ -189,8 +189,8 @@ class CircularBufferMediaPipeAdapter {
*/
MediaResult
SendMediaPacket
(
MappedPacket
*
packet
,
const
Media
Pipe
::
SendPacketCallback
&
cbk
=
Media
Pipe
::
SendPacketCallback
());
const
Media
Consumer
::
SendPacketCallback
&
cbk
=
Media
Consumer
::
SendPacketCallback
());
/**
* Cancel a packet previously created using CreateMediaPacket.
...
...
@@ -220,16 +220,16 @@ class CircularBufferMediaPipeAdapter {
struct
PacketState
{
PacketState
(
uint64_t
post_consume_rd
,
uint32_t
seq_num
,
const
Media
Pipe
::
SendPacketCallback
&
cbk
);
const
Media
Consumer
::
SendPacketCallback
&
cbk
);
~
PacketState
();
uint64_t
post_consume_rd_
;
uint32_t
seq_num_
;
Media
Pipe
::
SendPacketCallback
cbk_
;
Media
Consumer
::
SendPacketCallback
cbk_
;
};
using
PacketStateQueue
=
std
::
deque
<
PacketState
>
;
void
HandleSendPacket
(
uint32_t
seq_num
,
Media
Pipe
::
SendResult
result
);
void
HandleSendPacket
(
uint32_t
seq_num
,
Media
Consumer
::
SendResult
result
);
void
HandleFlush
();
void
HandleSignalCallback
();
...
...
@@ -246,9 +246,9 @@ class CircularBufferMediaPipeAdapter {
}
// Pipe interface callbacks
Media
Pipe
Ptr
pipe_
;
Media
Pipe
::
FlushCallback
pipe_flush_cbk_
;
Closure
signalled_callback_
;
Media
Consumer
Ptr
pipe_
;
Media
Consumer
::
FlushCallback
pipe_flush_cbk_
;
Closure
signalled_callback_
;
// A small helper which lets us nerf callbacks we may have directly scheduled
// on the main run loop which may be in flight as we get destroyed.
...
...
mojo/services/media/common/interfaces/BUILD.gn
浏览文件 @
989b29a6
...
...
@@ -10,7 +10,6 @@ mojom("interfaces") {
"media_clock.mojom",
"media_common.mojom",
"media_metadata.mojom",
"media_pipe.mojom",
"media_state.mojom",
"media_transport.mojom",
"media_types.mojom",
...
...
mojo/services/media/common/interfaces/media_pipe.mojom
已删除
100644 → 0
浏览文件 @
7a68885c
// 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.
[DartPackage="mojo_services"]
module mojo.media;
import "mojo/services/media/common/interfaces/media_common.mojom";
// MediaPacketRegion
//
// A small structure used to keep track of a portion of a shared buffer used by
// a MediaPacket to hold its payload.
struct MediaPacketRegion {
uint64 offset;
uint64 length;
};
// MediaPacket
//
// A structure which hold the definition of an atomic unit of media which may be
// sent across a media pipe. MediaPackets consist of the metadata for the unit
// of media, as well as the set of offset/lengths in the pipe's shared buffer
// which define the payload of the packet itself.
struct MediaPacket {
const int64 kNoTimestamp = 0x7fffffffffffffff;
// Presentation Time Stamp. Time at which the media should be presented,
// according to the media timeline.
int64 pts = kNoTimestamp;
// Duration represented by the packet.
uint64 duration;
// Indicates whether this is the last packet in the stream.
bool end_of_stream;
// Bookkeeping to determine where this MediaPacket's payload exists in its
// MediaPipe's shared buffer.
//
// For simple cases, only the payload field is used. It provides the offset
// into the shared buffer for the payload, as well as its length. In more
// complicated cases (circular buffer, arbitrary scatter-gather), additional
// regions may be described in the extra_payload array. Logically, the
// payload is the concatination of the payload region, followed by the extra
// payload regions, from index 0 to index N-1.
//
// TODO(johngro): Depending on what happens with mojo struct marshalling,
// consider merging payload and extra_payload into just a single array. The
// intention was to not need any extra allocations if there way only a single
// payload region, but right now we always need to allocate an array, even if
// it is zero length. If this is not going to change, then we should just
// merge these two fields.
MediaPacketRegion payload;
array<MediaPacketRegion>? extra_payload;
// TODO(johngro): do we need to describe the MediaType of this payload, or is
// its type implicit based on the channel over which it is being pushed?
// TODO(johngro): how do we attach per-packet media specific metadata to this
// packet?
};
// MediaPipe
//
// An interface exposed by consumers of media which provides the means for
// producers to send media to consumers. A pipe logically consists of a shared
// memory region, and an ordered queue of MediaPackets. Users obtain access to
// the shared buffer via the GetState method. They may then send packet to the
// other side of the pipe using the SendPacket method and be informed about when
// the media has been consumed via the SendPacket callback they provide.
// Finally, the pipeline may be flushed using the Flush method.
interface MediaPipe {
const uint64 kMaxBufferLen = 0x3FFFFFFFFFFFFFFF;
// An enumeration used to indicate the ultimate fate of packets sent across
// the pipe using the SendPacket method.
enum SendResult {
CONSUMED, // Media was completely consumed.
FLUSHED, // Some or all of the media was flushed before being consumed.
};
// Sets the shared buffer in which sent Packet payloads will be located.
SetBuffer(handle<shared_buffer> buffer, uint64 size);
// Place a media packet into the pipeline to be consumed. When the consumer
// is finished with the packet, it will invoke the supplied callback to
// indicate that the region of the shared buffer indicated by the MediaPacket
// object is now available for new data. In addition, a SendResult will be
// providid indicating whether or not the packet was consumed or flushed.
SendPacket(MediaPacket packet) => (SendResult result);
// Flush the pipe, discarding all queued packets in order (from front to back)
// as we go. When the flush operation is complete, the provided callback will
// be invoked to indicate that the consumer end of the pipe has finished
// flushing and that the pipeline is now empty.
Flush() => ();
};
mojo/services/media/common/interfaces/media_transport.mojom
浏览文件 @
989b29a6
...
...
@@ -6,9 +6,62 @@
module mojo.media;
import "mojo/services/media/common/interfaces/media_common.mojom";
import "mojo/services/media/common/interfaces/media_pipe.mojom";
import "mojo/services/media/common/interfaces/media_types.mojom";
// MediaPacketRegion
//
// A small structure used to keep track of a portion of a shared buffer used by
// a MediaPacket to hold its payload.
struct MediaPacketRegion {
uint64 offset;
uint64 length;
};
// MediaPacket
//
// A structure which hold the definition of an atomic unit of media which may be
// sent across a media pipe. MediaPackets consist of the metadata for the unit
// of media, as well as the set of offset/lengths in the pipe's shared buffer
// which define the payload of the packet itself.
struct MediaPacket {
const int64 kNoTimestamp = 0x7fffffffffffffff;
// Presentation Time Stamp. Time at which the media should be presented,
// according to the media timeline.
int64 pts = kNoTimestamp;
// Duration represented by the packet.
uint64 duration;
// Indicates whether this is the last packet in the stream.
bool end_of_stream;
// Bookkeeping to determine where this MediaPacket's payload exists in its
// MediaPipe's shared buffer.
//
// For simple cases, only the payload field is used. It provides the offset
// into the shared buffer for the payload, as well as its length. In more
// complicated cases (circular buffer, arbitrary scatter-gather), additional
// regions may be described in the extra_payload array. Logically, the
// payload is the concatination of the payload region, followed by the extra
// payload regions, from index 0 to index N-1.
//
// TODO(johngro): Depending on what happens with mojo struct marshalling,
// consider merging payload and extra_payload into just a single array. The
// intention was to not need any extra allocations if there way only a single
// payload region, but right now we always need to allocate an array, even if
// it is zero length. If this is not going to change, then we should just
// merge these two fields.
MediaPacketRegion payload;
array<MediaPacketRegion>? extra_payload;
// TODO(johngro): do we need to describe the MediaType of this payload, or is
// its type implicit based on the channel over which it is being pushed?
// TODO(johngro): how do we attach per-packet media specific metadata to this
// packet?
};
// Models a stream producer. A MediaProducer allows a client to connect the
// producer to a MediaConsumer so packets flow from the producer to the
// consumer. Clients who want to receive packets directly from the producer
...
...
@@ -59,12 +112,25 @@ interface MediaPullModeProducer {
// producer and consumer. The producer then calls PushPacket on the consumer to
// deliver packets.
interface MediaConsumer {
const uint64 kMaxBufferLen = 0x3FFFFFFFFFFFFFFF;
// An enumeration used to indicate the ultimate fate of packets sent across
// the pipe using the SendPacket method.
enum SendResult {
CONSUMED, // Media was completely consumed.
FLUSHED, // Some or all of the media was flushed before being consumed.
};
// Sets the shared buffer in which packet payload will be located.
SetBuffer(handle<shared_buffer> buffer, uint64 size) => ();
//
Pushe
s a packet to the consumer. The callback signals that the consumer
//
Send
s a packet to the consumer. The callback signals that the consumer
// is done with the packet buffer region.
PushPacket(MediaPacket packet) => ();
SendPacket(MediaPacket packet) => (SendResult result);
// Primes the stream. The callback signals that the prime operation is
// complete.
Prime() => ();
// Flushes the stream. The callback signals that the flush operation is
// complete.
...
...
mojo/services/media/control/interfaces/media_factory.mojom
浏览文件 @
989b29a6
...
...
@@ -9,6 +9,7 @@ import "mojo/services/media/common/interfaces/media_types.mojom";
import "mojo/services/media/control/interfaces/media_player.mojom";
import "mojo/services/media/control/interfaces/media_sink.mojom";
import "mojo/services/media/control/interfaces/media_source.mojom";
import "mojo/services/media/core/interfaces/media_type_converter.mojom";
// Exposed by the factory service to create media-related agents.
[ServiceName="mojo::media::MediaFactory"]
...
...
@@ -31,4 +32,7 @@ interface MediaFactory {
// convert the indicated media type to a type compatible with the
// destination.
CreateSink(string destination_url, MediaType media_type, MediaSink& sink);
// Creates a decoder.
CreateDecoder(MediaType input_media_type, MediaTypeConverter& decoder);
};
mojo/services/media/control/interfaces/media_player.mojom
浏览文件 @
989b29a6
...
...
@@ -17,6 +17,11 @@ interface MediaPlayer {
// Pauses playback.
Pause();
// Seeks to the specified position, specified in nanoseconds.
// TODO(dalesat): Consider adding relative vs remote flag.
// TODO(dalesat): Consider adding parameters regarding desired precision.
Seek(int64 position);
// Gets the status. To get the status immediately, call GetStatus(0). To
// get updates thereafter, pass the version sent in the previous callback.
GetStatus(uint64 version_last_seen) =>
...
...
mojo/services/media/control/interfaces/media_source.mojom
浏览文件 @
989b29a6
...
...
@@ -40,8 +40,14 @@ interface MediaSource {
// Prepares the source.
Prepare() => ();
// Flushes the source.
// Primes the source and downstream components.
Prime() => ();
// Flushes the source and downstream components.
Flush() => ();
// Seeks to the specified position, specified in nanoseconds.
Seek(int64 position) => ();
};
// Describes a media stream produced by a source.
...
...
mojo/services/media/core/interfaces/BUILD.gn
0 → 100644
浏览文件 @
989b29a6
# Copyright 2014 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.
import("//build/module_args/mojo.gni")
import("$mojo_sdk_root/mojo/public/tools/bindings/mojom.gni")
mojom("interfaces") {
sources = [
"media_type_converter.mojom",
]
}
mojo/services/media/core/interfaces/media_type_converter.mojom
0 → 100644
浏览文件 @
989b29a6
// Copyright 2016 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.
[DartPackage="mojo_services"]
module mojo.media;
import "mojo/services/media/common/interfaces/media_transport.mojom";
import "mojo/services/media/common/interfaces/media_types.mojom";
// Performs a type conversion on a media stream.
interface MediaTypeConverter {
// Gets the converter’s output type.
GetOutputType() => (MediaType output_type);
// Gets the consumer.
GetConsumer(MediaConsumer& consumer);
// Gets the producer.
GetProducer(MediaProducer& producer);
};
mojo/services/mojo_services.gni
浏览文件 @
989b29a6
...
...
@@ -30,6 +30,7 @@ mojo_services = [
"//mojo/services/media/audio/interfaces",
"//mojo/services/media/common/interfaces",
"//mojo/services/media/control/interfaces",
"//mojo/services/media/core/interfaces",
"//mojo/services/native_support/interfaces",
"//mojo/services/native_viewport/interfaces",
"//mojo/services/navigation/interfaces",
...
...
mojo/services/ui/views/cpp/formatting.cc
浏览文件 @
989b29a6
...
...
@@ -18,6 +18,10 @@ std::ostream& operator<<(std::ostream& os,
return
os
<<
"{value="
<<
value
.
value
<<
"}"
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
mojo
::
ui
::
ViewInfo
&
value
)
{
return
os
<<
"{scene_token="
<<
value
.
scene_token
<<
"}"
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
mojo
::
ui
::
BoxConstraints
&
value
)
{
return
os
<<
"{min_width="
<<
value
.
min_width
...
...
@@ -34,8 +38,7 @@ std::ostream& operator<<(std::ostream& os,
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
mojo
::
ui
::
ViewLayoutInfo
&
value
)
{
return
os
<<
"{size="
<<
value
.
size
<<
", scene_token="
<<
value
.
scene_token
<<
"}"
;
return
os
<<
"{size="
<<
value
.
size
<<
"}"
;
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
...
...
mojo/services/ui/views/cpp/formatting.h
浏览文件 @
989b29a6
...
...
@@ -21,6 +21,8 @@ std::ostream& operator<<(std::ostream& os, const mojo::ui::ViewToken& value);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
mojo
::
ui
::
ViewTreeToken
&
value
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
mojo
::
ui
::
ViewInfo
&
value
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
mojo
::
ui
::
BoxConstraints
&
value
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
...
...
mojo/services/ui/views/interfaces/BUILD.gn
浏览文件 @
989b29a6
...
...
@@ -9,8 +9,11 @@ mojom("interfaces") {
sources = [
"layouts.mojom",
"view_associates.mojom",
"view_containers.mojom",
"view_manager.mojom",
"view_provider.mojom",
"view_token.mojom",
"view_tree_token.mojom",
"view_trees.mojom",
"views.mojom",
]
...
...
mojo/services/ui/views/interfaces/layouts.mojom
浏览文件 @
989b29a6
...
...
@@ -6,7 +6,6 @@
module mojo.ui;
import "mojo/services/geometry/interfaces/geometry.mojom";
import "mojo/services/gfx/composition/interfaces/scene_token.mojom";
// Box constraints for layout.
//
...
...
@@ -64,10 +63,8 @@ struct ViewLayoutParams {
};
// Layout information for a view.
// TODO(jeffbrown): Delete this while redesigning layout protocol.
struct ViewLayoutInfo {
// The view's scene token for composition by the parent.
mojo.gfx.composition.SceneToken scene_token;
// The actual size of the view in device pixels.
mojo.Size size;
};
...
...
mojo/services/ui/views/interfaces/view_associates.mojom
浏览文件 @
989b29a6
...
...
@@ -6,9 +6,10 @@
module mojo.ui;
import "mojo/public/interfaces/application/service_provider.mojom";
import "mojo/services/gfx/composition/interfaces/hit_tests.mojom";
import "mojo/services/gfx/composition/interfaces/scene_token.mojom";
import "mojo/services/ui/views/interfaces/view
s
.mojom";
import "mojo/services/ui/views/interfaces/view_tree
s
.mojom";
import "mojo/services/ui/views/interfaces/view
_token
.mojom";
import "mojo/services/ui/views/interfaces/view_tree
_token
.mojom";
// View associates are trusted components that are attached to a view manager
// instance with the purpose of offering additional services to views and
...
...
mojo/services/ui/views/interfaces/view_containers.mojom
0 → 100644
浏览文件 @
989b29a6
// Copyright 2016 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.
[DartPackage="mojo_services"]
module mojo.ui;
import "mojo/services/gfx/composition/interfaces/scene_token.mojom";
import "mojo/services/ui/views/interfaces/layouts.mojom";
import "mojo/services/ui/views/interfaces/view_token.mojom";
// A view container is an interface exposed by |View| and |ViewTree| to
// manage their child views. Although |View| may have any number of children,
// a |ViewTree| can have at most one (its root view).
//
// EMBEDDING
//
// The following steps are required to embed another view as a child:
//
// 1. Obtain the |ViewOwner| belonging to the view you would like to embed.
// The means for doing this is not specified by the view system.
// You might create another view of your own to embed or connect to
// another application using a mechanism such as |ViewProvider| (or
// any suitable agreed-upon protocol) to create the view to embed.
//
// 2. Call |AddChild()| to add the view you would like to embed and assign
// it a unique key.
//
// 3. Call |LayoutChild()| to provide layout parameters for the new child
// using the key that was provided.
//
// 4. After obtaining the layout result from the child, publish an
// update to your |Scene| which includes a reference to the child's own
// scene using the |SceneToken| included in the layout result.
//
// 5. Watch for the child becoming unavailable, as reported by
// |OnChildUnavailable()|, which indicates that the child is no longer
// in a usable state (perhaps the application which provided it has
// stopped). When this happens, you are still responsible for calling
// |RemoveChild()| to remove the child and discard any state that your
// view has associated with it.
//
// LAYOUT
//
// TODO(jeffbrown): Elaborate this once the layout protocol has been
// redesigned.
interface ViewContainer {
// Sets the view container listener, or null to remove.
SetListener(ViewContainerListener? listener);
// Adds the view referenced by |child_view_owner| as a child and assigns
// it the provided |child_key| to identify it among its children.
// The container may remove the child later by passing the same |child_key|
// to |RemoveChild()|.
//
// This method takes ownership of the view.
//
// It is important for the container to choose locally unique values for
// |child_key| to ensure that each child can be distinguished even as
// more children are added or removed. We recommend using a simple
// counter which is incremented on each (re-)addition.
//
// If the child becomes unavailable at any time prior to being removed
// then an |OnChildUnavailable()| message will be sent.
//
// If |child_view_owner| refers to a view which is already unavailable or
// if adding the view would create a cycle in the view tree then the
// call proceeds as if it succeeded but an |OnChildUnavailable()| message
// will be sent.
//
// If |child_view_owner| refers to a view which already has a container or is
// the root of a view tree then an |OnChildUnavailable()| message will
// be sent to its old container or root and the the view will be
// (re-)added to its new container as usual. This special case also
// applies when the specified view is already a child of this view, in which
// case the behavior is similar to the view having been transferred to
// some other container and then back again.
//
// Note that an unavailable child will remain in its container's list of
// children until its container explicitly calls |RemoveChild()| to remove
// it.
//
// It is an error to add a view whose |child_key| already appears
// in the view's list of children; the connection will be closed.
//
// It is an error to add more than one child to a |ViewTree|'s container;
// it can only have at most one child (its root).
AddChild(uint32 child_key, ViewOwner child_view_owner);
// Removes the view referenced by |child_key| from the view's
// list of children.
//
// If |transferred_view_owner| is not null, associates it with the
// previously added child to allow it to be transferred elsewhere or
// closes the |transferred_view_owner| message pipe if there was none.
//
// It is an error to remove a view whose |child_key| does not appear
// in the container's list of children; the connection will be closed.
RemoveChild(uint32 child_key, ViewOwner&? transferred_view_owner);
// Sets the layout parameters of the child view referenced by |child_key|
// and retrieves its layout information.
//
// The returned |info| is null if this layout request was canceled either
// because it has been superceded by a subsequently issued layout request
// or because the child has become unavailable.
//
// It is an error to specify a |child_key| that does not appear in
// the parent's list of children; the connection will be closed.
//
// It is an error to specify malformed |child_layout_params| such
// as invalid size constraints; the connection will be closed.
LayoutChild(uint32 child_key, mojo.ui.ViewLayoutParams child_layout_params)
=> (mojo.ui.ViewLayoutInfo? info);
};
// An interface clients may implement to receive events from a view container.
interface ViewContainerListener {
// Called when a child view is attached along with embedding information.
//
// This method will be called at most once after the child is added.
//
// The implementation should invoke the callback once the event has
// been handled.
OnChildAttached(uint32 child_key, ViewInfo child_view_info) => ();
// Called when a child view has become unavailable.
//
// A child may become unavailable for many reasons such being unregistered
// by its application, abnormal termination of its application, or
// cycles being introduced in the view tree.
//
// To complete removal of an unavailable child, this view component must
// call RemoveChild() on its view with |child_key|.
//
// The implementation should invoke the callback once the event has
// been handled.
OnChildUnavailable(uint32 child_key) => ();
};
// Provides embedding information about a view for use by its container.
//
// This information is valid until the container removes the view.
struct ViewInfo {
// The scene which represents the contents of the embedded view to be
// included in its container's view.
//
// This scene is created by the view manager as a wrapper for the actual
// scene generated by the embedded view. It will be destroyed when the
// container removes the view.
mojo.gfx.composition.SceneToken scene_token;
};
mojo/services/ui/views/interfaces/view_token.mojom
0 → 100644
浏览文件 @
989b29a6
// Copyright 2016 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.
[DartPackage="mojo_services"]
module mojo.ui;
// A view token is an opaque transferable reference to a view.
//
// The ViewManager provides each view with a unique view token when
// it is registered. The token can subsequently be passed to other
// applications and may be used to add the view as a child of some
// other view or to set it as the root of a view tree.
//
// View tokens should be kept secret and should only be shared with
// the view's intended container.
//
// TODO(jeffbrown): This implementation is a temporary placeholder until
// we extend Mojo to provide a way to create tokens which cannot be forged.
struct ViewToken {
uint32 value;
};
// A view owner provides access to the view's token and keeps the
// view alive. When the view owner is closed, the view will be
// unregistered from the view manager.
//
// This interface is only intended to be implemented by the view manager
// to obtain the desired ownership semantics.
interface ViewOwner {
// Gets the |ViewToken| associated with the view.
GetToken() => (ViewToken token);
};
mojo/services/ui/views/interfaces/view_tree_token.mojom
0 → 100644
浏览文件 @
989b29a6
// Copyright 2016 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.
[DartPackage="mojo_services"]
module mojo.ui;
// A view tree token is an opaque transferable reference to a view tree.
//
// The ViewManager provides each view tree with a unique view tree token when
// it is registered. The token can subsequently be passed to other
// applications and used as a way to refer to the tree.
//
// View tree tokens should be kept secret and should only be shared with
// trusted services.
//
// TODO(jeffbrown): This implementation is a temporary placeholder until
// we extend Mojo to provide a way to create tokens which cannot be forged.
struct ViewTreeToken {
uint32 value;
};
mojo/services/ui/views/interfaces/view_trees.mojom
浏览文件 @
989b29a6
...
...
@@ -7,23 +7,8 @@ module mojo.ui;
import "mojo/public/interfaces/application/service_provider.mojom";
import "mojo/services/gfx/composition/interfaces/renderers.mojom";
import "mojo/services/ui/views/interfaces/layouts.mojom";
import "mojo/services/ui/views/interfaces/views.mojom";
// A view tree token is an opaque transferable reference to a view tree.
//
// The ViewManager provides each view tree with a unique view tree token when
// it is registered. The token can subsequently be passed to other
// applications and used as a way to refer to the tree.
//
// View tree tokens should be kept secret and should only be shared with
// trusted services.
//
// TODO(jeffbrown): This implementation is a temporary placeholder until
// we extend Mojo to provide a way to create tokens which cannot be forged.
struct ViewTreeToken {
uint32 value;
};
import "mojo/services/ui/views/interfaces/view_containers.mojom";
import "mojo/services/ui/views/interfaces/view_tree_token.mojom";
// A view tree is a top-level container for a hierarchy of views.
// Each view is intended to operate independently from others and will
...
...
@@ -44,10 +29,11 @@ struct ViewTreeToken {
//
// To destroy a view tree, simply close the |ViewTree| message pipe.
//
// LAYOUT
// SETTING A ROOT VIEW
//
// Use |GetContainer()| to obtain an interface for manipulating the root view.
//
// TODO(jeffbrown): Elaborate this once the layout protocol has been
// redesigned.
// See |mojo.ui.ViewContainer| for more information.
//
// GETTING SERVICES
//
...
...
@@ -86,53 +72,8 @@ interface ViewTree {
// new layout due to a change in the view tree's layout information.
RequestLayout();
// Sets the root of the view tree and assigns it the provided |root_key|
// to distinguish it from any other roots this view tree has had.
//
// It is a good idea to provide a distinct |root_key| each time a new root
// is set so that callbacks related to the root can be clearly distinguished
// across these changes.
//
// If |root_view_owner| refers to a view which is already unavailable
// then the call proceeds as if it succeeded but an OnChildUnavailable()
// message will be sent.
//
// If |root_view_owner| refers to a view which already has a parent or is
// the root of a view tree then an OnChildUnavailable() or OnRootUnavailable()
// message will be sent to its old parent or root and the the view will be
// used as the root of the new view tree as usual. This special case also
// applies when the specified view is already the root of this view tree, in
// which case the behavior is similar to the view having been transferred to
// some other view tree and then back again.
//
// It is an error to call this function if the root has already been set;
// the connection will be closed.
SetRoot(uint32 root_key, mojo.ui.ViewOwner root_view_owner);
// Removes the root of the view tree.
//
// If |transferred_view_owner| is not null, associates it with the previously
// configured view or closes the |transferred_view_owner| message pipe
// if there was none.
//
// It is an error to call this function if the root was not previously set;
// the connection will be closed.
ClearRoot(mojo.ui.ViewOwner&? transferred_view_owner);
// Sets the layout parameters of the root of the view tree and retrieves
// its layout information.
//
// The returned |info| is null if this layout request was canceled either
// because it has been superceded by a subsequently issued layout request
// or because the root has become unavailable.
//
// It is an error to call this function if the view tree does not currently
// have a root; the connection will be closed.
//
// It is an error to specify malformed |root_layout_params| such
// as invalid size constraints; the connection will be closed.
LayoutRoot(mojo.ui.ViewLayoutParams root_layout_params) =>
(mojo.ui.ViewLayoutInfo? info);
// Gets an interface for managing the view tree's root.
GetContainer(ViewContainer& container);
};
// An interface clients may implement to receive events from a view tree.
...
...
@@ -153,16 +94,6 @@ interface ViewTreeListener {
// been handled and the view tree is ready to be shown in its new aspect.
OnLayout() => ();
// Called when the root view has become unavailable.
//
// The root may become unavailable for many reasons such being unregistered
// by its application, abnormal termination of its application, or
// being reparented into a different view tree.
//
// The implementation should invoke the callback once the event has
// been handled.
OnRootUnavailable(uint32 root_key) => ();
// Called when the tree's renderer connection closed unexpectedly.
//
// The implementation should invoke the callback once the event has
...
...
mojo/services/ui/views/interfaces/views.mojom
浏览文件 @
989b29a6
...
...
@@ -8,33 +8,8 @@ module mojo.ui;
import "mojo/public/interfaces/application/service_provider.mojom";
import "mojo/services/gfx/composition/interfaces/scenes.mojom";
import "mojo/services/ui/views/interfaces/layouts.mojom";
// A view token is an opaque transferable reference to a view.
//
// The ViewManager provides each view with a unique view token when
// it is registered. The token can subsequently be passed to other
// applications and may be used to add the view as a child of some
// other view or to set it as the root of a view tree.
//
// View tokens should be kept secret and should only be shared with
// the view's intended container.
//
// TODO(jeffbrown): This implementation is a temporary placeholder until
// we extend Mojo to provide a way to create tokens which cannot be forged.
struct ViewToken {
uint32 value;
};
// A view owner provides access to the view's token and keeps the
// view alive. When the view owner is closed, the view will be
// unregistered from the view manager.
//
// This interface is only intended to be implemented by the view manager
// to obtain the desired ownership semantics.
interface ViewOwner {
// Gets the |ViewToken| associated with the view.
GetToken() => (ViewToken token);
};
import "mojo/services/ui/views/interfaces/view_containers.mojom";
import "mojo/services/ui/views/interfaces/view_token.mojom";
// A view is a graphical user interface component which is responsible
// for drawing and supporting user interactions in the area of the screen
...
...
@@ -63,37 +38,11 @@ interface ViewOwner {
//
// See |mojo.gfx.compositor.Scene| for more information.
//
//
EMBEDDING
//
ADDING CHILD VIEWS
//
//
The following steps are required to embed another view into your own:
//
Use |GetContainer()| to obtain an interface for manipulating child views.
//
// 1. Obtain the |ViewOwner| belonging to the view you would like to embed.
// The means for doing this is not specified by the view system.
// You might create another view of your own to embed or connect to
// another application using a mechanism such as |ViewProvider| (or
// any suitable agreed-upon protocol) to create the view to embed.
//
// 2. Call |AddChild()| to add the view you would like to embed and assign
// it a unique key.
//
// 3. Call |LayoutChild()| to provide layout parameters for the new child
// using the key that was provided.
//
// 4. After obtaining the layout result from the child, publish an
// update to your |Scene| which includes a reference to the child's own
// scene using the |SceneToken| included in the layout result.
//
// 5. Watch for the child becoming unavailable, as reported by
// |OnChildUnavailable()|, which indicates that the child is no longer
// in a usable state (perhaps the application which provided it has
// stopped). When this happens, you are still responsible for calling
// |RemoveChild()| to remove the child and discard any state that your
// view has associated with it.
//
// LAYOUT
//
// TODO(jeffbrown): Elaborate this once the layout protocol has been
// redesigned.
// See |mojo.ui.ViewContainer| for more information.
//
// GETTING SERVICES
//
...
...
@@ -135,67 +84,8 @@ interface View {
// new layout due to a change in the view's layout information.
RequestLayout();
// Adds the view referenced by |child_view_owner| as a child and assigns
// it the provided |child_key| to identify it among its children.
// The parent may remove the child later by passing the same |child_key|
// to RemoveChild().
//
// This method takes ownership of the view.
//
// It is important for the parent to choose locally unique values for
// |child_key| to ensure that each child can be distinguished even as
// more children are added or removed. We recommend using a simple
// counter which is incremented on each (re-)addition.
//
// If the child becomes unavailable at any time prior to being removed
// then an OnChildUnavailable() message will be sent.
//
// If |child_view_owner| refers to a view which is already unavailable or
// if adding the view would create a cycle in the view tree then the
// call proceeds as if it succeeded but an OnChildUnavailable() message
// will be sent.
//
// If |child_view_owner| refers to a view which already has a parent or is
// the root of a view tree then an OnChildUnavailable() or OnRootUnavailable()
// message will be sent to its old parent or root and the the view will be
// (re-)added to its new parent as usual. This special case also applies
// when the specified view is already a child of this view, in which
// case the behavior is similar to the view having been transferred to
// some other parent and then back again.
//
// Note that an unavailable child will remain in its parent's list of
// children until its parent explicitly calls RemoveChild() to remove
// it.
//
// It is an error to add a view whose |child_key| already appears
// in the view's list of children; the connection will be closed.
AddChild(uint32 child_key, mojo.ui.ViewOwner child_view_owner);
// Removes the view referenced by |child_key| from the view's
// list of children.
//
// If |transferred_view_owner| is not null, associates it with the
// previously added child to allow it to be transferred elsewhere or
// closes the |transferred_view_owner| message pipe if there was none.
//
// It is an error to remove a view whose |child_key| does not appear
// in the parent's list of children; the connection will be closed.
RemoveChild(uint32 child_key, mojo.ui.ViewOwner&? transferred_view_owner);
// Sets the layout parameters of the child view referenced by |child_key|
// and retrieves its layout information.
//
// The returned |info| is null if this layout request was canceled either
// because it has been superceded by a subsequently issued layout request
// or because the child has become unavailable.
//
// It is an error to specify a |child_key| that does not appear in
// the parent's list of children; the connection will be closed.
//
// It is an error to specify malformed |child_layout_params| such
// as invalid size constraints; the connection will be closed.
LayoutChild(uint32 child_key, mojo.ui.ViewLayoutParams child_layout_params)
=> (mojo.ui.ViewLayoutInfo? info);
// Gets an interface for managing the view's children.
GetContainer(ViewContainer& container);
};
// An interface clients may implement to receive events from a view.
...
...
@@ -242,17 +132,4 @@ interface ViewListener {
// exceeds the requested constraints; the view's connection will be closed.
OnLayout(mojo.ui.ViewLayoutParams layout_params,
array<uint32> children_needing_layout) => (mojo.ui.ViewLayoutResult result);
// Called when a child view has become unavailable.
//
// A child may become unavailable for many reasons such being unregistered
// by its application, abnormal termination of its application, or
// cycles being introduced in the view tree.
//
// To complete removal of an unavailable child, this view component must
// call RemoveChild() on its view with |child_key|.
//
// The implementation should invoke the callback once the event has
// been handled.
OnChildUnavailable(uint32 child_key) => ();
};
sky/packages/sky_services/pubspec.yaml
浏览文件 @
989b29a6
...
...
@@ -4,6 +4,6 @@ author: Flutter Authors <flutter-dev@googlegroups.com>
description
:
Mojom interfaces associated with Flutter
homepage
:
http://flutter.io
dependencies
:
mojo_sdk
:
0.2.
19
mojo_sdk
:
0.2.
20
environment
:
sdk
:
'
>=1.8.0
<2.0.0'
sky/shell/platform/mojo/view_impl.cc
浏览文件 @
989b29a6
...
...
@@ -113,11 +113,6 @@ void ViewImpl::OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params,
callback
.
Run
(
info
.
Pass
());
}
void
ViewImpl
::
OnChildUnavailable
(
uint32_t
child_key
,
const
OnChildUnavailableCallback
&
callback
)
{
callback
.
Run
();
}
void
ViewImpl
::
OnEvent
(
mojo
::
EventPtr
event
,
const
OnEventCallback
&
callback
)
{
DCHECK
(
event
);
bool
consumed
=
false
;
...
...
sky/shell/platform/mojo/view_impl.h
浏览文件 @
989b29a6
...
...
@@ -41,8 +41,6 @@ class ViewImpl : public mojo::ui::ViewListener,
void
OnLayout
(
mojo
::
ui
::
ViewLayoutParamsPtr
layout_params
,
mojo
::
Array
<
uint32_t
>
children_needing_layout
,
const
OnLayoutCallback
&
callback
)
override
;
void
OnChildUnavailable
(
uint32_t
child_key
,
const
OnChildUnavailableCallback
&
callback
)
override
;
// mojo::ui::InputListener
void
OnEvent
(
mojo
::
EventPtr
event
,
const
OnEventCallback
&
callback
)
override
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录