Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
c3976b3c
E
engine
项目概览
qq_34031325
/
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,发现更多精彩内容 >>
未验证
提交
c3976b3c
编写于
6月 12, 2018
作者:
B
Ben Konyi
提交者:
GitHub
6月 12, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Added IsolateNameServer functionality (#5410)" (#5516)
This reverts commit
61a2d129
.
上级
61a2d129
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
22 addition
and
426 deletion
+22
-426
lib/ui/BUILD.gn
lib/ui/BUILD.gn
+0
-4
lib/ui/dart_ui.cc
lib/ui/dart_ui.cc
+0
-2
lib/ui/dart_ui.gni
lib/ui/dart_ui.gni
+0
-1
lib/ui/isolate_name_server.dart
lib/ui/isolate_name_server.dart
+0
-44
lib/ui/isolate_name_server/isolate_name_server.cc
lib/ui/isolate_name_server/isolate_name_server.cc
+0
-44
lib/ui/isolate_name_server/isolate_name_server.h
lib/ui/isolate_name_server/isolate_name_server.h
+0
-50
lib/ui/isolate_name_server/isolate_name_server_natives.cc
lib/ui/isolate_name_server/isolate_name_server_natives.cc
+0
-64
lib/ui/isolate_name_server/isolate_name_server_natives.h
lib/ui/isolate_name_server/isolate_name_server_natives.h
+0
-27
lib/ui/ui.dart
lib/ui/ui.dart
+0
-2
lib/ui/ui_dart_state.cc
lib/ui/ui_dart_state.cc
+2
-8
lib/ui/ui_dart_state.h
lib/ui/ui_dart_state.h
+1
-6
runtime/dart_isolate.cc
runtime/dart_isolate.cc
+5
-6
runtime/dart_isolate.h
runtime/dart_isolate.h
+4
-4
runtime/dart_vm.cc
runtime/dart_vm.cc
+0
-4
runtime/dart_vm.h
runtime/dart_vm.h
+0
-4
runtime/dart_vm_unittests.cc
runtime/dart_vm_unittests.cc
+0
-14
runtime/runtime_controller.cc
runtime/runtime_controller.cc
+2
-2
runtime/runtime_controller.h
runtime/runtime_controller.h
+3
-3
shell/common/engine.cc
shell/common/engine.cc
+1
-1
shell/common/engine.h
shell/common/engine.h
+1
-1
shell/common/shell.cc
shell/common/shell.cc
+1
-1
shell/common/shell.h
shell/common/shell.h
+1
-1
testing/dart/isolate_name_server_test.dart
testing/dart/isolate_name_server_test.dart
+0
-128
testing/run_tests.sh
testing/run_tests.sh
+1
-0
travis/licenses_golden/licenses_flutter
travis/licenses_golden/licenses_flutter
+0
-5
未找到文件。
lib/ui/BUILD.gn
浏览文件 @
c3976b3c
...
...
@@ -14,10 +14,6 @@ source_set("ui") {
"dart_runtime_hooks.h",
"dart_ui.cc",
"dart_ui.h",
"isolate_name_server/isolate_name_server.cc",
"isolate_name_server/isolate_name_server.h",
"isolate_name_server/isolate_name_server_natives.cc",
"isolate_name_server/isolate_name_server_natives.h",
"painting/canvas.cc",
"painting/canvas.h",
"painting/codec.cc",
...
...
lib/ui/dart_ui.cc
浏览文件 @
c3976b3c
...
...
@@ -7,7 +7,6 @@
#include "flutter/lib/ui/compositing/scene.h"
#include "flutter/lib/ui/compositing/scene_builder.h"
#include "flutter/lib/ui/dart_runtime_hooks.h"
#include "flutter/lib/ui/isolate_name_server/isolate_name_server_natives.h"
#include "flutter/lib/ui/painting/canvas.h"
#include "flutter/lib/ui/painting/codec.h"
#include "flutter/lib/ui/painting/frame_info.h"
...
...
@@ -61,7 +60,6 @@ void DartUI::InitForGlobal() {
FrameInfo
::
RegisterNatives
(
g_natives
);
ImageFilter
::
RegisterNatives
(
g_natives
);
ImageShader
::
RegisterNatives
(
g_natives
);
IsolateNameServerNatives
::
RegisterNatives
(
g_natives
);
Paragraph
::
RegisterNatives
(
g_natives
);
ParagraphBuilder
::
RegisterNatives
(
g_natives
);
Picture
::
RegisterNatives
(
g_natives
);
...
...
lib/ui/dart_ui.gni
浏览文件 @
c3976b3c
...
...
@@ -7,7 +7,6 @@ dart_ui_files = [
"$flutter_root/lib/ui/geometry.dart",
"$flutter_root/lib/ui/hash_codes.dart",
"$flutter_root/lib/ui/hooks.dart",
"$flutter_root/lib/ui/isolate_name_server.dart",
"$flutter_root/lib/ui/lerp.dart",
"$flutter_root/lib/ui/natives.dart",
"$flutter_root/lib/ui/painting.dart",
...
...
lib/ui/isolate_name_server.dart
已删除
100644 → 0
浏览文件 @
61a2d129
// Copyright 2018 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.
part of
dart
.
ui
;
abstract
class
IsolateNameServer
{
// Looks up the [SendPort] associated with a given name. Returns null
// if the name does not exist.
static
SendPort
lookupPortByName
(
String
name
)
{
if
(
name
==
null
)
{
throw
new
ArgumentError
(
"'name' cannot be null."
);
}
return
_lookupPortByName
(
name
);
}
// Registers a SendPort with a given name. Returns true if registration is
// successful, false if the name entry already exists.
static
bool
registerPortWithName
(
SendPort
port
,
String
name
)
{
if
(
name
==
null
)
{
throw
new
ArgumentError
(
"'name' cannot be null."
);
}
if
(
port
==
null
)
{
throw
new
ArgumentError
(
"'port' cannot be null."
);
}
return
_registerPortWithName
(
port
,
name
);
}
// Removes a name to SendPort mapping given a name. Returns true if the
// mapping was successfully removed, false if the mapping does not exist.
static
bool
removePortNameMapping
(
String
name
)
{
if
(
name
==
null
)
{
throw
new
ArgumentError
(
"'name' cannot be null."
);
}
return
_removePortNameMapping
(
name
);
}
static
SendPort
_lookupPortByName
(
String
name
)
native
'IsolateNameServerNatives_LookupPortByName'
;
static
bool
_registerPortWithName
(
SendPort
port
,
String
name
)
native
'IsolateNameServerNatives_RegisterPortWithName'
;
static
bool
_removePortNameMapping
(
String
name
)
native
'IsolateNameServerNatives_RemovePortNameMapping'
;
}
lib/ui/isolate_name_server/isolate_name_server.cc
已删除
100644 → 0
浏览文件 @
61a2d129
// Copyright 2018 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
namespace
blink
{
Dart_Port
IsolateNameServer
::
LookupIsolatePortByName
(
const
std
::
string
&
name
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
return
LookupIsolatePortByNameUnprotected
(
name
);
}
Dart_Port
IsolateNameServer
::
LookupIsolatePortByNameUnprotected
(
const
std
::
string
&
name
)
{
auto
port_iterator
=
port_mapping_
.
find
(
name
);
if
(
port_iterator
!=
port_mapping_
.
end
())
{
return
port_iterator
->
second
;
}
return
ILLEGAL_PORT
;
}
bool
IsolateNameServer
::
RegisterIsolatePortWithName
(
Dart_Port
port
,
const
std
::
string
&
name
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
if
(
LookupIsolatePortByNameUnprotected
(
name
)
!=
ILLEGAL_PORT
)
{
// Name is already registered.
return
false
;
}
port_mapping_
[
name
]
=
port
;
return
true
;
}
bool
IsolateNameServer
::
RemoveIsolateNameMapping
(
const
std
::
string
&
name
)
{
std
::
unique_lock
<
std
::
mutex
>
lock
(
mutex_
);
auto
port_iterator
=
port_mapping_
.
find
(
name
);
if
(
port_iterator
==
port_mapping_
.
end
())
{
return
false
;
}
port_mapping_
.
erase
(
port_iterator
);
return
true
;
}
}
// namespace blink
lib/ui/isolate_name_server/isolate_name_server.h
已删除
100644 → 0
浏览文件 @
61a2d129
// Copyright 2018 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_H_
#define FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_H_
#include <map>
#include <mutex>
#include <string>
#include "flutter/fml/synchronization/thread_annotations.h"
#include "lib/fxl/macros.h"
#include "third_party/dart/runtime/include/dart_api.h"
#define LOCK_UNLOCK(m) FML_ACQUIRE(m) FML_RELEASE(m)
namespace
blink
{
class
IsolateNameServer
{
public:
IsolateNameServer
()
{}
// Looks up the Dart_Port associated with a given name. Returns ILLEGAL_PORT
// if the name does not exist.
Dart_Port
LookupIsolatePortByName
(
const
std
::
string
&
name
)
LOCK_UNLOCK
(
mutex_
);
// Registers a Dart_Port with a given name. Returns true if registration is
// successful, false if the name entry already exists.
bool
RegisterIsolatePortWithName
(
Dart_Port
port
,
const
std
::
string
&
name
)
LOCK_UNLOCK
(
mutex_
);
// Removes a name to Dart_Port mapping given a name. Returns true if the
// mapping was successfully removed, false if the mapping does not exist.
bool
RemoveIsolateNameMapping
(
const
std
::
string
&
name
)
LOCK_UNLOCK
(
mutex_
);
private:
Dart_Port
LookupIsolatePortByNameUnprotected
(
const
std
::
string
&
name
)
FML_EXCLUSIVE_LOCKS_REQUIRED
(
mutex_
);
mutable
std
::
mutex
mutex_
;
std
::
map
<
std
::
string
,
Dart_Port
>
port_mapping_
FML_GUARDED_BY
(
mutex_
);
FXL_DISALLOW_COPY_AND_ASSIGN
(
IsolateNameServer
);
};
}
// namespace blink
#endif // FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_H_
lib/ui/isolate_name_server/isolate_name_server_natives.cc
已删除
100644 → 0
浏览文件 @
61a2d129
// Copyright 2018 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
#include "flutter/lib/ui/isolate_name_server/isolate_name_server_natives.h"
#include "flutter/lib/ui/ui_dart_state.h"
#include "lib/tonic/dart_binding_macros.h"
#include "lib/tonic/dart_library_natives.h"
namespace
blink
{
Dart_Handle
IsolateNameServerNatives
::
LookupPortByName
(
const
std
::
string
&
name
)
{
IsolateNameServer
*
name_server
=
UIDartState
::
Current
()
->
GetIsolateNameServer
();
Dart_Port
port
=
name_server
->
LookupIsolatePortByName
(
name
);
if
(
port
==
ILLEGAL_PORT
)
{
return
Dart_Null
();
}
return
Dart_NewSendPort
(
port
);
}
Dart_Handle
IsolateNameServerNatives
::
RegisterPortWithName
(
Dart_Handle
port_handle
,
const
std
::
string
&
name
)
{
IsolateNameServer
*
name_server
=
UIDartState
::
Current
()
->
GetIsolateNameServer
();
Dart_Port
port
=
ILLEGAL_PORT
;
Dart_SendPortGetId
(
port_handle
,
&
port
);
if
(
!
name_server
->
RegisterIsolatePortWithName
(
port
,
name
))
{
return
Dart_False
();
}
return
Dart_True
();
}
Dart_Handle
IsolateNameServerNatives
::
RemovePortNameMapping
(
const
std
::
string
&
name
)
{
IsolateNameServer
*
name_server
=
UIDartState
::
Current
()
->
GetIsolateNameServer
();
if
(
!
name_server
->
RemoveIsolateNameMapping
(
name
))
{
return
Dart_False
();
}
return
Dart_True
();
}
#define FOR_EACH_BINDING(V) \
V(IsolateNameServerNatives, LookupPortByName) \
V(IsolateNameServerNatives, RegisterPortWithName) \
V(IsolateNameServerNatives, RemovePortNameMapping)
FOR_EACH_BINDING
(
DART_NATIVE_CALLBACK_STATIC
)
#define DART_REGISTER_NATIVE_STATIC_(CLASS, METHOD) \
DART_REGISTER_NATIVE_STATIC(CLASS, METHOD),
void
IsolateNameServerNatives
::
RegisterNatives
(
tonic
::
DartLibraryNatives
*
natives
)
{
natives
->
Register
({
FOR_EACH_BINDING
(
DART_REGISTER_NATIVE_STATIC_
)});
}
}
// namespace blink
lib/ui/isolate_name_server/isolate_name_server_natives.h
已删除
100644 → 0
浏览文件 @
61a2d129
// Copyright 2018 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_NATIVES_H_
#define FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_NATIVES_H_
#include "third_party/dart/runtime/include/dart_api.h"
namespace
tonic
{
class
DartLibraryNatives
;
}
// namespace tonic
namespace
blink
{
class
IsolateNameServerNatives
{
public:
static
Dart_Handle
LookupPortByName
(
const
std
::
string
&
name
);
static
Dart_Handle
RegisterPortWithName
(
Dart_Handle
port_handle
,
const
std
::
string
&
name
);
static
Dart_Handle
RemovePortNameMapping
(
const
std
::
string
&
name
);
static
void
RegisterNatives
(
tonic
::
DartLibraryNatives
*
natives
);
};
}
// namespace blink
#endif // FLUTTER_LIB_UI_ISOLATE_NAME_SERVER_NATIVES_H_
lib/ui/ui.dart
浏览文件 @
c3976b3c
...
...
@@ -17,7 +17,6 @@ import 'dart:collection' as collection;
import
'dart:convert'
;
import
'dart:developer'
as
developer
;
import
'dart:io'
;
import
'dart:isolate'
show
SendPort
;
import
'dart:math'
as
math
;
import
'dart:nativewrappers'
;
import
'dart:typed_data'
;
...
...
@@ -26,7 +25,6 @@ part 'compositing.dart';
part
'geometry.dart'
;
part
'hash_codes.dart'
;
part
'hooks.dart'
;
part
'isolate_name_server.dart'
;
part
'lerp.dart'
;
part
'natives.dart'
;
part
'painting.dart'
;
...
...
lib/ui/ui_dart_state.cc
浏览文件 @
c3976b3c
...
...
@@ -19,8 +19,7 @@ UIDartState::UIDartState(TaskRunners task_runners,
fxl
::
RefPtr
<
flow
::
SkiaUnrefQueue
>
skia_unref_queue
,
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
std
::
string
logger_prefix
,
IsolateNameServer
*
isolate_name_server
)
std
::
string
logger_prefix
)
:
task_runners_
(
std
::
move
(
task_runners
)),
add_callback_
(
std
::
move
(
add_callback
)),
remove_callback_
(
std
::
move
(
remove_callback
)),
...
...
@@ -28,8 +27,7 @@ UIDartState::UIDartState(TaskRunners task_runners,
advisory_script_uri_
(
std
::
move
(
advisory_script_uri
)),
advisory_script_entrypoint_
(
std
::
move
(
advisory_script_entrypoint
)),
logger_prefix_
(
std
::
move
(
logger_prefix
)),
skia_unref_queue_
(
std
::
move
(
skia_unref_queue
)),
isolate_name_server_
(
isolate_name_server
)
{
skia_unref_queue_
(
std
::
move
(
skia_unref_queue
))
{
AddOrRemoveTaskObserver
(
true
/* add */
);
}
...
...
@@ -102,8 +100,4 @@ fml::WeakPtr<GrContext> UIDartState::GetResourceContext() const {
return
resource_context_
;
}
IsolateNameServer
*
UIDartState
::
GetIsolateNameServer
()
{
return
isolate_name_server_
;
}
}
// namespace blink
lib/ui/ui_dart_state.h
浏览文件 @
c3976b3c
...
...
@@ -13,7 +13,6 @@
#include "flutter/common/task_runners.h"
#include "flutter/flow/skia_gpu_object.h"
#include "flutter/fml/memory/weak_ptr.h"
#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
#include "lib/fxl/build_config.h"
#include "lib/tonic/dart_microtask_queue.h"
#include "lib/tonic/dart_persistent_value.h"
...
...
@@ -47,8 +46,6 @@ class UIDartState : public tonic::DartState {
fml
::
WeakPtr
<
GrContext
>
GetResourceContext
()
const
;
IsolateNameServer
*
GetIsolateNameServer
();
template
<
class
T
>
static
flow
::
SkiaGPUObject
<
T
>
CreateGPUObject
(
sk_sp
<
T
>
object
)
{
if
(
!
object
)
{
...
...
@@ -68,8 +65,7 @@ class UIDartState : public tonic::DartState {
fxl
::
RefPtr
<
flow
::
SkiaUnrefQueue
>
skia_unref_queue
,
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
std
::
string
logger_prefix
,
IsolateNameServer
*
isolate_name_server
);
std
::
string
logger_prefix
);
~
UIDartState
()
override
;
...
...
@@ -94,7 +90,6 @@ class UIDartState : public tonic::DartState {
std
::
unique_ptr
<
Window
>
window_
;
fxl
::
RefPtr
<
flow
::
SkiaUnrefQueue
>
skia_unref_queue_
;
tonic
::
DartMicrotaskQueue
microtask_queue_
;
IsolateNameServer
*
isolate_name_server_
;
void
AddOrRemoveTaskObserver
(
bool
add
);
};
...
...
runtime/dart_isolate.cc
浏览文件 @
c3976b3c
...
...
@@ -33,7 +33,7 @@
namespace
blink
{
fml
::
WeakPtr
<
DartIsolate
>
DartIsolate
::
CreateRootIsolate
(
DartVM
*
vm
,
const
DartVM
*
vm
,
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
...
...
@@ -94,7 +94,7 @@ fml::WeakPtr<DartIsolate> DartIsolate::CreateRootIsolate(
return
embedder_isolate
;
}
DartIsolate
::
DartIsolate
(
DartVM
*
vm
,
DartIsolate
::
DartIsolate
(
const
DartVM
*
vm
,
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
...
...
@@ -110,8 +110,7 @@ DartIsolate::DartIsolate(DartVM* vm,
std
::
move
(
unref_queue
),
advisory_script_uri
,
advisory_script_entrypoint
,
vm
->
GetSettings
().
log_tag
,
vm
->
GetIsolateNameServer
()),
vm
->
GetSettings
().
log_tag
),
vm_
(
vm
),
isolate_snapshot_
(
std
::
move
(
isolate_snapshot
)),
shared_snapshot_
(
std
::
move
(
shared_snapshot
)),
...
...
@@ -132,7 +131,7 @@ DartIsolate::Phase DartIsolate::GetPhase() const {
return
phase_
;
}
DartVM
*
DartIsolate
::
GetDartVM
()
const
{
const
DartVM
*
DartIsolate
::
GetDartVM
()
const
{
return
vm_
;
}
...
...
@@ -652,7 +651,7 @@ DartIsolate::CreateDartVMAndEmbedderObjectPair(
return
{
nullptr
,
{}};
}
DartVM
*
const
vm
=
embedder_isolate
->
GetDartVM
();
const
DartVM
*
vm
=
embedder_isolate
->
GetDartVM
();
if
(
!
is_root_isolate
)
{
auto
raw_embedder_isolate
=
embedder_isolate
.
release
();
...
...
runtime/dart_isolate.h
浏览文件 @
c3976b3c
...
...
@@ -39,7 +39,7 @@ class DartIsolate : public UIDartState {
// bindings. From the VM's perspective, this isolate is not special in any
// way.
static
fml
::
WeakPtr
<
DartIsolate
>
CreateRootIsolate
(
DartVM
*
vm
,
const
DartVM
*
vm
,
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
...
...
@@ -50,7 +50,7 @@ class DartIsolate : public UIDartState {
std
::
string
advisory_script_entrypoint
,
Dart_IsolateFlags
*
flags
=
nullptr
);
DartIsolate
(
DartVM
*
vm
,
DartIsolate
(
const
DartVM
*
vm
,
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
...
...
@@ -84,7 +84,7 @@ class DartIsolate : public UIDartState {
void
AddIsolateShutdownCallback
(
fxl
::
Closure
closure
);
DartVM
*
GetDartVM
()
const
;
const
DartVM
*
GetDartVM
()
const
;
fxl
::
RefPtr
<
DartSnapshot
>
GetIsolateSnapshot
()
const
;
fxl
::
RefPtr
<
DartSnapshot
>
GetSharedSnapshot
()
const
;
...
...
@@ -107,7 +107,7 @@ class DartIsolate : public UIDartState {
};
friend
class
DartVM
;
DartVM
*
const
vm_
=
nullptr
;
const
DartVM
*
vm_
=
nullptr
;
Phase
phase_
=
Phase
::
Unknown
;
const
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot_
;
const
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot_
;
...
...
runtime/dart_vm.cc
浏览文件 @
c3976b3c
...
...
@@ -471,10 +471,6 @@ const DartSnapshot& DartVM::GetVMSnapshot() const {
return
*
vm_snapshot_
.
get
();
}
IsolateNameServer
*
DartVM
::
GetIsolateNameServer
()
{
return
&
isolate_name_server_
;
}
fxl
::
RefPtr
<
DartSnapshot
>
DartVM
::
GetIsolateSnapshot
()
const
{
return
isolate_snapshot_
;
}
...
...
runtime/dart_vm.h
浏览文件 @
c3976b3c
...
...
@@ -10,7 +10,6 @@
#include <vector>
#include "flutter/common/settings.h"
#include "flutter/lib/ui/isolate_name_server/isolate_name_server.h"
#include "flutter/runtime/dart_isolate.h"
#include "flutter/runtime/dart_snapshot.h"
#include "flutter/runtime/service_protocol.h"
...
...
@@ -44,8 +43,6 @@ class DartVM : public fxl::RefCountedThreadSafe<DartVM> {
const
DartSnapshot
&
GetVMSnapshot
()
const
;
IsolateNameServer
*
GetIsolateNameServer
();
fxl
::
RefPtr
<
DartSnapshot
>
GetIsolateSnapshot
()
const
;
fxl
::
RefPtr
<
DartSnapshot
>
GetSharedSnapshot
()
const
;
...
...
@@ -56,7 +53,6 @@ class DartVM : public fxl::RefCountedThreadSafe<DartVM> {
private:
const
Settings
settings_
;
const
fxl
::
RefPtr
<
DartSnapshot
>
vm_snapshot_
;
IsolateNameServer
isolate_name_server_
;
const
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot_
;
const
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot_
;
std
::
unique_ptr
<
fml
::
Mapping
>
platform_kernel_mapping_
;
...
...
runtime/dart_vm_unittests.cc
浏览文件 @
c3976b3c
...
...
@@ -18,18 +18,4 @@ TEST(DartVM, SimpleInitialization) {
ASSERT_EQ
(
vm
->
GetPlatformKernel
().
GetSize
(),
0u
);
}
TEST
(
DartVM
,
SimpleIsolateNameServer
)
{
Settings
settings
=
{};
settings
.
task_observer_add
=
[](
intptr_t
,
fxl
::
Closure
)
{};
settings
.
task_observer_remove
=
[](
intptr_t
)
{};
auto
vm
=
DartVM
::
ForProcess
(
settings
);
auto
ns
=
vm
->
GetIsolateNameServer
();
ASSERT_EQ
(
ns
->
LookupIsolatePortByName
(
"foobar"
),
ILLEGAL_PORT
);
ASSERT_FALSE
(
ns
->
RemoveIsolateNameMapping
(
"foobar"
));
ASSERT_TRUE
(
ns
->
RegisterIsolatePortWithName
(
123
,
"foobar"
));
ASSERT_FALSE
(
ns
->
RegisterIsolatePortWithName
(
123
,
"foobar"
));
ASSERT_EQ
(
ns
->
LookupIsolatePortByName
(
"foobar"
),
123
);
ASSERT_TRUE
(
ns
->
RemoveIsolateNameMapping
(
"foobar"
));
}
}
// namespace blink
runtime/runtime_controller.cc
浏览文件 @
c3976b3c
...
...
@@ -20,7 +20,7 @@ namespace blink {
RuntimeController
::
RuntimeController
(
RuntimeDelegate
&
p_client
,
DartVM
*
p_vm
,
const
DartVM
*
p_vm
,
fxl
::
RefPtr
<
DartSnapshot
>
p_isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
p_shared_snapshot
,
TaskRunners
p_task_runners
,
...
...
@@ -41,7 +41,7 @@ RuntimeController::RuntimeController(
RuntimeController
::
RuntimeController
(
RuntimeDelegate
&
p_client
,
DartVM
*
p_vm
,
const
DartVM
*
p_vm
,
fxl
::
RefPtr
<
DartSnapshot
>
p_isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
p_shared_snapshot
,
TaskRunners
p_task_runners
,
...
...
runtime/runtime_controller.h
浏览文件 @
c3976b3c
...
...
@@ -24,7 +24,7 @@ class Window;
class
RuntimeController
final
:
public
WindowClient
{
public:
RuntimeController
(
RuntimeDelegate
&
client
,
DartVM
*
vm
,
const
DartVM
*
vm
,
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
...
...
@@ -82,7 +82,7 @@ class RuntimeController final : public WindowClient {
};
RuntimeDelegate
&
client_
;
DartVM
*
const
vm_
;
const
DartVM
*
vm_
;
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot_
;
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot_
;
TaskRunners
task_runners_
;
...
...
@@ -95,7 +95,7 @@ class RuntimeController final : public WindowClient {
std
::
pair
<
bool
,
uint32_t
>
root_isolate_return_code_
=
{
false
,
0
};
RuntimeController
(
RuntimeDelegate
&
client
,
DartVM
*
vm
,
const
DartVM
*
vm
,
fxl
::
RefPtr
<
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
DartSnapshot
>
shared_snapshot
,
TaskRunners
task_runners
,
...
...
shell/common/engine.cc
浏览文件 @
c3976b3c
...
...
@@ -36,7 +36,7 @@ static constexpr char kLocalizationChannel[] = "flutter/localization";
static
constexpr
char
kSettingsChannel
[]
=
"flutter/settings"
;
Engine
::
Engine
(
Delegate
&
delegate
,
blink
::
DartVM
&
vm
,
const
blink
::
DartVM
&
vm
,
fxl
::
RefPtr
<
blink
::
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
blink
::
DartSnapshot
>
shared_snapshot
,
blink
::
TaskRunners
task_runners
,
...
...
shell/common/engine.h
浏览文件 @
c3976b3c
...
...
@@ -39,7 +39,7 @@ class Engine final : public blink::RuntimeDelegate {
};
Engine
(
Delegate
&
delegate
,
blink
::
DartVM
&
vm
,
const
blink
::
DartVM
&
vm
,
fxl
::
RefPtr
<
blink
::
DartSnapshot
>
isolate_snapshot
,
fxl
::
RefPtr
<
blink
::
DartSnapshot
>
shared_snapshot
,
blink
::
TaskRunners
task_runners
,
...
...
shell/common/shell.cc
浏览文件 @
c3976b3c
...
...
@@ -400,7 +400,7 @@ fml::WeakPtr<PlatformView> Shell::GetPlatformView() {
return
platform_view_
->
GetWeakPtr
();
}
blink
::
DartVM
&
Shell
::
GetDartVM
()
const
{
const
blink
::
DartVM
&
Shell
::
GetDartVM
()
const
{
return
*
vm_
;
}
...
...
shell/common/shell.h
浏览文件 @
c3976b3c
...
...
@@ -72,7 +72,7 @@ class Shell final : public PlatformView::Delegate,
fml
::
WeakPtr
<
PlatformView
>
GetPlatformView
();
blink
::
DartVM
&
GetDartVM
()
const
;
const
blink
::
DartVM
&
GetDartVM
()
const
;
bool
IsSetup
()
const
;
...
...
testing/dart/isolate_name_server_test.dart
已删除
100644 → 0
浏览文件 @
61a2d129
// Copyright 2018 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
'dart:async'
;
import
'dart:isolate'
;
import
'dart:ui'
;
import
'package:test/test.dart'
;
const
kPortName
=
'foobar'
;
const
kErrorCode
=
-
1
;
const
kStartCode
=
0
;
const
kCloseCode
=
1
;
const
kDeletedCode
=
2
;
void
isolateSpawnEntrypoint
(
SendPort
port
)
{
sendHelper
(
int
code
,
[
String
message
=
''
])
{
port
.
send
(<
dynamic
>[
code
,
message
]);
}
SendPort
shared
=
IsolateNameServer
.
lookupPortByName
(
kPortName
);
if
(
shared
==
null
)
{
sendHelper
(
kErrorCode
,
'Could not find port:
$kPortName
'
);
return
;
}
// ack that the SendPort lookup was successful.
sendHelper
(
kStartCode
);
//shared.send(kPortName);
sendHelper
(
kCloseCode
);
// We'll fail if the ReceivePort's callback is called more than once. Try to
// send another message to ensure we don't crash.
shared
.
send
(
'garbage'
);
bool
result
=
IsolateNameServer
.
removePortNameMapping
(
kPortName
);
if
(
result
)
{
sendHelper
(
kDeletedCode
);
}
else
{
sendHelper
(
kErrorCode
,
'Was unable to remove mapping for
$kPortName
'
);
}
}
void
main
(
)
{
tearDown
(()
{
IsolateNameServer
.
removePortNameMapping
(
kPortName
);
});
test
(
'simple isolate name server'
,
()
{
// Mapping for 'foobar' isn't set. Check these cases to ensure correct
// negative response.
expect
(
IsolateNameServer
.
lookupPortByName
(
kPortName
),
isNull
);
expect
(
IsolateNameServer
.
removePortNameMapping
(
kPortName
),
isFalse
);
// Register a SendPort.
final
receivePort
=
new
ReceivePort
();
final
sendPort
=
receivePort
.
sendPort
;
expect
(
IsolateNameServer
.
registerPortWithName
(
sendPort
,
kPortName
),
isTrue
);
expect
(
IsolateNameServer
.
lookupPortByName
(
kPortName
),
sendPort
);
// Check we can't register the same name twice.
final
receivePort2
=
new
ReceivePort
();
final
sendPort2
=
receivePort2
.
sendPort
;
expect
(
IsolateNameServer
.
registerPortWithName
(
sendPort2
,
kPortName
),
isFalse
);
expect
(
IsolateNameServer
.
lookupPortByName
(
kPortName
),
sendPort
);
// Remove the mapping.
expect
(
IsolateNameServer
.
removePortNameMapping
(
kPortName
),
isTrue
);
expect
(
IsolateNameServer
.
lookupPortByName
(
kPortName
),
isNull
);
// Ensure registering a new port with the old name returns the new port.
expect
(
IsolateNameServer
.
registerPortWithName
(
sendPort2
,
kPortName
),
isTrue
);
expect
(
IsolateNameServer
.
lookupPortByName
(
kPortName
),
sendPort2
);
});
test
(
'isolate name server null args'
,
()
{
// None of our IsolateNameServer methods should accept null.
expect
(()
=>
IsolateNameServer
.
lookupPortByName
(
null
),
throwsArgumentError
);
expect
(()
=>
IsolateNameServer
.
registerPortWithName
(
null
,
'abc'
),
throwsArgumentError
);
final
receivePort
=
new
ReceivePort
();
final
sendPort
=
receivePort
.
sendPort
;
expect
(()
=>
IsolateNameServer
.
registerPortWithName
(
sendPort
,
null
),
throwsArgumentError
);
expect
(()
=>
IsolateNameServer
.
removePortNameMapping
(
null
),
throwsArgumentError
);
});
test
(
'isolate name server multi-isolate'
,
()
async
{
// Register our send port with the name server.
final
receivePort
=
new
ReceivePort
();
final
sendPort
=
receivePort
.
sendPort
;
expect
(
IsolateNameServer
.
registerPortWithName
(
sendPort
,
kPortName
),
isTrue
);
// Test driver.
final
testReceivePort
=
new
ReceivePort
();
testReceivePort
.
listen
(
expectAsync1
((
List
response
)
{
final
int
code
=
response
[
0
];
final
String
message
=
response
[
1
];
switch
(
code
)
{
case
kStartCode:
break
;
case
kCloseCode:
receivePort
.
close
();
break
;
case
kDeletedCode:
expect
(
IsolateNameServer
.
lookupPortByName
(
kPortName
),
isNull
);
break
;
case
kErrorCode:
throw
message
;
default
:
throw
'UNREACHABLE'
;
}
},
count:
3
));
receivePort
.
listen
(
expectAsync1
((
message
)
{
// If we don't get this message, we timeout and fail.
expect
(
message
,
kPortName
);
}));
// Run the test.
await
Isolate
.
spawn
(
isolateSpawnEntrypoint
,
testReceivePort
.
sendPort
);
});
}
testing/run_tests.sh
浏览文件 @
c3976b3c
...
...
@@ -4,6 +4,7 @@ set -ex
out/host_debug_unopt/fxl_unittests
out/host_debug_unopt/synchronization_unittests
out/host_debug_unopt/wtf_unittests
flutter/travis/analyze.sh
...
...
travis/licenses_golden/licenses_flutter
浏览文件 @
c3976b3c
...
...
@@ -490,7 +490,6 @@ LIBRARY: engine
ORIGIN: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart + ../../../LICENSE
TYPE: LicenseType.bsd
FILE: ../../../flutter/flutter_kernel_transformers/lib/track_widget_constructor_locations.dart
FILE: ../../../flutter/lib/ui/isolate_name_server.dart
FILE: ../../../flutter/lib/ui/painting/image_encoding.cc
FILE: ../../../flutter/lib/ui/painting/image_encoding.h
FILE: ../../../flutter/shell/platform/android/apk_asset_provider.h
...
...
@@ -581,10 +580,6 @@ FILE: ../../../flutter/fml/platform/win/wstring_conversion.h
FILE: ../../../flutter/fml/unique_fd.cc
FILE: ../../../flutter/fml/unique_fd.h
FILE: ../../../flutter/fml/unique_object.h
FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server.cc
FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server.h
FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server_natives.cc
FILE: ../../../flutter/lib/ui/isolate_name_server/isolate_name_server_natives.h
FILE: ../../../flutter/shell/common/isolate_configuration.cc
FILE: ../../../flutter/shell/common/isolate_configuration.h
FILE: ../../../flutter/shell/platform/android/android_shell_holder.cc
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录