Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
liujiuri
engine
提交
dfd6f992
E
engine
项目概览
liujiuri
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dfd6f992
编写于
8月 06, 2016
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove //base depedency from DartDebugger
上级
1287f8a0
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
44 addition
and
134 deletion
+44
-134
flutter/tonic/BUILD.gn
flutter/tonic/BUILD.gn
+2
-0
flutter/tonic/dart_debugger.cc
flutter/tonic/dart_debugger.cc
+15
-15
flutter/tonic/dart_debugger.h
flutter/tonic/dart_debugger.h
+10
-19
flutter/tonic/dart_isolate_reloader.cc
flutter/tonic/dart_isolate_reloader.cc
+11
-11
flutter/tonic/dart_isolate_reloader.h
flutter/tonic/dart_isolate_reloader.h
+2
-3
flutter/tonic/monitor.h
flutter/tonic/monitor.h
+0
-75
sky/engine/core/core.gni
sky/engine/core/core.gni
+0
-7
sky/engine/core/script/dart_controller.cc
sky/engine/core/script/dart_controller.cc
+2
-2
sky/engine/core/script/dart_init.cc
sky/engine/core/script/dart_init.cc
+2
-2
未找到文件。
flutter/tonic/BUILD.gn
浏览文件 @
dfd6f992
...
...
@@ -4,6 +4,8 @@
source_set("tonic") {
sources = [
"dart_debugger.cc",
"dart_debugger.h",
"dart_dependency_catcher.cc",
"dart_dependency_catcher.h",
"dart_io.cc",
...
...
sky/engine/core/script
/dart_debugger.cc
→
flutter/tonic
/dart_debugger.cc
浏览文件 @
dfd6f992
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "
sky/engine/core/script
/dart_debugger.h"
#include "
flutter/tonic
/dart_debugger.h"
#include "dart/runtime/include/dart_api.h"
#include "dart/runtime/include/dart_native_api.h"
...
...
@@ -12,7 +12,7 @@
namespace
blink
{
void
DartDebuggerIsolate
::
MessageLoop
()
{
MonitorLocker
ml
(
&
monitor_
);
ftl
::
MonitorLocker
locker
(
&
monitor_
);
Dart_MessageNotifyCallback
saved_message_notify_callback
=
Dart_GetMessageNotifyCallback
();
// Request notification on isolate messages. This allows us to
...
...
@@ -30,7 +30,7 @@ void DartDebuggerIsolate::MessageLoop() {
if
(
resume
)
{
break
;
}
ml
.
Wait
();
locker
.
Wait
();
}
Dart_SetMessageNotifyCallback
(
saved_message_notify_callback
);
}
...
...
@@ -47,7 +47,7 @@ void DartDebugger::PausedEventHandler(Dart_IsolateId isolate_id,
const
Dart_CodeLocation
&
loc
)
{
Dart_EnterScope
();
intptr_t
isolate_index
=
FindIsolateIndexById
(
isolate_id
);
CHECK
(
isolate_index
!=
-
1
);
FTL_
CHECK
(
isolate_index
!=
-
1
);
(
*
isolates_
)[
isolate_index
]
->
MessageLoop
();
Dart_ExitScope
();
}
...
...
@@ -57,7 +57,7 @@ void DartDebugger::ExceptionThrownHandler(Dart_IsolateId isolate_id,
Dart_StackTrace
stack_trace
)
{
Dart_EnterScope
();
intptr_t
isolate_index
=
FindIsolateIndexById
(
isolate_id
);
CHECK
(
isolate_index
!=
-
1
);
FTL_
CHECK
(
isolate_index
!=
-
1
);
(
*
isolates_
)[
isolate_index
]
->
MessageLoop
();
Dart_ExitScope
();
}
...
...
@@ -69,11 +69,11 @@ void DartDebugger::IsolateEventHandler(Dart_IsolateId isolate_id,
AddIsolate
(
isolate_id
);
}
else
{
intptr_t
isolate_index
=
FindIsolateIndexById
(
isolate_id
);
CHECK
(
isolate_index
!=
-
1
);
FTL_
CHECK
(
isolate_index
!=
-
1
);
if
(
kind
==
Dart_IsolateEvent
::
kInterrupted
)
{
(
*
isolates_
)[
isolate_index
]
->
MessageLoop
();
}
else
{
CHECK
(
kind
==
Dart_IsolateEvent
::
kShutdown
);
FTL_
CHECK
(
kind
==
Dart_IsolateEvent
::
kShutdown
);
RemoveIsolate
(
isolate_id
);
}
}
...
...
@@ -81,7 +81,7 @@ void DartDebugger::IsolateEventHandler(Dart_IsolateId isolate_id,
}
void
DartDebugger
::
NotifyIsolate
(
Dart_Isolate
isolate
)
{
base
::
AutoLock
al
(
*
lock
_
);
ftl
::
MutexLocker
locker
(
mutex
_
);
Dart_IsolateId
isolate_id
=
Dart_GetIsolateId
(
isolate
);
intptr_t
isolate_index
=
FindIsolateIndexByIdLocked
(
isolate_id
);
if
(
isolate_index
>=
0
)
{
...
...
@@ -94,17 +94,17 @@ void DartDebugger::InitDebugger() {
Dart_SetPausedEventHandler
(
PausedEventHandler
);
Dart_SetBreakpointResolvedHandler
(
BptResolvedHandler
);
Dart_SetExceptionThrownHandler
(
ExceptionThrownHandler
);
lock_
=
new
base
::
Lock
();
mutex_
=
new
ftl
::
Mutex
();
isolates_
=
new
std
::
vector
<
std
::
unique_ptr
<
DartDebuggerIsolate
>>
();
}
intptr_t
DartDebugger
::
FindIsolateIndexById
(
Dart_IsolateId
id
)
{
base
::
AutoLock
al
(
*
lock
_
);
ftl
::
MutexLocker
locker
(
mutex
_
);
return
FindIsolateIndexByIdLocked
(
id
);
}
intptr_t
DartDebugger
::
FindIsolateIndexByIdLocked
(
Dart_IsolateId
id
)
{
lock_
->
AssertAcquire
d
();
mutex_
->
AssertHel
d
();
for
(
size_t
i
=
0
;
i
<
isolates_
->
size
();
i
++
)
{
if
((
*
isolates_
)[
i
]
->
id
()
==
id
)
{
return
i
;
...
...
@@ -114,15 +114,15 @@ intptr_t DartDebugger::FindIsolateIndexByIdLocked(Dart_IsolateId id) {
}
void
DartDebugger
::
AddIsolate
(
Dart_IsolateId
id
)
{
base
::
AutoLock
al
(
*
lock
_
);
CHECK
(
FindIsolateIndexByIdLocked
(
id
)
==
-
1
);
ftl
::
MutexLocker
locker
(
mutex
_
);
FTL_
CHECK
(
FindIsolateIndexByIdLocked
(
id
)
==
-
1
);
std
::
unique_ptr
<
DartDebuggerIsolate
>
debugger_isolate
=
std
::
unique_ptr
<
DartDebuggerIsolate
>
(
new
DartDebuggerIsolate
(
id
));
isolates_
->
push_back
(
std
::
move
(
debugger_isolate
));
}
void
DartDebugger
::
RemoveIsolate
(
Dart_IsolateId
id
)
{
base
::
AutoLock
al
(
*
lock
_
);
ftl
::
MutexLocker
locker
(
mutex
_
);
for
(
size_t
i
=
0
;
i
<
isolates_
->
size
();
i
++
)
{
if
(
id
==
(
*
isolates_
)[
i
]
->
id
())
{
isolates_
->
erase
(
isolates_
->
begin
()
+
i
);
...
...
@@ -132,7 +132,7 @@ void DartDebugger::RemoveIsolate(Dart_IsolateId id) {
FTL_NOTREACHED
();
}
base
::
Lock
*
DartDebugger
::
lock
_
=
nullptr
;
ftl
::
Mutex
*
DartDebugger
::
mutex
_
=
nullptr
;
std
::
vector
<
std
::
unique_ptr
<
DartDebuggerIsolate
>>*
DartDebugger
::
isolates_
=
nullptr
;
...
...
sky/engine/core/script
/dart_debugger.h
→
flutter/tonic
/dart_debugger.h
浏览文件 @
dfd6f992
...
...
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef
SKY_ENGINE_CORE_SCRIPT
_DART_DEBUGGER_H_
#define
SKY_ENGINE_CORE_SCRIPT
_DART_DEBUGGER_H_
#ifndef
FLUTTER_TONIC
_DART_DEBUGGER_H_
#define
FLUTTER_TONIC
_DART_DEBUGGER_H_
#include <memory>
#include <vector>
...
...
@@ -11,33 +11,24 @@
#include "dart/runtime/include/dart_api.h"
#include "dart/runtime/include/dart_native_api.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/tonic/monitor.h"
namespace
base
{
class
Lock
;
}
#include "lib/ftl/synchronization/monitor.h"
#include "lib/ftl/synchronization/mutex.h"
namespace
blink
{
class
DartDebuggerIsolate
{
public:
DartDebuggerIsolate
(
Dart_IsolateId
id
)
:
id_
(
id
)
{
}
DartDebuggerIsolate
(
Dart_IsolateId
id
)
:
id_
(
id
)
{}
Dart_IsolateId
id
()
const
{
return
id_
;
}
Dart_IsolateId
id
()
const
{
return
id_
;
}
void
Notify
()
{
monitor_
.
Notify
();
}
void
Notify
()
{
monitor_
.
Signal
();
}
void
MessageLoop
();
private:
const
Dart_IsolateId
id_
;
Monitor
monitor_
;
ftl
::
Monitor
monitor_
;
};
class
DartDebugger
{
...
...
@@ -70,7 +61,7 @@ class DartDebugger {
static
void
RemoveIsolate
(
Dart_IsolateId
id
);
static
base
::
Lock
*
lock
_
;
static
ftl
::
Mutex
*
mutex
_
;
static
std
::
vector
<
std
::
unique_ptr
<
DartDebuggerIsolate
>>*
isolates_
;
friend
class
DartDebuggerIsolate
;
...
...
@@ -78,4 +69,4 @@ class DartDebugger {
}
// namespace blink
#endif //
SKY_ENGINE_CORE_SCRIPT
_DART_DEBUGGER_H_
#endif //
FLUTTER_TONIC
_DART_DEBUGGER_H_
flutter/tonic/dart_isolate_reloader.cc
浏览文件 @
dfd6f992
...
...
@@ -7,15 +7,15 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/threading/thread.h"
#include "lib/tonic/scopes/dart_api_scope.h"
#include "lib/tonic/converter/dart_converter.h"
#include "flutter/tonic/dart_dependency_catcher.h"
#include "lib/tonic/logging/dart_error.h"
#include "lib/tonic/scopes/dart_isolate_scope.h"
#include "flutter/tonic/dart_library_provider.h"
#include "flutter/tonic/dart_library_loader.h"
#include "flutter/tonic/dart_library_provider.h"
#include "flutter/tonic/dart_state.h"
#include "flutter/tonic/monitor.h"
#include "lib/ftl/synchronization/monitor.h"
#include "lib/tonic/converter/dart_converter.h"
#include "lib/tonic/logging/dart_error.h"
#include "lib/tonic/scopes/dart_api_scope.h"
#include "lib/tonic/scopes/dart_isolate_scope.h"
#include "mojo/data_pipe_utils/data_pipe_drainer.h"
using
mojo
::
common
::
DataPipeDrainer
;
...
...
@@ -117,7 +117,7 @@ void DartIsolateReloader::SendRequest(Dart_LibraryTag tag,
scoped_refptr
<
base
::
TaskRunner
>
runner
=
thread_
->
message_loop
()
->
task_runner
();
MonitorLocker
ml
(
&
monitor_
);
ftl
::
MonitorLocker
locker
(
&
monitor_
);
// Post a task to the worker thread. This task will request the I/O and
// post a LoadResult to be processed once complete.
...
...
@@ -131,10 +131,10 @@ void DartIsolateReloader::SendRequest(Dart_LibraryTag tag,
}
void
DartIsolateReloader
::
PostResult
(
std
::
unique_ptr
<
LoadResult
>
load_result
)
{
MonitorLocker
ml
(
&
monitor_
);
ftl
::
MonitorLocker
locker
(
&
monitor_
);
pending_requests_
--
;
load_results_
.
push
(
std
::
move
(
load_result
));
ml
.
Notify
();
locker
.
Signal
();
}
// As each source file is requested, a LoadRequest is queued to be processed on
...
...
@@ -247,7 +247,7 @@ bool DartIsolateReloader::IsCompleteLocked() {
}
bool
DartIsolateReloader
::
BlockUntilComplete
()
{
MonitorLocker
ml
(
&
monitor_
);
ftl
::
MonitorLocker
locker
(
&
monitor_
);
while
(
true
)
{
ProcessResultQueueLocked
();
...
...
@@ -257,7 +257,7 @@ bool DartIsolateReloader::BlockUntilComplete() {
}
// Wait to be notified about new I/O results.
ml
.
Wait
();
locker
.
Wait
();
}
return
!
Dart_IsNull
(
load_error_
);
}
...
...
flutter/tonic/dart_isolate_reloader.h
浏览文件 @
dfd6f992
...
...
@@ -14,11 +14,10 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/thread.h"
#include "dart/runtime/include/dart_api.h"
#include "
flutter/tonic
/monitor.h"
#include "
lib/ftl/synchronization
/monitor.h"
namespace
blink
{
class
DartLibraryProvider
;
class
Monitor
;
// Reloading an isolate must be an atomic operation, meaning, no other tasks
// can run while reloading. A nested run loop is not sufficient because other
...
...
@@ -60,7 +59,7 @@ class DartIsolateReloader {
std
::
unique_ptr
<
base
::
Thread
>
thread_
;
DartLibraryProvider
*
library_provider_
;
Monitor
monitor_
;
ftl
::
Monitor
monitor_
;
// The monitor is used to protect the following fields:
Dart_Handle
load_error_
;
std
::
queue
<
std
::
unique_ptr
<
LoadResult
>>
load_results_
;
...
...
flutter/tonic/monitor.h
已删除
100644 → 0
浏览文件 @
1287f8a0
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef FLUTTER_TONIC_DART_MONITOR_H_
#define FLUTTER_TONIC_DART_MONITOR_H_
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
namespace
blink
{
class
Monitor
{
public:
Monitor
()
{
lock_
=
new
base
::
Lock
();
condition_variable_
=
new
base
::
ConditionVariable
(
lock_
);
}
~
Monitor
()
{
delete
condition_variable_
;
delete
lock_
;
}
void
Enter
()
{
lock_
->
Acquire
();
}
void
Exit
()
{
lock_
->
Release
();
}
void
Notify
()
{
condition_variable_
->
Signal
();
}
void
Wait
()
{
condition_variable_
->
Wait
();
}
private:
base
::
Lock
*
lock_
;
base
::
ConditionVariable
*
condition_variable_
;
DISALLOW_COPY_AND_ASSIGN
(
Monitor
);
};
class
MonitorLocker
{
public:
explicit
MonitorLocker
(
Monitor
*
monitor
)
:
monitor_
(
monitor
)
{
CHECK
(
monitor_
);
monitor_
->
Enter
();
}
virtual
~
MonitorLocker
()
{
monitor_
->
Exit
();
}
void
Wait
()
{
return
monitor_
->
Wait
();
}
void
Notify
()
{
monitor_
->
Notify
();
}
private:
Monitor
*
const
monitor_
;
DISALLOW_COPY_AND_ASSIGN
(
MonitorLocker
);
};
}
// namespace blink
#endif // FLUTTER_TONIC_DART_MONITOR_H_
sky/engine/core/core.gni
浏览文件 @
dfd6f992
...
...
@@ -172,13 +172,6 @@ sky_core_files = [
"window/window.h",
]
if (!flutter_product_mode) {
sky_core_files += [
"script/dart_debugger.cc",
"script/dart_debugger.h",
]
}
core_dart_files = get_path_info([
"dart/hash_codes.dart",
"dart/hooks.dart",
...
...
sky/engine/core/script/dart_controller.cc
浏览文件 @
dfd6f992
...
...
@@ -6,15 +6,16 @@
#include "base/bind.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/tonic/dart_debugger.h"
#include "flutter/tonic/dart_dependency_catcher.h"
#include "flutter/tonic/dart_io.h"
#include "flutter/tonic/dart_library_loader.h"
#include "flutter/tonic/dart_snapshot_loader.h"
#include "flutter/tonic/dart_state.h"
#include "lib/tonic/dart_wrappable.h"
#include "glue/trace_event.h"
#include "lib/tonic/dart_class_library.h"
#include "lib/tonic/dart_message_handler.h"
#include "lib/tonic/dart_wrappable.h"
#include "lib/tonic/logging/dart_error.h"
#include "lib/tonic/logging/dart_invoke.h"
#include "lib/tonic/scopes/dart_api_scope.h"
...
...
@@ -24,7 +25,6 @@
#include "sky/engine/bindings/dart_mojo_internal.h"
#include "sky/engine/bindings/dart_runtime_hooks.h"
#include "sky/engine/bindings/dart_ui.h"
#include "sky/engine/core/script/dart_debugger.h"
#include "sky/engine/core/script/dart_init.h"
#include "sky/engine/core/script/dart_service_isolate.h"
#include "sky/engine/core/script/ui_dart_state.h"
...
...
sky/engine/core/script/dart_init.cc
浏览文件 @
dfd6f992
...
...
@@ -19,14 +19,15 @@
#include "base/trace_event/trace_event.h"
#include "dart/runtime/bin/embedded_dart_io.h"
#include "dart/runtime/include/dart_mirrors_api.h"
#include "flutter/tonic/dart_debugger.h"
#include "flutter/tonic/dart_dependency_catcher.h"
#include "flutter/tonic/dart_io.h"
#include "flutter/tonic/dart_library_loader.h"
#include "flutter/tonic/dart_snapshot_loader.h"
#include "flutter/tonic/dart_state.h"
#include "lib/tonic/dart_wrappable.h"
#include "lib/ftl/logging.h"
#include "lib/tonic/dart_class_library.h"
#include "lib/tonic/dart_wrappable.h"
#include "lib/tonic/logging/dart_error.h"
#include "lib/tonic/logging/dart_invoke.h"
#include "lib/tonic/scopes/dart_api_scope.h"
...
...
@@ -37,7 +38,6 @@
#include "sky/engine/bindings/dart_mojo_internal.h"
#include "sky/engine/bindings/dart_runtime_hooks.h"
#include "sky/engine/bindings/dart_ui.h"
#include "sky/engine/core/script/dart_debugger.h"
#include "sky/engine/core/script/dart_service_isolate.h"
#include "sky/engine/core/script/ui_dart_state.h"
#include "sky/engine/core/start_up.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录