Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
b7d03138
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b7d03138
编写于
8月 23, 2019
作者:
C
Chinmay Garde
提交者:
GitHub
8月 23, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove deprecated ThreadTest::GetThreadTaskRunner and use the newer CreateNewThread API. (#11395)
We will end up creating fewer threads in tests.
上级
72283b64
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
50 addition
and
74 deletion
+50
-74
lib/ui/painting/image_decoder_unittests.cc
lib/ui/painting/image_decoder_unittests.cc
+38
-36
runtime/dart_isolate_unittests.cc
runtime/dart_isolate_unittests.cc
+4
-4
runtime/dart_lifecycle_unittests.cc
runtime/dart_lifecycle_unittests.cc
+2
-1
shell/common/shell_unittests.cc
shell/common/shell_unittests.cc
+5
-5
shell/platform/embedder/tests/embedder_unittests.cc
shell/platform/embedder/tests/embedder_unittests.cc
+1
-1
testing/thread_test.cc
testing/thread_test.cc
+0
-9
testing/thread_test.h
testing/thread_test.h
+0
-18
未找到文件。
lib/ui/painting/image_decoder_unittests.cc
浏览文件 @
b7d03138
...
...
@@ -105,11 +105,12 @@ static sk_sp<SkData> OpenFixtureAsSkData(const char* name) {
TEST_F
(
ImageDecoderFixtureTest
,
CanCreateImageDecoder
)
{
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
auto
thread_task_runner
=
CreateNewThread
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
GetThreadTaskRunner
(),
// gpu
GetThreadTaskRunner
(),
// ui
GetThreadTaskRunner
()
// io
thread_task_runner
,
// platform
thread_task_runner
,
// gpu
thread_task_runner
,
// ui
thread_task_runner
// io
);
...
...
@@ -125,15 +126,16 @@ TEST_F(ImageDecoderFixtureTest, CanCreateImageDecoder) {
TEST_F
(
ImageDecoderFixtureTest
,
InvalidImageResultsError
)
{
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
auto
thread_task_runner
=
CreateNewThread
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
GetThreadTaskRunner
(),
// gpu
GetThreadTaskRunner
(),
// ui
GetThreadTaskRunner
()
// io
thread_task_runner
,
// platform
thread_task_runner
,
// gpu
thread_task_runner
,
// ui
thread_task_runner
// io
);
fml
::
AutoResetWaitableEvent
latch
;
GetThreadTaskRunner
()
->
PostTask
([
&
]()
{
thread_task_runner
->
PostTask
([
&
]()
{
TestIOManager
manager
(
runners
.
GetIOTaskRunner
());
ImageDecoder
decoder
(
runners
,
loop
->
GetTaskRunner
(),
manager
.
GetWeakIOManager
());
...
...
@@ -156,7 +158,7 @@ TEST_F(ImageDecoderFixtureTest, InvalidImageResultsError) {
TEST_F
(
ImageDecoderFixtureTest
,
ValidImageResultsInSuccess
)
{
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
CreateNewThread
(
"platform"
),
// platform
CreateNewThread
(
"gpu"
),
// gpu
CreateNewThread
(
"ui"
),
// ui
CreateNewThread
(
"io"
)
// io
...
...
@@ -198,7 +200,7 @@ TEST_F(ImageDecoderFixtureTest, ValidImageResultsInSuccess) {
TEST_F
(
ImageDecoderFixtureTest
,
ExifDataIsRespectedOnDecode
)
{
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
CreateNewThread
(
"platform"
),
// platform
CreateNewThread
(
"gpu"
),
// gpu
CreateNewThread
(
"ui"
),
// ui
CreateNewThread
(
"io"
)
// io
...
...
@@ -245,7 +247,7 @@ TEST_F(ImageDecoderFixtureTest, ExifDataIsRespectedOnDecode) {
TEST_F
(
ImageDecoderFixtureTest
,
CanDecodeWithoutAGPUContext
)
{
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
CreateNewThread
(
"platform"
),
// platform
CreateNewThread
(
"gpu"
),
// gpu
CreateNewThread
(
"ui"
),
// ui
CreateNewThread
(
"io"
)
// io
...
...
@@ -296,7 +298,7 @@ TEST_F(ImageDecoderFixtureTest, CanDecodeWithResizes) {
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
CreateNewThread
(
"platform"
),
// platform
CreateNewThread
(
"gpu"
),
// gpu
CreateNewThread
(
"ui"
),
// ui
CreateNewThread
(
"io"
)
// io
...
...
@@ -381,7 +383,7 @@ TEST_F(ImageDecoderFixtureTest, CanResizeWithoutDecode) {
auto
loop
=
fml
::
ConcurrentMessageLoop
::
Create
();
TaskRunners
runners
(
GetCurrentTestName
(),
// label
GetThreadTaskRunner
(),
// platform
CreateNewThread
(
"platform"
),
// platform
CreateNewThread
(
"gpu"
),
// gpu
CreateNewThread
(
"ui"
),
// ui
CreateNewThread
(
"io"
)
// io
...
...
runtime/dart_isolate_unittests.cc
浏览文件 @
b7d03138
...
...
@@ -327,7 +327,7 @@ TEST_F(DartIsolateTest, CanRegisterNativeCallback) {
})));
const
auto
settings
=
CreateSettingsForFixture
();
auto
vm_ref
=
DartVMRef
::
Create
(
settings
);
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
GetThreadTaskRunner
(),
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
CreateNewThread
(),
"canRegisterNativeCallback"
,
{});
ASSERT_TRUE
(
isolate
);
ASSERT_EQ
(
isolate
->
get
()
->
GetPhase
(),
DartIsolate
::
Phase
::
Running
);
...
...
@@ -350,7 +350,7 @@ TEST_F(DartIsolateTest, CanSaveCompilationTrace) {
const
auto
settings
=
CreateSettingsForFixture
();
auto
vm_ref
=
DartVMRef
::
Create
(
settings
);
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
GetThreadTaskRunner
(),
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
CreateNewThread
(),
"testCanSaveCompilationTrace"
,
{});
ASSERT_TRUE
(
isolate
);
ASSERT_EQ
(
isolate
->
get
()
->
GetPhase
(),
DartIsolate
::
Phase
::
Running
);
...
...
@@ -373,7 +373,7 @@ TEST_F(DartIsolateTest, CanLaunchSecondaryIsolates) {
})));
const
auto
settings
=
CreateSettingsForFixture
();
auto
vm_ref
=
DartVMRef
::
Create
(
settings
);
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
GetThreadTaskRunner
(),
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
CreateNewThread
(),
"testCanLaunchSecondaryIsolate"
,
{});
ASSERT_TRUE
(
isolate
);
ASSERT_EQ
(
isolate
->
get
()
->
GetPhase
(),
DartIsolate
::
Phase
::
Running
);
...
...
@@ -392,7 +392,7 @@ TEST_F(DartIsolateTest, CanRecieveArguments) {
const
auto
settings
=
CreateSettingsForFixture
();
auto
vm_ref
=
DartVMRef
::
Create
(
settings
);
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
GetThreadTaskRunner
(),
auto
isolate
=
RunDartCodeInIsolate
(
vm_ref
,
settings
,
CreateNewThread
(),
"testCanRecieveArguments"
,
{
"arg1"
});
ASSERT_TRUE
(
isolate
);
ASSERT_EQ
(
isolate
->
get
()
->
GetPhase
(),
DartIsolate
::
Phase
::
Running
);
...
...
runtime/dart_lifecycle_unittests.cc
浏览文件 @
b7d03138
...
...
@@ -113,6 +113,8 @@ TEST_F(DartLifecycleTest, DISABLED_ShuttingDownTheVMShutsDownAllIsolates) {
// Make sure the service protocol launches
settings
.
enable_observatory
=
true
;
auto
thread_task_runner
=
CreateNewThread
();
for
(
size_t
i
=
0
;
i
<
3
;
i
++
)
{
ASSERT_FALSE
(
DartVMRef
::
IsInstanceRunning
());
...
...
@@ -127,7 +129,6 @@ TEST_F(DartLifecycleTest, DISABLED_ShuttingDownTheVMShutsDownAllIsolates) {
fml
::
CountDownLatch
latch
(
isolate_count
);
auto
vm_data
=
vm_ref
.
GetVMData
();
auto
thread_task_runner
=
GetThreadTaskRunner
();
for
(
size_t
i
=
0
;
i
<
isolate_count
;
++
i
)
{
thread_task_runner
->
PostTask
(
[
vm_data
,
&
settings
,
&
latch
,
thread_task_runner
]()
{
...
...
shell/common/shell_unittests.cc
浏览文件 @
b7d03138
...
...
@@ -577,7 +577,7 @@ TEST_F(ShellTest, WaitForFirstFrameMultiple) {
/// single-thread setup.
TEST_F
(
ShellTest
,
WaitForFirstFrameInlined
)
{
Settings
settings
=
CreateSettingsForFixture
();
auto
task_runner
=
GetThreadTaskRunner
();
auto
task_runner
=
CreateNewThread
();
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
std
::
unique_ptr
<
Shell
>
shell
=
...
...
@@ -617,7 +617,7 @@ static size_t GetRasterizerResourceCacheBytesSync(Shell& shell) {
TEST_F
(
ShellTest
,
SetResourceCacheSize
)
{
Settings
settings
=
CreateSettingsForFixture
();
auto
task_runner
=
GetThreadTaskRunner
();
auto
task_runner
=
CreateNewThread
();
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
std
::
unique_ptr
<
Shell
>
shell
=
...
...
@@ -667,7 +667,7 @@ TEST_F(ShellTest, SetResourceCacheSize) {
TEST_F
(
ShellTest
,
SetResourceCacheSizeEarly
)
{
Settings
settings
=
CreateSettingsForFixture
();
auto
task_runner
=
GetThreadTaskRunner
();
auto
task_runner
=
CreateNewThread
();
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
std
::
unique_ptr
<
Shell
>
shell
=
...
...
@@ -695,7 +695,7 @@ TEST_F(ShellTest, SetResourceCacheSizeEarly) {
TEST_F
(
ShellTest
,
SetResourceCacheSizeNotifiesDart
)
{
Settings
settings
=
CreateSettingsForFixture
();
auto
task_runner
=
GetThreadTaskRunner
();
auto
task_runner
=
CreateNewThread
();
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
std
::
unique_ptr
<
Shell
>
shell
=
...
...
@@ -733,7 +733,7 @@ TEST_F(ShellTest, SetResourceCacheSizeNotifiesDart) {
TEST_F
(
ShellTest
,
CanCreateImagefromDecompressedBytes
)
{
Settings
settings
=
CreateSettingsForFixture
();
auto
task_runner
=
GetThreadTaskRunner
();
auto
task_runner
=
CreateNewThread
();
TaskRunners
task_runners
(
"test"
,
task_runner
,
task_runner
,
task_runner
,
task_runner
);
...
...
shell/platform/embedder/tests/embedder_unittests.cc
浏览文件 @
b7d03138
...
...
@@ -313,7 +313,7 @@ TEST_F(EmbedderTest, PlatformMessagesCanReceiveResponse) {
};
Captures
captures
;
GetThreadTaskRunner
()
->
PostTask
([
&
]()
{
CreateNewThread
()
->
PostTask
([
&
]()
{
captures
.
thread_id
=
std
::
this_thread
::
get_id
();
auto
&
context
=
GetEmbedderContext
();
EmbedderConfigBuilder
builder
(
context
);
...
...
testing/thread_test.cc
浏览文件 @
b7d03138
...
...
@@ -11,17 +11,12 @@ namespace testing {
// |testing::Test|
void
ThreadTest
::
SetUp
()
{
thread_
=
std
::
make_unique
<
fml
::
Thread
>
();
thread_task_runner_
=
thread_
->
GetTaskRunner
();
fml
::
MessageLoop
::
EnsureInitializedForCurrentThread
();
current_task_runner_
=
fml
::
MessageLoop
::
GetCurrent
().
GetTaskRunner
();
}
// |testing::Test|
void
ThreadTest
::
TearDown
()
{
thread_task_runner_
=
nullptr
;
thread_
=
nullptr
;
current_task_runner_
=
nullptr
;
extra_threads_
.
clear
();
}
...
...
@@ -30,10 +25,6 @@ fml::RefPtr<fml::TaskRunner> ThreadTest::GetCurrentTaskRunner() {
return
current_task_runner_
;
}
fml
::
RefPtr
<
fml
::
TaskRunner
>
ThreadTest
::
GetThreadTaskRunner
()
{
return
thread_task_runner_
;
}
fml
::
RefPtr
<
fml
::
TaskRunner
>
ThreadTest
::
CreateNewThread
(
std
::
string
name
)
{
auto
thread
=
std
::
make_unique
<
fml
::
Thread
>
(
name
);
auto
runner
=
thread
->
GetTaskRunner
();
...
...
testing/thread_test.h
浏览文件 @
b7d03138
...
...
@@ -44,22 +44,6 @@ class ThreadTest : public ::testing::Test {
///
fml
::
RefPtr
<
fml
::
TaskRunner
>
GetCurrentTaskRunner
();
//----------------------------------------------------------------------------
/// @brief Get the task runner for a dedicated thread created for this
/// test instance by this fixture. This threads message loop will
/// be terminated and the thread joined when the test is done.
///
/// @attention Prefer using the `CreateNewThread` call.
///
/// @bug This is an older call that should probably be deprecated and
/// eventually removed from use. It is redundant now that the
/// `CreateNewThread` call allows tests to create new threads (and
/// name them to boot) as necessary.
///
/// @return The task runner for a dedicated thread created for the test.
///
fml
::
RefPtr
<
fml
::
TaskRunner
>
GetThreadTaskRunner
();
//----------------------------------------------------------------------------
/// @brief Creates a new thread, initializes a message loop on it, and,
/// returns its task runner to the unit-test. The message loop is
...
...
@@ -80,8 +64,6 @@ class ThreadTest : public ::testing::Test {
void
TearDown
()
override
;
private:
std
::
unique_ptr
<
fml
::
Thread
>
thread_
;
fml
::
RefPtr
<
fml
::
TaskRunner
>
thread_task_runner_
;
fml
::
RefPtr
<
fml
::
TaskRunner
>
current_task_runner_
;
std
::
vector
<
std
::
unique_ptr
<
fml
::
Thread
>>
extra_threads_
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录