Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
89e39585
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,体验更适合开发者的 AI 搜索 >>
未验证
提交
89e39585
编写于
11月 22, 2019
作者:
G
gaaclarke
提交者:
GitHub
11月 22, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Refactor to passing functions by const ref (#13975)
Moved our code to passing functions by const ref
上级
11580eb2
变更
81
隐藏空白更改
内联
并排
Showing
81 changed file
with
213 addition
and
187 deletion
+213
-187
flow/raster_cache.cc
flow/raster_cache.cc
+2
-1
flow/scene_update_context.h
flow/scene_update_context.h
+1
-1
flow/view_holder.cc
flow/view_holder.cc
+4
-4
flow/view_holder.h
flow/view_holder.h
+2
-2
fml/closure.h
fml/closure.h
+1
-1
fml/concurrent_message_loop.cc
fml/concurrent_message_loop.cc
+2
-2
fml/concurrent_message_loop.h
fml/concurrent_message_loop.h
+2
-2
fml/delayed_task.cc
fml/delayed_task.cc
+2
-2
fml/delayed_task.h
fml/delayed_task.h
+3
-1
fml/file.cc
fml/file.cc
+1
-1
fml/file.h
fml/file.h
+5
-2
fml/mapping.cc
fml/mapping.cc
+1
-1
fml/mapping.h
fml/mapping.h
+1
-1
fml/message_loop.cc
fml/message_loop.cc
+1
-1
fml/message_loop.h
fml/message_loop.h
+1
-1
fml/message_loop_impl.cc
fml/message_loop_impl.cc
+4
-2
fml/message_loop_impl.h
fml/message_loop_impl.h
+2
-2
fml/message_loop_task_queues.cc
fml/message_loop_task_queues.cc
+3
-3
fml/message_loop_task_queues.h
fml/message_loop_task_queues.h
+2
-2
fml/platform/posix/file_posix.cc
fml/platform/posix/file_posix.cc
+1
-1
fml/platform/win/file_win.cc
fml/platform/win/file_win.cc
+1
-1
fml/task_runner.cc
fml/task_runner.cc
+8
-7
fml/task_runner.h
fml/task_runner.h
+5
-4
lib/ui/painting/image_decoder.cc
lib/ui/painting/image_decoder.cc
+2
-1
lib/ui/painting/image_decoder.h
lib/ui/painting/image_decoder.h
+1
-1
runtime/dart_isolate.cc
runtime/dart_isolate.cc
+13
-12
runtime/dart_isolate.h
runtime/dart_isolate.h
+9
-9
runtime/dart_service_isolate.cc
runtime/dart_service_isolate.cc
+1
-1
runtime/dart_service_isolate.h
runtime/dart_service_isolate.h
+1
-1
runtime/runtime_controller.cc
runtime/runtime_controller.cc
+6
-6
runtime/runtime_controller.h
runtime/runtime_controller.h
+6
-6
runtime/skia_concurrent_executor.cc
runtime/skia_concurrent_executor.cc
+1
-1
runtime/skia_concurrent_executor.h
runtime/skia_concurrent_executor.h
+1
-1
shell/common/animator.cc
shell/common/animator.cc
+2
-2
shell/common/animator.h
shell/common/animator.h
+1
-1
shell/common/engine.cc
shell/common/engine.cc
+2
-2
shell/common/engine.h
shell/common/engine.h
+1
-1
shell/common/pipeline.h
shell/common/pipeline.h
+3
-2
shell/common/platform_view.cc
shell/common/platform_view.cc
+2
-2
shell/common/platform_view.h
shell/common/platform_view.h
+3
-2
shell/common/pointer_data_dispatcher.h
shell/common/pointer_data_dispatcher.h
+2
-1
shell/common/rasterizer.cc
shell/common/rasterizer.cc
+1
-1
shell/common/rasterizer.h
shell/common/rasterizer.h
+1
-1
shell/common/shell.cc
shell/common/shell.cc
+17
-16
shell/common/shell.h
shell/common/shell.h
+8
-8
shell/common/surface.cc
shell/common/surface.cc
+1
-1
shell/common/surface.h
shell/common/surface.h
+1
-1
shell/common/vsync_waiter.cc
shell/common/vsync_waiter.cc
+2
-2
shell/common/vsync_waiter.h
shell/common/vsync_waiter.h
+2
-2
shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h
...pp/client_wrapper/include/flutter/basic_message_channel.h
+2
-2
shell/platform/common/cpp/incoming_message_dispatcher.cc
shell/platform/common/cpp/incoming_message_dispatcher.cc
+3
-2
shell/platform/common/cpp/incoming_message_dispatcher.h
shell/platform/common/cpp/incoming_message_dispatcher.h
+2
-2
shell/platform/embedder/embedder_engine.cc
shell/platform/embedder/embedder_engine.cc
+1
-1
shell/platform/embedder/embedder_engine.h
shell/platform/embedder/embedder_engine.h
+1
-1
shell/platform/embedder/embedder_external_texture_gl.cc
shell/platform/embedder/embedder_external_texture_gl.cc
+1
-1
shell/platform/embedder/embedder_external_texture_gl.h
shell/platform/embedder/embedder_external_texture_gl.h
+1
-1
shell/platform/embedder/embedder_external_view_embedder.cc
shell/platform/embedder/embedder_external_view_embedder.cc
+2
-2
shell/platform/embedder/embedder_external_view_embedder.h
shell/platform/embedder/embedder_external_view_embedder.h
+2
-2
shell/platform/embedder/embedder_layers.cc
shell/platform/embedder/embedder_layers.cc
+3
-1
shell/platform/embedder/embedder_layers.h
shell/platform/embedder/embedder_layers.h
+1
-1
shell/platform/embedder/embedder_platform_message_response.cc
...l/platform/embedder/embedder_platform_message_response.cc
+1
-1
shell/platform/embedder/embedder_platform_message_response.h
shell/platform/embedder/embedder_platform_message_response.h
+1
-1
shell/platform/embedder/embedder_task_runner.cc
shell/platform/embedder/embedder_task_runner.cc
+3
-3
shell/platform/embedder/embedder_task_runner.h
shell/platform/embedder/embedder_task_runner.h
+4
-3
shell/platform/embedder/tests/embedder_config_builder.cc
shell/platform/embedder/tests/embedder_config_builder.cc
+1
-1
shell/platform/embedder/tests/embedder_config_builder.h
shell/platform/embedder/tests/embedder_config_builder.h
+1
-1
shell/platform/embedder/tests/embedder_test_compositor.cc
shell/platform/embedder/tests/embedder_test_compositor.cc
+3
-3
shell/platform/embedder/tests/embedder_test_compositor.h
shell/platform/embedder/tests/embedder_test_compositor.h
+4
-3
shell/platform/embedder/tests/embedder_test_context.cc
shell/platform/embedder/tests/embedder_test_context.cc
+6
-5
shell/platform/embedder/tests/embedder_test_context.h
shell/platform/embedder/tests/embedder_test_context.h
+6
-5
shell/platform/embedder/vsync_waiter_embedder.cc
shell/platform/embedder/vsync_waiter_embedder.cc
+1
-1
shell/platform/embedder/vsync_waiter_embedder.h
shell/platform/embedder/vsync_waiter_embedder.h
+1
-1
shell/platform/fuchsia/flutter/platform_view_unittest.cc
shell/platform/fuchsia/flutter/platform_view_unittest.cc
+1
-1
shell/platform/fuchsia/flutter/task_runner_adapter.cc
shell/platform/fuchsia/flutter/task_runner_adapter.cc
+8
-6
shell/platform/fuchsia/flutter/vulkan_surface.cc
shell/platform/fuchsia/flutter/vulkan_surface.cc
+1
-1
shell/platform/fuchsia/flutter/vulkan_surface.h
shell/platform/fuchsia/flutter/vulkan_surface.h
+1
-1
shell/platform/glfw/glfw_event_loop.cc
shell/platform/glfw/glfw_event_loop.cc
+1
-1
shell/platform/glfw/glfw_event_loop.h
shell/platform/glfw/glfw_event_loop.h
+1
-1
shell/platform/windows/win32_task_runner.cc
shell/platform/windows/win32_task_runner.cc
+1
-1
shell/platform/windows/win32_task_runner.h
shell/platform/windows/win32_task_runner.h
+2
-1
vulkan/vulkan_handle.h
vulkan/vulkan_handle.h
+1
-1
未找到文件。
flow/raster_cache.cc
浏览文件 @
89e39585
...
...
@@ -92,13 +92,14 @@ static bool IsPictureWorthRasterizing(SkPicture* picture,
return
picture
->
approximateOpCount
()
>
5
;
}
/// @note Procedure doesn't copy all closures.
static
RasterCacheResult
Rasterize
(
GrContext
*
context
,
const
SkMatrix
&
ctm
,
SkColorSpace
*
dst_color_space
,
bool
checkerboard
,
const
SkRect
&
logical_rect
,
std
::
function
<
void
(
SkCanvas
*
)
>
draw_function
)
{
const
std
::
function
<
void
(
SkCanvas
*
)
>&
draw_function
)
{
TRACE_EVENT0
(
"flutter"
,
"RasterCachePopulate"
);
SkIRect
cache_rect
=
RasterCache
::
GetDeviceBounds
(
logical_rect
,
ctm
);
...
...
flow/scene_update_context.h
浏览文件 @
89e39585
...
...
@@ -37,7 +37,7 @@ class SceneUpdateContext {
virtual
SkISize
GetSize
()
const
=
0
;
virtual
void
SignalWritesFinished
(
std
::
function
<
void
(
void
)
>
on_writes_committed
)
=
0
;
const
std
::
function
<
void
(
void
)
>&
on_writes_committed
)
=
0
;
virtual
scenic
::
Image
*
GetImage
()
=
0
;
...
...
flow/view_holder.cc
浏览文件 @
89e39585
...
...
@@ -51,7 +51,7 @@ namespace flutter {
void
ViewHolder
::
Create
(
zx_koid_t
id
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
ui_task_runner
,
fuchsia
::
ui
::
views
::
ViewHolderToken
view_holder_token
,
BindCallback
on_bind_callback
)
{
const
BindCallback
&
on_bind_callback
)
{
// This GPU thread contains at least 1 ViewHolder. Initialize the per-thread
// bindings.
if
(
tls_view_holder_bindings
.
get
()
==
nullptr
)
{
...
...
@@ -64,7 +64,7 @@ void ViewHolder::Create(zx_koid_t id,
auto
view_holder
=
std
::
make_unique
<
ViewHolder
>
(
std
::
move
(
ui_task_runner
),
std
::
move
(
view_holder_token
),
std
::
move
(
on_bind_callback
)
);
on_bind_callback
);
bindings
->
emplace
(
id
,
std
::
move
(
view_holder
));
}
...
...
@@ -91,10 +91,10 @@ ViewHolder* ViewHolder::FromId(zx_koid_t id) {
ViewHolder
::
ViewHolder
(
fml
::
RefPtr
<
fml
::
TaskRunner
>
ui_task_runner
,
fuchsia
::
ui
::
views
::
ViewHolderToken
view_holder_token
,
BindCallback
on_bind_callback
)
const
BindCallback
&
on_bind_callback
)
:
ui_task_runner_
(
std
::
move
(
ui_task_runner
)),
pending_view_holder_token_
(
std
::
move
(
view_holder_token
)),
pending_bind_callback_
(
std
::
move
(
on_bind_callback
)
)
{
pending_bind_callback_
(
on_bind_callback
)
{
FML_DCHECK
(
ui_task_runner_
);
FML_DCHECK
(
pending_view_holder_token_
.
value
);
}
...
...
flow/view_holder.h
浏览文件 @
89e39585
...
...
@@ -34,13 +34,13 @@ class ViewHolder {
static
void
Create
(
zx_koid_t
id
,
fml
::
RefPtr
<
fml
::
TaskRunner
>
ui_task_runner
,
fuchsia
::
ui
::
views
::
ViewHolderToken
view_holder_token
,
BindCallback
on_bind_callback
);
const
BindCallback
&
on_bind_callback
);
static
void
Destroy
(
zx_koid_t
id
);
static
ViewHolder
*
FromId
(
zx_koid_t
id
);
ViewHolder
(
fml
::
RefPtr
<
fml
::
TaskRunner
>
ui_task_runner
,
fuchsia
::
ui
::
views
::
ViewHolderToken
view_holder_token
,
BindCallback
on_bind_callback
);
const
BindCallback
&
on_bind_callback
);
~
ViewHolder
()
=
default
;
// Sets the properties/opacity of the child view by issuing a Scenic command.
...
...
fml/closure.h
浏览文件 @
89e39585
...
...
@@ -31,7 +31,7 @@ using closure = std::function<void()>;
///
class
ScopedCleanupClosure
{
public:
ScopedCleanupClosure
(
fml
::
closure
closure
)
:
closure_
(
closure
)
{}
ScopedCleanupClosure
(
const
fml
::
closure
&
closure
)
:
closure_
(
closure
)
{}
~
ScopedCleanupClosure
()
{
if
(
closure_
)
{
...
...
fml/concurrent_message_loop.cc
浏览文件 @
89e39585
...
...
@@ -43,7 +43,7 @@ std::shared_ptr<ConcurrentTaskRunner> ConcurrentMessageLoop::GetTaskRunner() {
return
std
::
make_shared
<
ConcurrentTaskRunner
>
(
weak_from_this
());
}
void
ConcurrentMessageLoop
::
PostTask
(
fml
::
closure
task
)
{
void
ConcurrentMessageLoop
::
PostTask
(
const
fml
::
closure
&
task
)
{
if
(
!
task
)
{
return
;
}
...
...
@@ -107,7 +107,7 @@ ConcurrentTaskRunner::ConcurrentTaskRunner(
ConcurrentTaskRunner
::~
ConcurrentTaskRunner
()
=
default
;
void
ConcurrentTaskRunner
::
PostTask
(
fml
::
closure
task
)
{
void
ConcurrentTaskRunner
::
PostTask
(
const
fml
::
closure
&
task
)
{
if
(
!
task
)
{
return
;
}
...
...
fml/concurrent_message_loop.h
浏览文件 @
89e39585
...
...
@@ -44,7 +44,7 @@ class ConcurrentMessageLoop
void
WorkerMain
();
void
PostTask
(
fml
::
closure
task
);
void
PostTask
(
const
fml
::
closure
&
task
);
FML_DISALLOW_COPY_AND_ASSIGN
(
ConcurrentMessageLoop
);
};
...
...
@@ -55,7 +55,7 @@ class ConcurrentTaskRunner {
~
ConcurrentTaskRunner
();
void
PostTask
(
fml
::
closure
task
);
void
PostTask
(
const
fml
::
closure
&
task
);
private:
friend
ConcurrentMessageLoop
;
...
...
fml/delayed_task.cc
浏览文件 @
89e39585
...
...
@@ -9,9 +9,9 @@
namespace
fml
{
DelayedTask
::
DelayedTask
(
size_t
order
,
fml
::
closure
task
,
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
:
order_
(
order
),
task_
(
std
::
move
(
task
)
),
target_time_
(
target_time
)
{}
:
order_
(
order
),
task_
(
task
),
target_time_
(
target_time
)
{}
DelayedTask
::
DelayedTask
(
const
DelayedTask
&
other
)
=
default
;
...
...
fml/delayed_task.h
浏览文件 @
89e39585
...
...
@@ -14,7 +14,9 @@ namespace fml {
class
DelayedTask
{
public:
DelayedTask
(
size_t
order
,
fml
::
closure
task
,
fml
::
TimePoint
target_time
);
DelayedTask
(
size_t
order
,
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
);
DelayedTask
(
const
DelayedTask
&
other
);
...
...
fml/file.cc
浏览文件 @
89e39585
...
...
@@ -62,7 +62,7 @@ ScopedTemporaryDirectory::~ScopedTemporaryDirectory() {
}
bool
VisitFilesRecursively
(
const
fml
::
UniqueFD
&
directory
,
FileVisitor
visitor
)
{
const
FileVisitor
&
visitor
)
{
FileVisitor
recursive_visitor
=
[
&
recursive_visitor
,
&
visitor
](
const
UniqueFD
&
directory
,
const
std
::
string
&
filename
)
{
...
...
fml/file.h
浏览文件 @
89e39585
...
...
@@ -107,7 +107,8 @@ using FileVisitor = std::function<bool(const fml::UniqueFD& directory,
/// use our helper method `VisitFilesRecursively`.
///
/// @see `VisitFilesRecursively`.
bool
VisitFiles
(
const
fml
::
UniqueFD
&
directory
,
FileVisitor
visitor
);
/// @note Procedure doesn't copy all closures.
bool
VisitFiles
(
const
fml
::
UniqueFD
&
directory
,
const
FileVisitor
&
visitor
);
/// Recursively call `visitor` on all files inside the `directory`. Return false
/// if and only if the visitor returns false during the traversal.
...
...
@@ -119,7 +120,9 @@ bool VisitFiles(const fml::UniqueFD& directory, FileVisitor visitor);
/// compute the relative path between the root directory and the visited file.
///
/// @see `VisitFiles`.
bool
VisitFilesRecursively
(
const
fml
::
UniqueFD
&
directory
,
FileVisitor
visitor
);
/// @note Procedure doesn't copy all closures.
bool
VisitFilesRecursively
(
const
fml
::
UniqueFD
&
directory
,
const
FileVisitor
&
visitor
);
class
ScopedTemporaryDirectory
{
public:
...
...
fml/mapping.cc
浏览文件 @
89e39585
...
...
@@ -85,7 +85,7 @@ const uint8_t* DataMapping::GetMapping() const {
NonOwnedMapping
::
NonOwnedMapping
(
const
uint8_t
*
data
,
size_t
size
,
ReleaseProc
release_proc
)
const
ReleaseProc
&
release_proc
)
:
data_
(
data
),
size_
(
size
),
release_proc_
(
release_proc
)
{}
NonOwnedMapping
::~
NonOwnedMapping
()
{
...
...
fml/mapping.h
浏览文件 @
89e39585
...
...
@@ -107,7 +107,7 @@ class NonOwnedMapping final : public Mapping {
using
ReleaseProc
=
std
::
function
<
void
(
const
uint8_t
*
data
,
size_t
size
)
>
;
NonOwnedMapping
(
const
uint8_t
*
data
,
size_t
size
,
ReleaseProc
release_proc
=
nullptr
);
const
ReleaseProc
&
release_proc
=
nullptr
);
~
NonOwnedMapping
()
override
;
...
...
fml/message_loop.cc
浏览文件 @
89e39585
...
...
@@ -61,7 +61,7 @@ fml::RefPtr<MessageLoopImpl> MessageLoop::GetLoopImpl() const {
return
loop_
;
}
void
MessageLoop
::
AddTaskObserver
(
intptr_t
key
,
fml
::
closure
callback
)
{
void
MessageLoop
::
AddTaskObserver
(
intptr_t
key
,
const
fml
::
closure
&
callback
)
{
loop_
->
AddTaskObserver
(
key
,
callback
);
}
...
...
fml/message_loop.h
浏览文件 @
89e39585
...
...
@@ -24,7 +24,7 @@ class MessageLoop {
void
Terminate
();
void
AddTaskObserver
(
intptr_t
key
,
fml
::
closure
callback
);
void
AddTaskObserver
(
intptr_t
key
,
const
fml
::
closure
&
callback
);
void
RemoveTaskObserver
(
intptr_t
key
);
...
...
fml/message_loop_impl.cc
浏览文件 @
89e39585
...
...
@@ -50,7 +50,8 @@ MessageLoopImpl::~MessageLoopImpl() {
task_queue_
->
Dispose
(
queue_id_
);
}
void
MessageLoopImpl
::
PostTask
(
fml
::
closure
task
,
fml
::
TimePoint
target_time
)
{
void
MessageLoopImpl
::
PostTask
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
{
FML_DCHECK
(
task
!=
nullptr
);
FML_DCHECK
(
task
!=
nullptr
);
if
(
terminated_
)
{
...
...
@@ -61,7 +62,8 @@ void MessageLoopImpl::PostTask(fml::closure task, fml::TimePoint target_time) {
task_queue_
->
RegisterTask
(
queue_id_
,
task
,
target_time
);
}
void
MessageLoopImpl
::
AddTaskObserver
(
intptr_t
key
,
fml
::
closure
callback
)
{
void
MessageLoopImpl
::
AddTaskObserver
(
intptr_t
key
,
const
fml
::
closure
&
callback
)
{
FML_DCHECK
(
callback
!=
nullptr
);
FML_DCHECK
(
MessageLoop
::
GetCurrent
().
GetLoopImpl
().
get
()
==
this
)
<<
"Message loop task observer must be added on the same thread as the "
...
...
fml/message_loop_impl.h
浏览文件 @
89e39585
...
...
@@ -34,9 +34,9 @@ class MessageLoopImpl : public Wakeable,
virtual
void
Terminate
()
=
0
;
void
PostTask
(
fml
::
closure
task
,
fml
::
TimePoint
target_time
);
void
PostTask
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
);
void
AddTaskObserver
(
intptr_t
key
,
fml
::
closure
callback
);
void
AddTaskObserver
(
intptr_t
key
,
const
fml
::
closure
&
callback
);
void
RemoveTaskObserver
(
intptr_t
key
);
...
...
fml/message_loop_task_queues.cc
浏览文件 @
89e39585
...
...
@@ -75,13 +75,13 @@ void MessageLoopTaskQueues::DisposeTasks(TaskQueueId queue_id) {
}
void
MessageLoopTaskQueues
::
RegisterTask
(
TaskQueueId
queue_id
,
fml
::
closure
task
,
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
{
std
::
scoped_lock
queue_lock
(
GetMutex
(
queue_id
));
size_t
order
=
order_
++
;
const
auto
&
queue_entry
=
queue_entries_
[
queue_id
];
queue_entry
->
delayed_tasks
.
push
({
order
,
std
::
move
(
task
)
,
target_time
});
queue_entry
->
delayed_tasks
.
push
({
order
,
task
,
target_time
});
TaskQueueId
loop_to_wake
=
queue_id
;
if
(
queue_entry
->
subsumed_by
!=
_kUnmerged
)
{
loop_to_wake
=
queue_entry
->
subsumed_by
;
...
...
@@ -157,7 +157,7 @@ size_t MessageLoopTaskQueues::GetNumPendingTasks(TaskQueueId queue_id) const {
void
MessageLoopTaskQueues
::
AddTaskObserver
(
TaskQueueId
queue_id
,
intptr_t
key
,
fml
::
closure
callback
)
{
const
fml
::
closure
&
callback
)
{
std
::
scoped_lock
queue_lock
(
GetMutex
(
queue_id
));
FML_DCHECK
(
callback
!=
nullptr
)
<<
"Observer callback must be non-null."
;
...
...
fml/message_loop_task_queues.h
浏览文件 @
89e39585
...
...
@@ -78,7 +78,7 @@ class MessageLoopTaskQueues
// Tasks methods.
void
RegisterTask
(
TaskQueueId
queue_id
,
fml
::
closure
task
,
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
);
bool
HasPendingTasks
(
TaskQueueId
queue_id
)
const
;
...
...
@@ -93,7 +93,7 @@ class MessageLoopTaskQueues
void
AddTaskObserver
(
TaskQueueId
queue_id
,
intptr_t
key
,
fml
::
closure
callback
);
const
fml
::
closure
&
callback
);
void
RemoveTaskObserver
(
TaskQueueId
queue_id
,
intptr_t
key
);
...
...
fml/platform/posix/file_posix.cc
浏览文件 @
89e39585
...
...
@@ -222,7 +222,7 @@ bool WriteAtomically(const fml::UniqueFD& base_directory,
base_directory
.
get
(),
file_name
)
==
0
;
}
bool
VisitFiles
(
const
fml
::
UniqueFD
&
directory
,
FileVisitor
visitor
)
{
bool
VisitFiles
(
const
fml
::
UniqueFD
&
directory
,
const
FileVisitor
&
visitor
)
{
fml
::
UniqueFD
dup_fd
(
dup
(
directory
.
get
()));
if
(
!
dup_fd
.
is_valid
())
{
FML_DLOG
(
ERROR
)
<<
"Can't dup the directory fd. Error: "
<<
strerror
(
errno
);
...
...
fml/platform/win/file_win.cc
浏览文件 @
89e39585
...
...
@@ -399,7 +399,7 @@ bool WriteAtomically(const fml::UniqueFD& base_directory,
return
true
;
}
bool
VisitFiles
(
const
fml
::
UniqueFD
&
directory
,
FileVisitor
visitor
)
{
bool
VisitFiles
(
const
fml
::
UniqueFD
&
directory
,
const
FileVisitor
&
visitor
)
{
std
::
string
search_pattern
=
GetFullHandlePath
(
directory
)
+
"
\\
*"
;
WIN32_FIND_DATA
find_file_data
;
HANDLE
find_handle
=
::
FindFirstFile
(
...
...
fml/task_runner.cc
浏览文件 @
89e39585
...
...
@@ -20,17 +20,18 @@ TaskRunner::TaskRunner(fml::RefPtr<MessageLoopImpl> loop)
TaskRunner
::~
TaskRunner
()
=
default
;
void
TaskRunner
::
PostTask
(
fml
::
closure
task
)
{
loop_
->
PostTask
(
std
::
move
(
task
)
,
fml
::
TimePoint
::
Now
());
void
TaskRunner
::
PostTask
(
const
fml
::
closure
&
task
)
{
loop_
->
PostTask
(
task
,
fml
::
TimePoint
::
Now
());
}
void
TaskRunner
::
PostTaskForTime
(
fml
::
closure
task
,
void
TaskRunner
::
PostTaskForTime
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
{
loop_
->
PostTask
(
std
::
move
(
task
)
,
target_time
);
loop_
->
PostTask
(
task
,
target_time
);
}
void
TaskRunner
::
PostDelayedTask
(
fml
::
closure
task
,
fml
::
TimeDelta
delay
)
{
loop_
->
PostTask
(
std
::
move
(
task
),
fml
::
TimePoint
::
Now
()
+
delay
);
void
TaskRunner
::
PostDelayedTask
(
const
fml
::
closure
&
task
,
fml
::
TimeDelta
delay
)
{
loop_
->
PostTask
(
task
,
fml
::
TimePoint
::
Now
()
+
delay
);
}
TaskQueueId
TaskRunner
::
GetTaskQueueId
()
{
...
...
@@ -62,7 +63,7 @@ bool TaskRunner::RunsTasksOnCurrentThread() {
}
void
TaskRunner
::
RunNowOrPostTask
(
fml
::
RefPtr
<
fml
::
TaskRunner
>
runner
,
fml
::
closure
task
)
{
const
fml
::
closure
&
task
)
{
FML_DCHECK
(
runner
);
if
(
runner
->
RunsTasksOnCurrentThread
())
{
task
();
...
...
fml/task_runner.h
浏览文件 @
89e39585
...
...
@@ -20,18 +20,19 @@ class TaskRunner : public fml::RefCountedThreadSafe<TaskRunner> {
public:
virtual
~
TaskRunner
();
virtual
void
PostTask
(
fml
::
closure
task
);
virtual
void
PostTask
(
const
fml
::
closure
&
task
);
virtual
void
PostTaskForTime
(
fml
::
closure
task
,
fml
::
TimePoint
target_time
);
virtual
void
PostTaskForTime
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
);
virtual
void
PostDelayedTask
(
fml
::
closure
task
,
fml
::
TimeDelta
delay
);
virtual
void
PostDelayedTask
(
const
fml
::
closure
&
task
,
fml
::
TimeDelta
delay
);
virtual
bool
RunsTasksOnCurrentThread
();
virtual
TaskQueueId
GetTaskQueueId
();
static
void
RunNowOrPostTask
(
fml
::
RefPtr
<
fml
::
TaskRunner
>
runner
,
fml
::
closure
task
);
const
fml
::
closure
&
task
);
protected:
TaskRunner
(
fml
::
RefPtr
<
MessageLoopImpl
>
loop
);
...
...
lib/ui/painting/image_decoder.cc
浏览文件 @
89e39585
...
...
@@ -188,7 +188,8 @@ static SkiaGPUObject<SkImage> UploadRasterImage(
return
{
texture_image
,
queue
};
}
void
ImageDecoder
::
Decode
(
ImageDescriptor
descriptor
,
ImageResult
callback
)
{
void
ImageDecoder
::
Decode
(
ImageDescriptor
descriptor
,
const
ImageResult
&
callback
)
{
TRACE_EVENT0
(
"flutter"
,
__FUNCTION__
);
fml
::
tracing
::
TraceFlow
flow
(
__FUNCTION__
);
...
...
lib/ui/painting/image_decoder.h
浏览文件 @
89e39585
...
...
@@ -55,7 +55,7 @@ class ImageDecoder {
// concurrently. Texture upload is done on the IO thread and the result
// returned back on the UI thread. On error, the texture is null but the
// callback is guaranteed to return on the UI thread.
void
Decode
(
ImageDescriptor
descriptor
,
ImageResult
result
);
void
Decode
(
ImageDescriptor
descriptor
,
const
ImageResult
&
result
);
fml
::
WeakPtr
<
ImageDecoder
>
GetWeakPtr
()
const
;
...
...
runtime/dart_isolate.cc
浏览文件 @
89e39585
...
...
@@ -41,8 +41,8 @@ std::weak_ptr<DartIsolate> DartIsolate::CreateRootIsolate(
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
Dart_IsolateFlags
*
flags
,
fml
::
closure
isolate_create_callback
,
fml
::
closure
isolate_shutdown_callback
)
{
const
fml
::
closure
&
isolate_create_callback
,
const
fml
::
closure
&
isolate_shutdown_callback
)
{
TRACE_EVENT0
(
"flutter"
,
"DartIsolate::CreateRootIsolate"
);
Dart_Isolate
vm_isolate
=
nullptr
;
std
::
weak_ptr
<
DartIsolate
>
embedder_isolate
;
...
...
@@ -113,9 +113,9 @@ DartIsolate::DartIsolate(const Settings& settings,
fml
::
WeakPtr
<
ImageDecoder
>
image_decoder
,
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
ChildIsolatePreparer
child_isolate_preparer
,
fml
::
closure
isolate_create_callback
,
fml
::
closure
isolate_shutdown_callback
,
const
ChildIsolatePreparer
&
child_isolate_preparer
,
const
fml
::
closure
&
isolate_create_callback
,
const
fml
::
closure
&
isolate_shutdown_callback
,
bool
is_root_isolate
,
bool
is_group_root_isolate
)
:
UIDartState
(
std
::
move
(
task_runners
),
...
...
@@ -481,10 +481,11 @@ static bool InvokeMainEntrypoint(Dart_Handle user_entrypoint_function,
return
true
;
}
/// @note Procedure doesn't copy all closures.
FML_WARN_UNUSED_RESULT
bool
DartIsolate
::
Run
(
const
std
::
string
&
entrypoint_name
,
const
std
::
vector
<
std
::
string
>&
args
,
fml
::
closure
on_run
)
{
const
fml
::
closure
&
on_run
)
{
TRACE_EVENT0
(
"flutter"
,
"DartIsolate::Run"
);
if
(
phase_
!=
Phase
::
Ready
)
{
return
false
;
...
...
@@ -510,11 +511,12 @@ bool DartIsolate::Run(const std::string& entrypoint_name,
return
true
;
}
/// @note Procedure doesn't copy all closures.
FML_WARN_UNUSED_RESULT
bool
DartIsolate
::
RunFromLibrary
(
const
std
::
string
&
library_name
,
const
std
::
string
&
entrypoint_name
,
const
std
::
vector
<
std
::
string
>&
args
,
fml
::
closure
on_run
)
{
const
fml
::
closure
&
on_run
)
{
TRACE_EVENT0
(
"flutter"
,
"DartIsolate::RunFromLibrary"
);
if
(
phase_
!=
Phase
::
Ready
)
{
return
false
;
...
...
@@ -901,9 +903,8 @@ std::weak_ptr<DartIsolate> DartIsolate::GetWeakIsolatePtr() {
return
std
::
static_pointer_cast
<
DartIsolate
>
(
shared_from_this
());
}
void
DartIsolate
::
AddIsolateShutdownCallback
(
fml
::
closure
closure
)
{
shutdown_callbacks_
.
emplace_back
(
std
::
make_unique
<
AutoFireClosure
>
(
std
::
move
(
closure
)));
void
DartIsolate
::
AddIsolateShutdownCallback
(
const
fml
::
closure
&
closure
)
{
shutdown_callbacks_
.
emplace_back
(
std
::
make_unique
<
AutoFireClosure
>
(
closure
));
}
void
DartIsolate
::
OnShutdownCallback
()
{
...
...
@@ -921,8 +922,8 @@ void DartIsolate::OnShutdownCallback() {
}
}
DartIsolate
::
AutoFireClosure
::
AutoFireClosure
(
fml
::
closure
closure
)
:
closure_
(
std
::
move
(
closure
)
)
{}
DartIsolate
::
AutoFireClosure
::
AutoFireClosure
(
const
fml
::
closure
&
closure
)
:
closure_
(
closure
)
{}
DartIsolate
::
AutoFireClosure
::~
AutoFireClosure
()
{
if
(
closure_
)
{
...
...
runtime/dart_isolate.h
浏览文件 @
89e39585
...
...
@@ -199,8 +199,8 @@ class DartIsolate : public UIDartState {
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
Dart_IsolateFlags
*
flags
,
fml
::
closure
isolate_create_callback
,
fml
::
closure
isolate_shutdown_callback
);
const
fml
::
closure
&
isolate_create_callback
,
const
fml
::
closure
&
isolate_shutdown_callback
);
// |UIDartState|
~
DartIsolate
()
override
;
...
...
@@ -332,7 +332,7 @@ class DartIsolate : public UIDartState {
FML_WARN_UNUSED_RESULT
bool
Run
(
const
std
::
string
&
entrypoint
,
const
std
::
vector
<
std
::
string
>&
args
,
fml
::
closure
on_run
=
nullptr
);
const
fml
::
closure
&
on_run
=
nullptr
);
//----------------------------------------------------------------------------
/// @brief Transition the root isolate to the `Phase::Running` phase and
...
...
@@ -356,7 +356,7 @@ class DartIsolate : public UIDartState {
bool
RunFromLibrary
(
const
std
::
string
&
library_name
,
const
std
::
string
&
entrypoint
,
const
std
::
vector
<
std
::
string
>&
args
,
fml
::
closure
on_run
=
nullptr
);
const
fml
::
closure
&
on_run
=
nullptr
);
//----------------------------------------------------------------------------
/// @brief Transition the isolate to the `Phase::Shutdown` phase. The
...
...
@@ -374,7 +374,7 @@ class DartIsolate : public UIDartState {
///
/// @param[in] closure The callback to invoke on isolate shutdown.
///
void
AddIsolateShutdownCallback
(
fml
::
closure
closure
);
void
AddIsolateShutdownCallback
(
const
fml
::
closure
&
closure
);
//----------------------------------------------------------------------------
/// @brief The snapshot used to launch this isolate. This is referenced
...
...
@@ -413,7 +413,7 @@ class DartIsolate : public UIDartState {
class
AutoFireClosure
{
public:
AutoFireClosure
(
fml
::
closure
closure
);
AutoFireClosure
(
const
fml
::
closure
&
closure
);
~
AutoFireClosure
();
...
...
@@ -444,9 +444,9 @@ class DartIsolate : public UIDartState {
fml
::
WeakPtr
<
ImageDecoder
>
image_decoder
,
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
ChildIsolatePreparer
child_isolate_preparer
,
fml
::
closure
isolate_create_callback
,
fml
::
closure
isolate_shutdown_callback
,
const
ChildIsolatePreparer
&
child_isolate_preparer
,
const
fml
::
closure
&
isolate_create_callback
,
const
fml
::
closure
&
isolate_shutdown_callback
,
bool
is_root_isolate
,
bool
is_group_root_isolate
);
FML_WARN_UNUSED_RESULT
bool
Initialize
(
Dart_Isolate
isolate
);
...
...
runtime/dart_service_isolate.cc
浏览文件 @
89e39585
...
...
@@ -81,7 +81,7 @@ void DartServiceIsolate::NotifyServerState(Dart_NativeArguments args) {
}
DartServiceIsolate
::
CallbackHandle
DartServiceIsolate
::
AddServerStatusCallback
(
DartServiceIsolate
::
ObservatoryServerStateCallback
callback
)
{
const
DartServiceIsolate
::
ObservatoryServerStateCallback
&
callback
)
{
if
(
!
callback
)
{
return
0
;
}
...
...
runtime/dart_service_isolate.h
浏览文件 @
89e39585
...
...
@@ -34,7 +34,7 @@ class DartServiceIsolate {
// RemoveServerStatusCallback
FML_WARN_UNUSED_RESULT
static
CallbackHandle
AddServerStatusCallback
(
ObservatoryServerStateCallback
callback
);
const
ObservatoryServerStateCallback
&
callback
);
// Accepts the handle returned by AddServerStatusCallback
static
bool
RemoveServerStatusCallback
(
CallbackHandle
handle
);
...
...
runtime/runtime_controller.cc
浏览文件 @
89e39585
...
...
@@ -25,9 +25,9 @@ RuntimeController::RuntimeController(
fml
::
WeakPtr
<
ImageDecoder
>
p_image_decoder
,
std
::
string
p_advisory_script_uri
,
std
::
string
p_advisory_script_entrypoint
,
std
::
function
<
void
(
int64_t
)
>
p_idle_notification_callback
,
fml
::
closure
p_isolate_create_callback
,
fml
::
closure
p_isolate_shutdown_callback
,
const
std
::
function
<
void
(
int64_t
)
>&
p_idle_notification_callback
,
const
fml
::
closure
&
p_isolate_create_callback
,
const
fml
::
closure
&
p_isolate_shutdown_callback
,
std
::
shared_ptr
<
const
fml
::
Mapping
>
p_persistent_isolate_data
)
:
RuntimeController
(
p_client
,
p_vm
,
...
...
@@ -56,10 +56,10 @@ RuntimeController::RuntimeController(
fml
::
WeakPtr
<
ImageDecoder
>
p_image_decoder
,
std
::
string
p_advisory_script_uri
,
std
::
string
p_advisory_script_entrypoint
,
std
::
function
<
void
(
int64_t
)
>
idle_notification_callback
,
const
std
::
function
<
void
(
int64_t
)
>&
idle_notification_callback
,
WindowData
p_window_data
,
fml
::
closure
p_isolate_create_callback
,
fml
::
closure
p_isolate_shutdown_callback
,
const
fml
::
closure
&
p_isolate_create_callback
,
const
fml
::
closure
&
p_isolate_shutdown_callback
,
std
::
shared_ptr
<
const
fml
::
Mapping
>
p_persistent_isolate_data
)
:
client_
(
p_client
),
vm_
(
p_vm
),
...
...
runtime/runtime_controller.h
浏览文件 @
89e39585
...
...
@@ -39,9 +39,9 @@ class RuntimeController final : public WindowClient {
fml
::
WeakPtr
<
ImageDecoder
>
image_decoder
,
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
std
::
function
<
void
(
int64_t
)
>
idle_notification_callback
,
fml
::
closure
isolate_create_callback
,
fml
::
closure
isolate_shutdown_callback
,
const
std
::
function
<
void
(
int64_t
)
>&
idle_notification_callback
,
const
fml
::
closure
&
isolate_create_callback
,
const
fml
::
closure
&
isolate_shutdown_callback
,
std
::
shared_ptr
<
const
fml
::
Mapping
>
persistent_isolate_data
);
~
RuntimeController
()
override
;
...
...
@@ -155,10 +155,10 @@ class RuntimeController final : public WindowClient {
fml
::
WeakPtr
<
ImageDecoder
>
image_decoder
,
std
::
string
advisory_script_uri
,
std
::
string
advisory_script_entrypoint
,
std
::
function
<
void
(
int64_t
)
>
idle_notification_callback
,
const
std
::
function
<
void
(
int64_t
)
>&
idle_notification_callback
,
WindowData
data
,
fml
::
closure
isolate_create_callback
,
fml
::
closure
isolate_shutdown_callback
,
const
fml
::
closure
&
isolate_create_callback
,
const
fml
::
closure
&
isolate_shutdown_callback
,
std
::
shared_ptr
<
const
fml
::
Mapping
>
persistent_isolate_data
);
Window
*
GetWindowIfAvailable
();
...
...
runtime/skia_concurrent_executor.cc
浏览文件 @
89e39585
...
...
@@ -8,7 +8,7 @@
namespace
flutter
{
SkiaConcurrentExecutor
::
SkiaConcurrentExecutor
(
OnWorkCallback
on_work
)
SkiaConcurrentExecutor
::
SkiaConcurrentExecutor
(
const
OnWorkCallback
&
on_work
)
:
on_work_
(
on_work
)
{}
SkiaConcurrentExecutor
::~
SkiaConcurrentExecutor
()
=
default
;
...
...
runtime/skia_concurrent_executor.h
浏览文件 @
89e39585
...
...
@@ -14,7 +14,7 @@ namespace flutter {
class
SkiaConcurrentExecutor
:
public
SkExecutor
{
public:
using
OnWorkCallback
=
std
::
function
<
void
(
fml
::
closure
work
)
>
;
SkiaConcurrentExecutor
(
OnWorkCallback
on_work
);
SkiaConcurrentExecutor
(
const
OnWorkCallback
&
on_work
);
~
SkiaConcurrentExecutor
()
override
;
...
...
shell/common/animator.cc
浏览文件 @
89e39585
...
...
@@ -244,8 +244,8 @@ void Animator::AwaitVSync() {
delegate_
.
OnAnimatorNotifyIdle
(
dart_frame_deadline_
);
}
void
Animator
::
ScheduleSecondaryVsyncCallback
(
fml
::
closure
callback
)
{
waiter_
->
ScheduleSecondaryCallback
(
std
::
move
(
callback
)
);
void
Animator
::
ScheduleSecondaryVsyncCallback
(
const
fml
::
closure
&
callback
)
{
waiter_
->
ScheduleSecondaryCallback
(
callback
);
}
}
// namespace flutter
shell/common/animator.h
浏览文件 @
89e39585
...
...
@@ -67,7 +67,7 @@ class Animator final {
/// `SmoothPointerDataDispatcher`.
///
/// @see `PointerDataDispatcher::ScheduleSecondaryVsyncCallback`.
void
ScheduleSecondaryVsyncCallback
(
fml
::
closure
callback
);
void
ScheduleSecondaryVsyncCallback
(
const
fml
::
closure
&
callback
);
void
Start
();
...
...
shell/common/engine.cc
浏览文件 @
89e39585
...
...
@@ -481,8 +481,8 @@ void Engine::DoDispatchPacket(std::unique_ptr<PointerDataPacket> packet,
}
}
void
Engine
::
ScheduleSecondaryVsyncCallback
(
fml
::
closure
callback
)
{
animator_
->
ScheduleSecondaryVsyncCallback
(
std
::
move
(
callback
)
);
void
Engine
::
ScheduleSecondaryVsyncCallback
(
const
fml
::
closure
&
callback
)
{
animator_
->
ScheduleSecondaryVsyncCallback
(
callback
);
}
void
Engine
::
HandleAssetPlatformMessage
(
fml
::
RefPtr
<
PlatformMessage
>
message
)
{
...
...
shell/common/engine.h
浏览文件 @
89e39585
...
...
@@ -714,7 +714,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
uint64_t
trace_flow_id
)
override
;
// |PointerDataDispatcher::Delegate|
void
ScheduleSecondaryVsyncCallback
(
fml
::
closure
callback
)
override
;
void
ScheduleSecondaryVsyncCallback
(
const
fml
::
closure
&
callback
)
override
;
//----------------------------------------------------------------------------
/// @brief Get the last Entrypoint that was used in the RunConfiguration
...
...
shell/common/pipeline.h
浏览文件 @
89e39585
...
...
@@ -78,7 +78,7 @@ class Pipeline : public fml::RefCountedThreadSafe<Pipeline<R>> {
Continuation
continuation_
;
size_t
trace_id_
;
ProducerContinuation
(
Continuation
continuation
,
size_t
trace_id
)
ProducerContinuation
(
const
Continuation
&
continuation
,
size_t
trace_id
)
:
continuation_
(
continuation
),
trace_id_
(
trace_id
)
{
TRACE_FLOW_BEGIN
(
"flutter"
,
"PipelineItem"
,
trace_id_
);
TRACE_EVENT_ASYNC_BEGIN0
(
"flutter"
,
"PipelineItem"
,
trace_id_
);
...
...
@@ -127,8 +127,9 @@ class Pipeline : public fml::RefCountedThreadSafe<Pipeline<R>> {
using
Consumer
=
std
::
function
<
void
(
ResourcePtr
)
>
;
/// @note Procedure doesn't copy all closures.
FML_WARN_UNUSED_RESULT
PipelineConsumeResult
Consume
(
Consumer
consumer
)
{
PipelineConsumeResult
Consume
(
const
Consumer
&
consumer
)
{
if
(
consumer
==
nullptr
)
{
return
PipelineConsumeResult
::
NoneAvailable
;
}
...
...
shell/common/platform_view.cc
浏览文件 @
89e39585
...
...
@@ -129,12 +129,12 @@ std::unique_ptr<Surface> PlatformView::CreateRenderingSurface() {
return
nullptr
;
}
void
PlatformView
::
SetNextFrameCallback
(
fml
::
closure
closure
)
{
void
PlatformView
::
SetNextFrameCallback
(
const
fml
::
closure
&
closure
)
{
if
(
!
closure
)
{
return
;
}
delegate_
.
OnPlatformViewSetNextFrameCallback
(
std
::
move
(
closure
)
);
delegate_
.
OnPlatformViewSetNextFrameCallback
(
closure
);
}
}
// namespace flutter
shell/common/platform_view.h
浏览文件 @
89e39585
...
...
@@ -85,7 +85,8 @@ class PlatformView {
///
/// @param[in] closure The callback to execute on the next frame.
///
virtual
void
OnPlatformViewSetNextFrameCallback
(
fml
::
closure
closure
)
=
0
;
virtual
void
OnPlatformViewSetNextFrameCallback
(
const
fml
::
closure
&
closure
)
=
0
;
//--------------------------------------------------------------------------
/// @brief Notifies the delegate the viewport metrics of the platform
...
...
@@ -469,7 +470,7 @@ class PlatformView {
/// @param[in] closure The callback to execute on the render thread when the
/// next frame gets rendered.
///
void
SetNextFrameCallback
(
fml
::
closure
closure
);
void
SetNextFrameCallback
(
const
fml
::
closure
&
closure
);
//----------------------------------------------------------------------------
/// @brief Dispatches pointer events from the embedder to the
...
...
shell/common/pointer_data_dispatcher.h
浏览文件 @
89e39585
...
...
@@ -60,7 +60,8 @@ class PointerDataDispatcher {
///
/// This callback is used to provide the vsync signal needed by
/// `SmoothPointerDataDispatcher`.
virtual
void
ScheduleSecondaryVsyncCallback
(
fml
::
closure
callback
)
=
0
;
virtual
void
ScheduleSecondaryVsyncCallback
(
const
fml
::
closure
&
callback
)
=
0
;
};
//----------------------------------------------------------------------------
...
...
shell/common/rasterizer.cc
浏览文件 @
89e39585
...
...
@@ -483,7 +483,7 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree(
return
Rasterizer
::
Screenshot
{
data
,
layer_tree
->
frame_size
()};
}
void
Rasterizer
::
SetNextFrameCallback
(
fml
::
closure
callback
)
{
void
Rasterizer
::
SetNextFrameCallback
(
const
fml
::
closure
&
callback
)
{
next_frame_callback_
=
callback
;
}
...
...
shell/common/rasterizer.h
浏览文件 @
89e39585
...
...
@@ -354,7 +354,7 @@ class Rasterizer final : public SnapshotDelegate {
/// @param[in] callback The callback to execute when the next layer tree is
/// rendered on-screen.
///
void
SetNextFrameCallback
(
fml
::
closure
callback
);
void
SetNextFrameCallback
(
const
fml
::
closure
&
callback
);
//----------------------------------------------------------------------------
/// @brief Returns a pointer to the compositor context used by this
...
...
shell/common/shell.cc
浏览文件 @
89e39585
...
...
@@ -44,8 +44,8 @@ std::unique_ptr<Shell> Shell::CreateShellOnPlatformThread(
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
)
{
const
Shell
::
CreateCallback
<
PlatformView
>&
on_create_platform_view
,
const
Shell
::
CreateCallback
<
Rasterizer
>&
on_create_rasterizer
)
{
if
(
!
task_runners
.
IsValid
())
{
FML_LOG
(
ERROR
)
<<
"Task runners to run the shell were invalid."
;
return
nullptr
;
...
...
@@ -221,8 +221,8 @@ static void PerformInitializationTasks(const Settings& settings) {
std
::
unique_ptr
<
Shell
>
Shell
::
Create
(
TaskRunners
task_runners
,
Settings
settings
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
)
{
const
Shell
::
CreateCallback
<
PlatformView
>&
on_create_platform_view
,
const
Shell
::
CreateCallback
<
Rasterizer
>&
on_create_rasterizer
)
{
PerformInitializationTasks
(
settings
);
PersistentCache
::
SetCacheSkSL
(
settings
.
cache_sksl
);
...
...
@@ -233,12 +233,12 @@ std::unique_ptr<Shell> Shell::Create(
auto
vm_data
=
vm
->
GetVMData
();
return
Shell
::
Create
(
std
::
move
(
task_runners
),
//
std
::
move
(
settings
),
//
vm_data
->
GetIsolateSnapshot
(),
// isolate snapshot
std
::
move
(
on_create_platform_view
),
//
std
::
move
(
on_create_rasterizer
),
//
std
::
move
(
vm
)
//
return
Shell
::
Create
(
std
::
move
(
task_runners
),
//
std
::
move
(
settings
),
//
vm_data
->
GetIsolateSnapshot
(),
// isolate snapshot
on_create_platform_view
,
//
on_create_rasterizer
,
//
std
::
move
(
vm
)
//
);
}
...
...
@@ -246,8 +246,8 @@ std::unique_ptr<Shell> Shell::Create(
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
,
const
Shell
::
CreateCallback
<
PlatformView
>&
on_create_platform_view
,
const
Shell
::
CreateCallback
<
Rasterizer
>&
on_create_rasterizer
,
DartVMRef
vm
)
{
PerformInitializationTasks
(
settings
);
PersistentCache
::
SetCacheSkSL
(
settings
.
cache_sksl
);
...
...
@@ -404,8 +404,9 @@ void Shell::RunEngine(RunConfiguration run_configuration) {
RunEngine
(
std
::
move
(
run_configuration
),
nullptr
);
}
void
Shell
::
RunEngine
(
RunConfiguration
run_configuration
,
std
::
function
<
void
(
Engine
::
RunStatus
)
>
result_callback
)
{
void
Shell
::
RunEngine
(
RunConfiguration
run_configuration
,
const
std
::
function
<
void
(
Engine
::
RunStatus
)
>&
result_callback
)
{
auto
result
=
[
platform_runner
=
task_runners_
.
GetPlatformTaskRunner
(),
result_callback
](
Engine
::
RunStatus
run_result
)
{
if
(
!
result_callback
)
{
...
...
@@ -862,12 +863,12 @@ void Shell::OnPlatformViewMarkTextureFrameAvailable(int64_t texture_id) {
}
// |PlatformView::Delegate|
void
Shell
::
OnPlatformViewSetNextFrameCallback
(
fml
::
closure
closure
)
{
void
Shell
::
OnPlatformViewSetNextFrameCallback
(
const
fml
::
closure
&
closure
)
{
FML_DCHECK
(
is_setup_
);
FML_DCHECK
(
task_runners_
.
GetPlatformTaskRunner
()
->
RunsTasksOnCurrentThread
());
task_runners_
.
GetGPUTaskRunner
()
->
PostTask
(
[
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
closure
=
std
::
move
(
closure
)
]()
{
[
rasterizer
=
rasterizer_
->
GetWeakPtr
(),
closure
=
closure
]()
{
if
(
rasterizer
)
{
rasterizer
->
SetNextFrameCallback
(
std
::
move
(
closure
));
}
...
...
shell/common/shell.h
浏览文件 @
89e39585
...
...
@@ -122,8 +122,8 @@ class Shell final : public PlatformView::Delegate,
static
std
::
unique_ptr
<
Shell
>
Create
(
TaskRunners
task_runners
,
Settings
settings
,
CreateCallback
<
PlatformView
>
on_create_platform_view
,
CreateCallback
<
Rasterizer
>
on_create_rasterizer
);
const
CreateCallback
<
PlatformView
>&
on_create_platform_view
,
const
CreateCallback
<
Rasterizer
>&
on_create_rasterizer
);
//----------------------------------------------------------------------------
/// @brief Creates a shell instance using the provided settings. The
...
...
@@ -161,8 +161,8 @@ class Shell final : public PlatformView::Delegate,
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
CreateCallback
<
PlatformView
>
on_create_platform_view
,
CreateCallback
<
Rasterizer
>
on_create_rasterizer
,
const
CreateCallback
<
PlatformView
>&
on_create_platform_view
,
const
CreateCallback
<
Rasterizer
>&
on_create_rasterizer
,
DartVMRef
vm
);
//----------------------------------------------------------------------------
...
...
@@ -184,7 +184,7 @@ class Shell final : public PlatformView::Delegate,
/// operation.
///
void
RunEngine
(
RunConfiguration
run_configuration
,
std
::
function
<
void
(
Engine
::
RunStatus
)
>
result_callback
);
const
std
::
function
<
void
(
Engine
::
RunStatus
)
>&
result_callback
);
//------------------------------------------------------------------------------
/// @return The settings used to launch this shell.
...
...
@@ -367,8 +367,8 @@ class Shell final : public PlatformView::Delegate,
TaskRunners
task_runners
,
Settings
settings
,
fml
::
RefPtr
<
const
DartSnapshot
>
isolate_snapshot
,
Shell
::
CreateCallback
<
PlatformView
>
on_create_platform_view
,
Shell
::
CreateCallback
<
Rasterizer
>
on_create_rasterizer
);
const
Shell
::
CreateCallback
<
PlatformView
>&
on_create_platform_view
,
const
Shell
::
CreateCallback
<
Rasterizer
>&
on_create_rasterizer
);
bool
Setup
(
std
::
unique_ptr
<
PlatformView
>
platform_view
,
std
::
unique_ptr
<
Engine
>
engine
,
...
...
@@ -420,7 +420,7 @@ class Shell final : public PlatformView::Delegate,
void
OnPlatformViewMarkTextureFrameAvailable
(
int64_t
texture_id
)
override
;
// |PlatformView::Delegate|
void
OnPlatformViewSetNextFrameCallback
(
fml
::
closure
closure
)
override
;
void
OnPlatformViewSetNextFrameCallback
(
const
fml
::
closure
&
closure
)
override
;
// |Animator::Delegate|
void
OnAnimatorBeginFrame
(
fml
::
TimePoint
frame_time
)
override
;
...
...
shell/common/surface.cc
浏览文件 @
89e39585
...
...
@@ -10,7 +10,7 @@
namespace
flutter
{
SurfaceFrame
::
SurfaceFrame
(
sk_sp
<
SkSurface
>
surface
,
SubmitCallback
submit_callback
)
const
SubmitCallback
&
submit_callback
)
:
submitted_
(
false
),
surface_
(
surface
),
submit_callback_
(
submit_callback
)
{
FML_DCHECK
(
submit_callback_
);
}
...
...
shell/common/surface.h
浏览文件 @
89e39585
...
...
@@ -21,7 +21,7 @@ class SurfaceFrame {
using
SubmitCallback
=
std
::
function
<
bool
(
const
SurfaceFrame
&
surface_frame
,
SkCanvas
*
canvas
)
>
;
SurfaceFrame
(
sk_sp
<
SkSurface
>
surface
,
SubmitCallback
submit_callback
);
SurfaceFrame
(
sk_sp
<
SkSurface
>
surface
,
const
SubmitCallback
&
submit_callback
);
~
SurfaceFrame
();
...
...
shell/common/vsync_waiter.cc
浏览文件 @
89e39585
...
...
@@ -29,7 +29,7 @@ VsyncWaiter::VsyncWaiter(TaskRunners task_runners)
VsyncWaiter
::~
VsyncWaiter
()
=
default
;
// Public method invoked by the animator.
void
VsyncWaiter
::
AsyncWaitForVsync
(
Callback
callback
)
{
void
VsyncWaiter
::
AsyncWaitForVsync
(
const
Callback
&
callback
)
{
if
(
!
callback
)
{
return
;
}
...
...
@@ -55,7 +55,7 @@ void VsyncWaiter::AsyncWaitForVsync(Callback callback) {
AwaitVSync
();
}
void
VsyncWaiter
::
ScheduleSecondaryCallback
(
fml
::
closure
callback
)
{
void
VsyncWaiter
::
ScheduleSecondaryCallback
(
const
fml
::
closure
&
callback
)
{
FML_DCHECK
(
task_runners_
.
GetUITaskRunner
()
->
RunsTasksOnCurrentThread
());
if
(
!
callback
)
{
...
...
shell/common/vsync_waiter.h
浏览文件 @
89e39585
...
...
@@ -23,12 +23,12 @@ class VsyncWaiter : public std::enable_shared_from_this<VsyncWaiter> {
virtual
~
VsyncWaiter
();
void
AsyncWaitForVsync
(
Callback
callback
);
void
AsyncWaitForVsync
(
const
Callback
&
callback
);
/// Add a secondary callback for the next vsync.
///
/// See also |PointerDataDispatcher::ScheduleSecondaryVsyncCallback|.
void
ScheduleSecondaryCallback
(
fml
::
closure
callback
);
void
ScheduleSecondaryCallback
(
const
fml
::
closure
&
callback
);
static
constexpr
float
kUnknownRefreshRateFPS
=
0.0
;
...
...
shell/platform/common/cpp/client_wrapper/include/flutter/basic_message_channel.h
浏览文件 @
89e39585
...
...
@@ -25,7 +25,7 @@ using MessageReply = std::function<void(const T& reply)>;
// to the message.
template
<
typename
T
>
using
MessageHandler
=
std
::
function
<
void
(
const
T
&
message
,
MessageReply
<
T
>
reply
)
>
;
std
::
function
<
void
(
const
T
&
message
,
const
MessageReply
<
T
>&
reply
)
>
;
// A channel for communicating with the Flutter engine by sending asynchronous
// messages.
...
...
@@ -61,7 +61,7 @@ class BasicMessageChannel {
// Registers a handler that should be called any time a message is
// received on this channel.
void
SetMessageHandler
(
MessageHandler
<
T
>
handler
)
const
{
void
SetMessageHandler
(
const
MessageHandler
<
T
>&
handler
)
const
{
const
auto
*
codec
=
codec_
;
std
::
string
channel_name
=
name_
;
BinaryMessageHandler
binary_handler
=
[
handler
,
codec
,
channel_name
](
...
...
shell/platform/common/cpp/incoming_message_dispatcher.cc
浏览文件 @
89e39585
...
...
@@ -12,10 +12,11 @@ IncomingMessageDispatcher::IncomingMessageDispatcher(
IncomingMessageDispatcher
::~
IncomingMessageDispatcher
()
=
default
;
/// @note Procedure doesn't copy all closures.
void
IncomingMessageDispatcher
::
HandleMessage
(
const
FlutterDesktopMessage
&
message
,
std
::
function
<
void
(
void
)
>
input_block_cb
,
std
::
function
<
void
(
void
)
>
input_unblock_cb
)
{
const
std
::
function
<
void
(
void
)
>&
input_block_cb
,
const
std
::
function
<
void
(
void
)
>&
input_unblock_cb
)
{
std
::
string
channel
(
message
.
channel
);
// Find the handler for the channel; if there isn't one, report the failure.
...
...
shell/platform/common/cpp/incoming_message_dispatcher.h
浏览文件 @
89e39585
...
...
@@ -39,8 +39,8 @@ class IncomingMessageDispatcher {
// NotImplemented response to the engine.
void
HandleMessage
(
const
FlutterDesktopMessage
&
message
,
std
::
function
<
void
(
void
)
>
input_block_cb
=
[]
{},
std
::
function
<
void
(
void
)
>
input_unblock_cb
=
[]
{});
const
std
::
function
<
void
(
void
)
>&
input_block_cb
=
[]
{},
const
std
::
function
<
void
(
void
)
>&
input_unblock_cb
=
[]
{});
// Registers a message callback for incoming messages from the Flutter
// side on the specified channel. |callback| will be called with the message
...
...
shell/platform/embedder/embedder_engine.cc
浏览文件 @
89e39585
...
...
@@ -227,7 +227,7 @@ bool EmbedderEngine::ReloadSystemFonts() {
return
shell_
->
ReloadSystemFonts
();
}
bool
EmbedderEngine
::
PostRenderThreadTask
(
fml
::
closure
task
)
{
bool
EmbedderEngine
::
PostRenderThreadTask
(
const
fml
::
closure
&
task
)
{
if
(
!
IsValid
())
{
return
false
;
}
...
...
shell/platform/embedder/embedder_engine.h
浏览文件 @
89e39585
...
...
@@ -76,7 +76,7 @@ class EmbedderEngine {
bool
ReloadSystemFonts
();
bool
PostRenderThreadTask
(
fml
::
closure
task
);
bool
PostRenderThreadTask
(
const
fml
::
closure
&
task
);
bool
RunTask
(
const
FlutterTask
*
task
);
...
...
shell/platform/embedder/embedder_external_texture_gl.cc
浏览文件 @
89e39585
...
...
@@ -10,7 +10,7 @@ namespace flutter {
EmbedderExternalTextureGL
::
EmbedderExternalTextureGL
(
int64_t
texture_identifier
,
ExternalTextureCallback
callback
)
const
ExternalTextureCallback
&
callback
)
:
Texture
(
texture_identifier
),
external_texture_callback_
(
callback
)
{
FML_DCHECK
(
external_texture_callback_
);
}
...
...
shell/platform/embedder/embedder_external_texture_gl.h
浏览文件 @
89e39585
...
...
@@ -18,7 +18,7 @@ class EmbedderExternalTextureGL : public flutter::Texture {
sk_sp
<
SkImage
>
(
int64_t
texture_identifier
,
GrContext
*
,
const
SkISize
&
)
>
;
EmbedderExternalTextureGL
(
int64_t
texture_identifier
,
ExternalTextureCallback
callback
);
const
ExternalTextureCallback
&
callback
);
~
EmbedderExternalTextureGL
();
...
...
shell/platform/embedder/embedder_external_view_embedder.cc
浏览文件 @
89e39585
...
...
@@ -12,8 +12,8 @@
namespace
flutter
{
EmbedderExternalViewEmbedder
::
EmbedderExternalViewEmbedder
(
CreateRenderTargetCallback
create_render_target_callback
,
PresentCallback
present_callback
)
const
CreateRenderTargetCallback
&
create_render_target_callback
,
const
PresentCallback
&
present_callback
)
:
create_render_target_callback_
(
create_render_target_callback
),
present_callback_
(
present_callback
)
{
FML_DCHECK
(
create_render_target_callback_
);
...
...
shell/platform/embedder/embedder_external_view_embedder.h
浏览文件 @
89e39585
...
...
@@ -49,8 +49,8 @@ class EmbedderExternalViewEmbedder final : public ExternalViewEmbedder {
/// embedder for presentation.
///
EmbedderExternalViewEmbedder
(
CreateRenderTargetCallback
create_render_target_callback
,
PresentCallback
present_callback
);
const
CreateRenderTargetCallback
&
create_render_target_callback
,
const
PresentCallback
&
present_callback
);
//----------------------------------------------------------------------------
/// @brief Collects the external view embedder.
...
...
shell/platform/embedder/embedder_layers.cc
浏览文件 @
89e39585
...
...
@@ -203,7 +203,9 @@ void EmbedderLayers::PushPlatformViewLayer(
presented_layers_
.
push_back
(
layer
);
}
// namespace flutter
void
EmbedderLayers
::
InvokePresentCallback
(
PresentCallback
callback
)
const
{
/// @note Procedure doesn't copy all closures.
void
EmbedderLayers
::
InvokePresentCallback
(
const
PresentCallback
&
callback
)
const
{
std
::
vector
<
const
FlutterLayer
*>
presented_layers_pointers
;
presented_layers_pointers
.
reserve
(
presented_layers_
.
size
());
for
(
const
auto
&
layer
:
presented_layers_
)
{
...
...
shell/platform/embedder/embedder_layers.h
浏览文件 @
89e39585
...
...
@@ -31,7 +31,7 @@ class EmbedderLayers {
using
PresentCallback
=
std
::
function
<
bool
(
const
std
::
vector
<
const
FlutterLayer
*>&
layers
)
>
;
void
InvokePresentCallback
(
PresentCallback
callback
)
const
;
void
InvokePresentCallback
(
const
PresentCallback
&
callback
)
const
;
private:
const
SkISize
frame_size_
;
...
...
shell/platform/embedder/embedder_platform_message_response.cc
浏览文件 @
89e39585
...
...
@@ -10,7 +10,7 @@ namespace flutter {
EmbedderPlatformMessageResponse
::
EmbedderPlatformMessageResponse
(
fml
::
RefPtr
<
fml
::
TaskRunner
>
runner
,
Callback
callback
)
const
Callback
&
callback
)
:
runner_
(
std
::
move
(
runner
)),
callback_
(
callback
)
{}
EmbedderPlatformMessageResponse
::~
EmbedderPlatformMessageResponse
()
=
default
;
...
...
shell/platform/embedder/embedder_platform_message_response.h
浏览文件 @
89e39585
...
...
@@ -27,7 +27,7 @@ class EmbedderPlatformMessageResponse : public PlatformMessageResponse {
/// contents of the response sent by the framework back
/// to the emebder.
EmbedderPlatformMessageResponse
(
fml
::
RefPtr
<
fml
::
TaskRunner
>
runner
,
Callback
callback
);
const
Callback
&
callback
);
//----------------------------------------------------------------------------
/// @brief Destroys the message response. Can be called on any thread.
...
...
shell/platform/embedder/embedder_task_runner.cc
浏览文件 @
89e39585
...
...
@@ -26,11 +26,11 @@ size_t EmbedderTaskRunner::GetEmbedderIdentifier() const {
return
embedder_identifier_
;
}
void
EmbedderTaskRunner
::
PostTask
(
fml
::
closure
task
)
{
void
EmbedderTaskRunner
::
PostTask
(
const
fml
::
closure
&
task
)
{
PostTaskForTime
(
task
,
fml
::
TimePoint
::
Now
());
}
void
EmbedderTaskRunner
::
PostTaskForTime
(
fml
::
closure
task
,
void
EmbedderTaskRunner
::
PostTaskForTime
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
{
if
(
!
task
)
{
return
;
...
...
@@ -48,7 +48,7 @@ void EmbedderTaskRunner::PostTaskForTime(fml::closure task,
dispatch_table_
.
post_task_callback
(
this
,
baton
,
target_time
);
}
void
EmbedderTaskRunner
::
PostDelayedTask
(
fml
::
closure
task
,
void
EmbedderTaskRunner
::
PostDelayedTask
(
const
fml
::
closure
&
task
,
fml
::
TimeDelta
delay
)
{
PostTaskForTime
(
task
,
fml
::
TimePoint
::
Now
()
+
delay
);
}
...
...
shell/platform/embedder/embedder_task_runner.h
浏览文件 @
89e39585
...
...
@@ -80,13 +80,14 @@ class EmbedderTaskRunner final : public fml::TaskRunner {
fml
::
TaskQueueId
placeholder_id_
;
// |fml::TaskRunner|
void
PostTask
(
fml
::
closure
task
)
override
;
void
PostTask
(
const
fml
::
closure
&
task
)
override
;
// |fml::TaskRunner|
void
PostTaskForTime
(
fml
::
closure
task
,
fml
::
TimePoint
target_time
)
override
;
void
PostTaskForTime
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
override
;
// |fml::TaskRunner|
void
PostDelayedTask
(
fml
::
closure
task
,
fml
::
TimeDelta
delay
)
override
;
void
PostDelayedTask
(
const
fml
::
closure
&
task
,
fml
::
TimeDelta
delay
)
override
;
// |fml::TaskRunner|
bool
RunsTasksOnCurrentThread
()
override
;
...
...
shell/platform/embedder/tests/embedder_config_builder.cc
浏览文件 @
89e39585
...
...
@@ -181,7 +181,7 @@ void EmbedderConfigBuilder::SetRenderTaskRunner(
}
void
EmbedderConfigBuilder
::
SetPlatformMessageCallback
(
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>
callback
)
{
const
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>&
callback
)
{
context_
.
SetPlatformMessageCallback
(
callback
);
}
...
...
shell/platform/embedder/tests/embedder_config_builder.h
浏览文件 @
89e39585
...
...
@@ -64,7 +64,7 @@ class EmbedderConfigBuilder {
void
SetRenderTaskRunner
(
const
FlutterTaskRunnerDescription
*
runner
);
void
SetPlatformMessageCallback
(
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>
callback
);
const
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>&
callback
);
void
SetCompositor
();
...
...
shell/platform/embedder/tests/embedder_test_compositor.cc
浏览文件 @
89e39585
...
...
@@ -306,19 +306,19 @@ bool EmbedderTestCompositor::CreateSoftwareRenderSurface(
}
void
EmbedderTestCompositor
::
SetNextPresentCallback
(
PresentCallback
next_present_callback
)
{
const
PresentCallback
&
next_present_callback
)
{
FML_CHECK
(
!
next_present_callback_
);
next_present_callback_
=
next_present_callback
;
}
void
EmbedderTestCompositor
::
SetNextSceneCallback
(
NextSceneCallback
next_scene_callback
)
{
const
NextSceneCallback
&
next_scene_callback
)
{
FML_CHECK
(
!
next_scene_callback_
);
next_scene_callback_
=
next_scene_callback
;
}
void
EmbedderTestCompositor
::
SetPlatformViewRendererCallback
(
PlatformViewRendererCallback
callback
)
{
const
PlatformViewRendererCallback
&
callback
)
{
platform_view_renderer_callback_
=
callback
;
}
...
...
shell/platform/embedder/tests/embedder_test_compositor.h
浏览文件 @
89e39585
...
...
@@ -38,7 +38,8 @@ class EmbedderTestCompositor {
using
PlatformViewRendererCallback
=
std
::
function
<
sk_sp
<
SkImage
>
(
const
FlutterLayer
&
layer
,
GrContext
*
context
)
>
;
void
SetPlatformViewRendererCallback
(
PlatformViewRendererCallback
callback
);
void
SetPlatformViewRendererCallback
(
const
PlatformViewRendererCallback
&
callback
);
using
PresentCallback
=
std
::
function
<
void
(
const
FlutterLayer
**
layers
,
size_t
layers_count
)
>
;
...
...
@@ -49,10 +50,10 @@ class EmbedderTestCompositor {
///
/// @param[in] next_present_callback The next present callback
///
void
SetNextPresentCallback
(
PresentCallback
next_present_callback
);
void
SetNextPresentCallback
(
const
PresentCallback
&
next_present_callback
);
using
NextSceneCallback
=
std
::
function
<
void
(
sk_sp
<
SkImage
>
image
)
>
;
void
SetNextSceneCallback
(
NextSceneCallback
next_scene_callback
);
void
SetNextSceneCallback
(
const
NextSceneCallback
&
next_scene_callback
);
sk_sp
<
SkImage
>
GetLastComposition
();
...
...
shell/platform/embedder/tests/embedder_test_context.cc
浏览文件 @
89e39585
...
...
@@ -111,18 +111,18 @@ void EmbedderTestContext::AddNativeCallback(const char* name,
}
void
EmbedderTestContext
::
SetSemanticsNodeCallback
(
SemanticsNodeCallback
update_semantics_node_callback
)
{
const
SemanticsNodeCallback
&
update_semantics_node_callback
)
{
update_semantics_node_callback_
=
update_semantics_node_callback
;
}
void
EmbedderTestContext
::
SetSemanticsCustomActionCallback
(
SemanticsActionCallback
update_semantics_custom_action_callback
)
{
const
SemanticsActionCallback
&
update_semantics_custom_action_callback
)
{
update_semantics_custom_action_callback_
=
update_semantics_custom_action_callback
;
}
void
EmbedderTestContext
::
SetPlatformMessageCallback
(
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>
callback
)
{
const
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>&
callback
)
{
platform_message_callback_
=
callback
;
}
...
...
@@ -217,7 +217,7 @@ EmbedderTestCompositor& EmbedderTestContext::GetCompositor() {
}
void
EmbedderTestContext
::
SetNextSceneCallback
(
NextSceneCallback
next_scene_callback
)
{
const
NextSceneCallback
&
next_scene_callback
)
{
if
(
compositor_
)
{
compositor_
->
SetNextSceneCallback
(
next_scene_callback
);
return
;
...
...
@@ -241,8 +241,9 @@ size_t EmbedderTestContext::GetSoftwareSurfacePresentCount() const {
return
software_surface_present_count_
;
}
/// @note Procedure doesn't copy all closures.
void
EmbedderTestContext
::
FireRootSurfacePresentCallbackIfPresent
(
std
::
function
<
sk_sp
<
SkImage
>
(
void
)
>
image_callback
)
{
const
std
::
function
<
sk_sp
<
SkImage
>
(
void
)
>&
image_callback
)
{
if
(
!
next_scene_callback_
)
{
return
;
}
...
...
shell/platform/embedder/tests/embedder_test_context.h
浏览文件 @
89e39585
...
...
@@ -49,18 +49,19 @@ class EmbedderTestContext {
void
AddNativeCallback
(
const
char
*
name
,
Dart_NativeFunction
function
);
void
SetSemanticsNodeCallback
(
SemanticsNodeCallback
update_semantics_node
);
void
SetSemanticsNodeCallback
(
const
SemanticsNodeCallback
&
update_semantics_node
);
void
SetSemanticsCustomActionCallback
(
SemanticsActionCallback
semantics_custom_action
);
const
SemanticsActionCallback
&
semantics_custom_action
);
void
SetPlatformMessageCallback
(
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>
callback
);
const
std
::
function
<
void
(
const
FlutterPlatformMessage
*
)
>&
callback
);
EmbedderTestCompositor
&
GetCompositor
();
using
NextSceneCallback
=
std
::
function
<
void
(
sk_sp
<
SkImage
>
image
)
>
;
void
SetNextSceneCallback
(
NextSceneCallback
next_scene_callback
);
void
SetNextSceneCallback
(
const
NextSceneCallback
&
next_scene_callback
);
size_t
GetGLSurfacePresentCount
()
const
;
...
...
@@ -126,7 +127,7 @@ class EmbedderTestContext {
bool
SofwarePresent
(
sk_sp
<
SkImage
>
image
);
void
FireRootSurfacePresentCallbackIfPresent
(
std
::
function
<
sk_sp
<
SkImage
>
(
void
)
>
image_callback
);
const
std
::
function
<
sk_sp
<
SkImage
>
(
void
)
>&
image_callback
);
FML_DISALLOW_COPY_AND_ASSIGN
(
EmbedderTestContext
);
};
...
...
shell/platform/embedder/vsync_waiter_embedder.cc
浏览文件 @
89e39585
...
...
@@ -6,7 +6,7 @@
namespace
flutter
{
VsyncWaiterEmbedder
::
VsyncWaiterEmbedder
(
VsyncCallback
vsync_callback
,
VsyncWaiterEmbedder
::
VsyncWaiterEmbedder
(
const
VsyncCallback
&
vsync_callback
,
flutter
::
TaskRunners
task_runners
)
:
VsyncWaiter
(
std
::
move
(
task_runners
)),
vsync_callback_
(
vsync_callback
)
{
FML_DCHECK
(
vsync_callback_
);
...
...
shell/platform/embedder/vsync_waiter_embedder.h
浏览文件 @
89e39585
...
...
@@ -14,7 +14,7 @@ class VsyncWaiterEmbedder final : public VsyncWaiter {
public:
using
VsyncCallback
=
std
::
function
<
void
(
intptr_t
)
>
;
VsyncWaiterEmbedder
(
VsyncCallback
callback
,
VsyncWaiterEmbedder
(
const
VsyncCallback
&
callback
,
flutter
::
TaskRunners
task_runners
);
~
VsyncWaiterEmbedder
()
override
;
...
...
shell/platform/fuchsia/flutter/platform_view_unittest.cc
浏览文件 @
89e39585
...
...
@@ -45,7 +45,7 @@ class MockPlatformViewDelegate : public flutter::PlatformView::Delegate {
// |flutter::PlatformView::Delegate|
void
OnPlatformViewDestroyed
()
{}
// |flutter::PlatformView::Delegate|
void
OnPlatformViewSetNextFrameCallback
(
fml
::
closure
closure
)
{}
void
OnPlatformViewSetNextFrameCallback
(
const
fml
::
closure
&
closure
)
{}
// |flutter::PlatformView::Delegate|
void
OnPlatformViewSetViewportMetrics
(
const
flutter
::
ViewportMetrics
&
metrics
)
{}
...
...
shell/platform/fuchsia/flutter/task_runner_adapter.cc
浏览文件 @
89e39585
...
...
@@ -19,18 +19,20 @@ class CompatTaskRunner : public fml::TaskRunner {
FML_DCHECK
(
forwarding_target_
);
}
void
PostTask
(
fml
::
closure
task
)
override
{
async
::
PostTask
(
forwarding_target_
,
std
::
move
(
task
)
);
void
PostTask
(
const
fml
::
closure
&
task
)
override
{
async
::
PostTask
(
forwarding_target_
,
task
);
}
void
PostTaskForTime
(
fml
::
closure
task
,
fml
::
TimePoint
target_time
)
override
{
void
PostTaskForTime
(
const
fml
::
closure
&
task
,
fml
::
TimePoint
target_time
)
override
{
async
::
PostTaskForTime
(
forwarding_target_
,
std
::
move
(
task
)
,
forwarding_target_
,
task
,
zx
::
time
(
target_time
.
ToEpochDelta
().
ToNanoseconds
()));
}
void
PostDelayedTask
(
fml
::
closure
task
,
fml
::
TimeDelta
delay
)
override
{
async
::
PostDelayedTask
(
forwarding_target_
,
std
::
move
(
task
),
void
PostDelayedTask
(
const
fml
::
closure
&
task
,
fml
::
TimeDelta
delay
)
override
{
async
::
PostDelayedTask
(
forwarding_target_
,
task
,
zx
::
duration
(
delay
.
ToNanoseconds
()));
}
...
...
shell/platform/fuchsia/flutter/vulkan_surface.cc
浏览文件 @
89e39585
...
...
@@ -451,7 +451,7 @@ bool VulkanSurface::FlushSessionAcquireAndReleaseEvents() {
}
void
VulkanSurface
::
SignalWritesFinished
(
std
::
function
<
void
(
void
)
>
on_writes_committed
)
{
const
std
::
function
<
void
(
void
)
>&
on_writes_committed
)
{
FML_DCHECK
(
on_writes_committed
);
if
(
!
valid_
)
{
...
...
shell/platform/fuchsia/flutter/vulkan_surface.h
浏览文件 @
89e39585
...
...
@@ -69,7 +69,7 @@ class VulkanSurface final
// Note: It is safe for the caller to collect the surface in the
// |on_writes_committed| callback.
void
SignalWritesFinished
(
std
::
function
<
void
(
void
)
>
on_writes_committed
)
override
;
const
std
::
function
<
void
(
void
)
>&
on_writes_committed
)
override
;
// |flutter::SceneUpdateContext::SurfaceProducerSurface|
scenic
::
Image
*
GetImage
()
override
;
...
...
shell/platform/glfw/glfw_event_loop.cc
浏览文件 @
89e39585
...
...
@@ -12,7 +12,7 @@
namespace
flutter
{
GLFWEventLoop
::
GLFWEventLoop
(
std
::
thread
::
id
main_thread_id
,
TaskExpiredCallback
on_task_expired
)
const
TaskExpiredCallback
&
on_task_expired
)
:
main_thread_id_
(
main_thread_id
),
on_task_expired_
(
std
::
move
(
on_task_expired
))
{}
...
...
shell/platform/glfw/glfw_event_loop.h
浏览文件 @
89e39585
...
...
@@ -21,7 +21,7 @@ class GLFWEventLoop {
public:
using
TaskExpiredCallback
=
std
::
function
<
void
(
const
FlutterTask
*
)
>
;
GLFWEventLoop
(
std
::
thread
::
id
main_thread_id
,
TaskExpiredCallback
on_task_expired
);
const
TaskExpiredCallback
&
on_task_expired
);
~
GLFWEventLoop
();
...
...
shell/platform/windows/win32_task_runner.cc
浏览文件 @
89e39585
...
...
@@ -10,7 +10,7 @@
namespace
flutter
{
Win32TaskRunner
::
Win32TaskRunner
(
DWORD
main_thread_id
,
TaskExpiredCallback
on_task_expired
)
const
TaskExpiredCallback
&
on_task_expired
)
:
main_thread_id_
(
main_thread_id
),
on_task_expired_
(
std
::
move
(
on_task_expired
))
{}
...
...
shell/platform/windows/win32_task_runner.h
浏览文件 @
89e39585
...
...
@@ -23,7 +23,8 @@ namespace flutter {
class
Win32TaskRunner
{
public:
using
TaskExpiredCallback
=
std
::
function
<
void
(
const
FlutterTask
*
)
>
;
Win32TaskRunner
(
DWORD
main_thread_id
,
TaskExpiredCallback
on_task_expired
);
Win32TaskRunner
(
DWORD
main_thread_id
,
const
TaskExpiredCallback
&
on_task_expired
);
~
Win32TaskRunner
();
...
...
vulkan/vulkan_handle.h
浏览文件 @
89e39585
...
...
@@ -21,7 +21,7 @@ class VulkanHandle {
VulkanHandle
()
:
handle_
(
VK_NULL_HANDLE
)
{}
VulkanHandle
(
Handle
handle
,
Disposer
disposer
=
nullptr
)
VulkanHandle
(
Handle
handle
,
const
Disposer
&
disposer
=
nullptr
)
:
handle_
(
handle
),
disposer_
(
disposer
)
{}
VulkanHandle
(
VulkanHandle
&&
other
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录