Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
5757991f
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,发现更多精彩内容 >>
提交
5757991f
编写于
4月 24, 2017
作者:
C
Chinmay Garde
提交者:
GitHub
4月 24, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove fml::ThreadChecker and use the one in ftl. (#3623)
上级
f0694bbc
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
16 addition
and
81 deletion
+16
-81
fml/BUILD.gn
fml/BUILD.gn
+0
-3
fml/thread_checker.cc
fml/thread_checker.cc
+0
-17
fml/thread_checker.h
fml/thread_checker.h
+0
-30
fml/thread_checker_unittests.cc
fml/thread_checker_unittests.cc
+0
-16
shell/common/shell.cc
shell/common/shell.cc
+13
-9
shell/common/shell.h
shell/common/shell.h
+3
-3
travis/licenses_golden/licenses_flutter
travis/licenses_golden/licenses_flutter
+0
-3
未找到文件。
fml/BUILD.gn
浏览文件 @
5757991f
...
...
@@ -18,8 +18,6 @@ source_set("fml") {
"task_runner.h",
"thread.cc",
"thread.h",
"thread_checker.cc",
"thread_checker.h",
"thread_local.h",
"trace_event.cc",
"trace_event.h",
...
...
@@ -105,7 +103,6 @@ executable("fml_unittests") {
sources = [
"message_loop_unittests.cc",
"thread_checker_unittests.cc",
"thread_local_unittests.cc",
"thread_unittests.cc",
]
...
...
fml/thread_checker.cc
已删除
100644 → 0
浏览文件 @
f0694bbc
// Copyright 2017 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.
#include "flutter/fml/thread_checker.h"
namespace
fml
{
ThreadChecker
::
ThreadChecker
()
:
handle_
(
std
::
this_thread
::
get_id
())
{}
ThreadChecker
::~
ThreadChecker
()
=
default
;
bool
ThreadChecker
::
IsCalledOnValidThread
()
const
{
return
handle_
==
std
::
this_thread
::
get_id
();
}
}
// namespace fml
fml/thread_checker.h
已删除
100644 → 0
浏览文件 @
f0694bbc
// Copyright 2017 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.
#ifndef FLUTTER_FML_THREAD_CHECKER_H_
#define FLUTTER_FML_THREAD_CHECKER_H_
#include <thread>
#include "lib/ftl/macros.h"
namespace
fml
{
class
ThreadChecker
{
public:
ThreadChecker
();
~
ThreadChecker
();
bool
IsCalledOnValidThread
()
const
;
private:
const
std
::
thread
::
id
handle_
;
FTL_DISALLOW_COPY_AND_ASSIGN
(
ThreadChecker
);
};
}
// namespace fml
#endif // FLUTTER_FML_THREAD_CHECKER_H_
fml/thread_checker_unittests.cc
已删除
100644 → 0
浏览文件 @
f0694bbc
// Copyright 2017 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.
#include <thread>
#include "flutter/fml/thread_checker.h"
#include "gtest/gtest.h"
TEST
(
ThreadChecker
,
CheckCalledOnValidThread
)
{
fml
::
ThreadChecker
checker
;
ASSERT_TRUE
(
checker
.
IsCalledOnValidThread
());
std
::
thread
thread
(
[
&
checker
]()
{
ASSERT_FALSE
(
checker
.
IsCalledOnValidThread
());
});
thread
.
join
();
}
shell/common/shell.cc
浏览文件 @
5757991f
...
...
@@ -207,22 +207,22 @@ TracingController& Shell::tracing_controller() {
}
void
Shell
::
InitGpuThread
()
{
gpu_thread_checker_
.
reset
(
new
f
m
l
::
ThreadChecker
());
gpu_thread_checker_
.
reset
(
new
f
t
l
::
ThreadChecker
());
}
void
Shell
::
InitUIThread
()
{
ui_thread_checker_
.
reset
(
new
f
m
l
::
ThreadChecker
());
ui_thread_checker_
.
reset
(
new
f
t
l
::
ThreadChecker
());
}
void
Shell
::
AddRasterizer
(
const
ftl
::
WeakPtr
<
Rasterizer
>&
rasterizer
)
{
FTL_DCHECK
(
gpu_thread_checker_
&&
gpu_thread_checker_
->
IsC
alledOnValidThread
());
gpu_thread_checker_
->
IsC
reationThreadCurrent
());
rasterizers_
.
push_back
(
rasterizer
);
}
void
Shell
::
PurgeRasterizers
()
{
FTL_DCHECK
(
gpu_thread_checker_
&&
gpu_thread_checker_
->
IsC
alledOnValidThread
());
gpu_thread_checker_
->
IsC
reationThreadCurrent
());
rasterizers_
.
erase
(
std
::
remove_if
(
rasterizers_
.
begin
(),
rasterizers_
.
end
(),
IsInvalid
),
rasterizers_
.
end
());
...
...
@@ -230,19 +230,21 @@ void Shell::PurgeRasterizers() {
void
Shell
::
GetRasterizers
(
std
::
vector
<
ftl
::
WeakPtr
<
Rasterizer
>>*
rasterizers
)
{
FTL_DCHECK
(
gpu_thread_checker_
&&
gpu_thread_checker_
->
IsC
alledOnValidThread
());
gpu_thread_checker_
->
IsC
reationThreadCurrent
());
*
rasterizers
=
rasterizers_
;
}
void
Shell
::
AddPlatformView
(
const
ftl
::
WeakPtr
<
PlatformView
>&
platform_view
)
{
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCalledOnValidThread
());
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCreationThreadCurrent
());
if
(
platform_view
)
{
platform_views_
.
push_back
(
platform_view
);
}
}
void
Shell
::
PurgePlatformViews
()
{
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCalledOnValidThread
());
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCreationThreadCurrent
());
platform_views_
.
erase
(
std
::
remove_if
(
platform_views_
.
begin
(),
platform_views_
.
end
(),
IsViewInvalid
),
platform_views_
.
end
());
...
...
@@ -250,7 +252,8 @@ void Shell::PurgePlatformViews() {
void
Shell
::
GetPlatformViews
(
std
::
vector
<
ftl
::
WeakPtr
<
PlatformView
>>*
platform_views
)
{
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCalledOnValidThread
());
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCreationThreadCurrent
());
*
platform_views
=
platform_views_
;
}
...
...
@@ -317,7 +320,8 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id,
int64_t
*
dart_isolate_id
,
std
::
string
*
isolate_name
,
ftl
::
AutoResetWaitableEvent
*
latch
)
{
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCalledOnValidThread
());
FTL_DCHECK
(
ui_thread_checker_
&&
ui_thread_checker_
->
IsCreationThreadCurrent
());
*
view_existed
=
false
;
...
...
shell/common/shell.h
浏览文件 @
5757991f
...
...
@@ -6,12 +6,12 @@
#define SHELL_COMMON_SHELL_H_
#include "flutter/fml/thread.h"
#include "flutter/fml/thread_checker.h"
#include "flutter/shell/common/tracing_controller.h"
#include "lib/ftl/command_line.h"
#include "lib/ftl/macros.h"
#include "lib/ftl/memory/ref_ptr.h"
#include "lib/ftl/memory/weak_ptr.h"
#include "lib/ftl/synchronization/thread_checker.h"
#include "lib/ftl/synchronization/waitable_event.h"
#include "lib/ftl/tasks/task_runner.h"
...
...
@@ -95,8 +95,8 @@ class Shell {
std
::
unique_ptr
<
fml
::
Thread
>
ui_thread_
;
std
::
unique_ptr
<
fml
::
Thread
>
io_thread_
;
std
::
unique_ptr
<
f
m
l
::
ThreadChecker
>
gpu_thread_checker_
;
std
::
unique_ptr
<
f
m
l
::
ThreadChecker
>
ui_thread_checker_
;
std
::
unique_ptr
<
f
t
l
::
ThreadChecker
>
gpu_thread_checker_
;
std
::
unique_ptr
<
f
t
l
::
ThreadChecker
>
ui_thread_checker_
;
TracingController
tracing_controller_
;
...
...
travis/licenses_golden/licenses_flutter
浏览文件 @
5757991f
...
...
@@ -1411,9 +1411,6 @@ FILE: ../../../flutter/fml/task_runner.cc
FILE: ../../../flutter/fml/task_runner.h
FILE: ../../../flutter/fml/thread.cc
FILE: ../../../flutter/fml/thread.h
FILE: ../../../flutter/fml/thread_checker.cc
FILE: ../../../flutter/fml/thread_checker.h
FILE: ../../../flutter/fml/thread_checker_unittests.cc
FILE: ../../../flutter/fml/thread_local.h
FILE: ../../../flutter/fml/thread_local_unittests.cc
FILE: ../../../flutter/fml/thread_unittests.cc
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录