Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
678409b8
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,发现更多精彩内容 >>
提交
678409b8
编写于
5月 10, 2016
作者:
J
Jason Simmons
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Plumb dart timeline events to mojo:tracing. (#2595)" (#2670)
This needs to be updated for the latest Mojo APIs
上级
ef589f99
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
0 addition
and
255 deletion
+0
-255
sky/engine/core/script/dart_init.cc
sky/engine/core/script/dart_init.cc
+0
-7
sky/engine/public/platform/sky_settings.h
sky/engine/public/platform/sky_settings.h
+0
-1
sky/shell/platform/mojo/BUILD.gn
sky/shell/platform/mojo/BUILD.gn
+0
-3
sky/shell/platform/mojo/dart_tracing.cc
sky/shell/platform/mojo/dart_tracing.cc
+0
-171
sky/shell/platform/mojo/dart_tracing.h
sky/shell/platform/mojo/dart_tracing.h
+0
-66
sky/shell/platform/mojo/main_mojo.cc
sky/shell/platform/mojo/main_mojo.cc
+0
-7
未找到文件。
sky/engine/core/script/dart_init.cc
浏览文件 @
678409b8
...
...
@@ -114,10 +114,6 @@ static const char* kDartTraceStartupArgs[]{
"--timeline_recorder=endless"
,
};
static
const
char
*
kVmCompleteTimelineArgs
[]{
"--complete_timeline"
,
};
const
char
kFileUriPrefix
[]
=
"file://"
;
const
char
kDartFlags
[]
=
"dart-flags"
;
...
...
@@ -511,9 +507,6 @@ void InitDartVM() {
if
(
SkySettings
::
Get
().
trace_startup
)
args
.
append
(
kDartTraceStartupArgs
,
arraysize
(
kDartTraceStartupArgs
));
if
(
SkySettings
::
Get
().
vm_complete_timeline
)
args
.
append
(
kVmCompleteTimelineArgs
,
arraysize
(
kVmCompleteTimelineArgs
));
Vector
<
std
::
string
>
dart_flags
;
if
(
base
::
CommandLine
::
ForCurrentProcess
()
->
HasSwitch
(
kDartFlags
))
{
// Split up dart flags by spaces.
...
...
sky/engine/public/platform/sky_settings.h
浏览文件 @
678409b8
...
...
@@ -19,7 +19,6 @@ struct SkySettings {
bool
start_paused
=
false
;
bool
enable_dart_checked_mode
=
false
;
bool
trace_startup
=
false
;
bool
vm_complete_timeline
=
false
;
std
::
string
aot_snapshot_path
;
static
const
SkySettings
&
Get
();
...
...
sky/shell/platform/mojo/BUILD.gn
浏览文件 @
678409b8
...
...
@@ -13,8 +13,6 @@ mojo_native_application("mojo") {
"application_impl.h",
"content_handler_impl.cc",
"content_handler_impl.h",
"dart_tracing.cc",
"dart_tracing.h",
"main_mojo.cc",
"platform_view_mojo.cc",
"platform_view_mojo.h",
...
...
@@ -38,7 +36,6 @@ mojo_native_application("mojo") {
"//mojo/services/content_handler/interfaces",
"//mojo/services/gfx/composition/interfaces",
"//mojo/services/input_events/interfaces",
"//mojo/services/tracing/interfaces",
"//mojo/services/ui/input/interfaces",
"//mojo/services/ui/views/interfaces",
"//services/asset_bundle:lib",
...
...
sky/shell/platform/mojo/dart_tracing.cc
已删除
100644 → 0
浏览文件 @
ef589f99
// 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.
#include "sky/shell/platform/mojo/dart_tracing.h"
#include <utility>
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "mojo/public/cpp/application/application_impl.h"
namespace
dart
{
void
DartTimelineController
::
Enable
(
const
mojo
::
String
&
categories
)
{
if
(
categories
==
mojo
::
String
(
"Dart"
))
{
Dart_GlobalTimelineSetRecordedStreams
(
DART_TIMELINE_STREAM_DART
);
}
else
{
// TODO(johnmccutchan): Respect |categories|.
EnableAll
();
}
}
void
DartTimelineController
::
EnableAll
()
{
Dart_GlobalTimelineSetRecordedStreams
(
DART_TIMELINE_STREAM_ALL
);
}
void
DartTimelineController
::
Disable
()
{
Dart_GlobalTimelineSetRecordedStreams
(
DART_TIMELINE_STREAM_DISABLE
);
}
DartTraceProvider
::
DartTraceProvider
()
:
binding_
(
this
)
{
}
DartTraceProvider
::~
DartTraceProvider
()
{
}
void
DartTraceProvider
::
Bind
(
mojo
::
InterfaceRequest
<
tracing
::
TraceProvider
>
request
)
{
if
(
!
binding_
.
is_bound
())
{
binding_
.
Bind
(
request
.
Pass
());
}
else
{
LOG
(
ERROR
)
<<
"Cannot accept two connections to TraceProvider."
;
}
}
// tracing::TraceProvider implementation:
void
DartTraceProvider
::
StartTracing
(
const
mojo
::
String
&
categories
,
mojo
::
InterfaceHandle
<
tracing
::
TraceRecorder
>
recorder
)
{
DCHECK
(
!
recorder_
.
get
());
recorder_
=
tracing
::
TraceRecorderPtr
::
Create
(
std
::
move
(
recorder
));
DartTimelineController
::
Enable
(
categories
);
}
static
void
AppendStreamConsumer
(
Dart_StreamConsumer_State
state
,
const
char
*
stream_name
,
const
uint8_t
*
buffer
,
intptr_t
buffer_length
,
void
*
user_data
)
{
if
(
state
==
Dart_StreamConsumer_kFinish
)
{
return
;
}
std
::
vector
<
uint8_t
>*
data
=
reinterpret_cast
<
std
::
vector
<
uint8_t
>*>
(
user_data
);
DCHECK
(
data
);
if
(
state
==
Dart_StreamConsumer_kStart
)
{
data
->
clear
();
return
;
}
DCHECK_EQ
(
state
,
Dart_StreamConsumer_kData
);
// Append data.
data
->
insert
(
data
->
end
(),
buffer
,
buffer
+
buffer_length
);
}
// recorder_->Record():
// 1. Doesn't like big hunks of data.
// See: https://github.com/domokit/mojo/issues/564
// 2. Expects to receive one or more complete JSON maps per call.
// Therefore, we parse the recorded data, split it up and send it to trace
// recorder in chunks.
void
DartTraceProvider
::
SplitAndRecord
(
char
*
data
,
size_t
length
)
{
const
size_t
kMinChunkLength
=
1024
*
1024
;
// 1MB.
// The data from the VM is null-terminated content of a JSON array without its
// enclosing square brackets. Remove the trailing "\0" and add the enclosing
// brackets to make JSON parser happy.
std
::
string
json_data
=
"["
+
std
::
string
(
data
,
length
-
1
)
+
"]"
;
base
::
JSONReader
reader
;
scoped_ptr
<
base
::
Value
>
trace_data
=
reader
.
ReadToValue
(
json_data
);
if
(
!
trace_data
)
{
LOG
(
ERROR
)
<<
"Dart tracing failed to parse the JSON string: "
<<
reader
.
GetErrorMessage
();
return
;
}
base
::
ListValue
*
event_list
;
if
(
!
trace_data
->
GetAsList
(
&
event_list
))
{
LOG
(
ERROR
)
<<
"Dart tracing failed to parse the JSON string: data is not "
<<
"a list."
;
return
;
}
// Iterate over trace events and send over the traces to the recorder each
// time we accumulate more than |kMinChunkLength| worth of data.
std
::
string
current_chunk
;
for
(
base
::
Value
*
val
:
*
event_list
)
{
base
::
DictionaryValue
*
event_dict
;
if
(
!
val
->
GetAsDictionary
(
&
event_dict
))
{
LOG
(
WARNING
)
<<
"Dart tracing ignoring incorrect trace event: "
<<
"not a dictionary"
;
continue
;
}
std
::
string
event_json
;
if
(
!
base
::
JSONWriter
::
Write
(
*
event_dict
,
&
event_json
))
{
LOG
(
WARNING
)
<<
"Dart tracing ignoring trace event: "
<<
"failed to serialize"
;
continue
;
}
if
(
!
current_chunk
.
empty
())
{
current_chunk
+=
","
;
}
current_chunk
+=
event_json
;
if
(
current_chunk
.
size
()
>=
kMinChunkLength
)
{
mojo
::
String
json
(
current_chunk
.
data
(),
current_chunk
.
size
());
recorder_
->
Record
(
json
);
current_chunk
.
clear
();
}
}
if
(
!
current_chunk
.
empty
())
{
mojo
::
String
json
(
current_chunk
.
data
(),
current_chunk
.
size
());
recorder_
->
Record
(
json
);
}
}
// tracing::TraceProvider implementation:
void
DartTraceProvider
::
StopTracing
()
{
DCHECK
(
recorder_
);
DartTimelineController
::
Disable
();
std
::
vector
<
uint8_t
>
data
;
bool
got_trace
=
Dart_GlobalTimelineGetTrace
(
AppendStreamConsumer
,
&
data
);
if
(
got_trace
)
{
SplitAndRecord
(
reinterpret_cast
<
char
*>
(
data
.
data
()),
data
.
size
());
}
recorder_
.
reset
();
}
DartTracingImpl
::
DartTracingImpl
()
{
}
DartTracingImpl
::~
DartTracingImpl
()
{
}
void
DartTracingImpl
::
Initialize
(
mojo
::
ApplicationImpl
*
app
)
{
auto
connection
=
app
->
ConnectToApplication
(
"mojo:tracing"
);
connection
->
AddService
(
this
);
}
void
DartTracingImpl
::
Create
(
mojo
::
ApplicationConnection
*
connection
,
mojo
::
InterfaceRequest
<
tracing
::
TraceProvider
>
request
)
{
provider_impl_
.
Bind
(
request
.
Pass
());
}
}
// namespace dart
sky/shell/platform/mojo/dart_tracing.h
已删除
100644 → 0
浏览文件 @
ef589f99
// 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 SKY_SHELL_PLATFORM_MOJO_DART_TRACING_H_
#define SKY_SHELL_PLATFORM_MOJO_DART_TRACING_H_
#include "base/trace_event/trace_event.h"
#include "mojo/common/tracing_impl.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "mojo/services/tracing/interfaces/tracing.mojom.h"
namespace
dart
{
class
DartTimelineController
{
public:
static
void
Enable
(
const
mojo
::
String
&
categories
);
static
void
EnableAll
();
static
void
Disable
();
};
class
DartTraceProvider
:
public
tracing
::
TraceProvider
{
public:
DartTraceProvider
();
~
DartTraceProvider
()
override
;
void
Bind
(
mojo
::
InterfaceRequest
<
tracing
::
TraceProvider
>
request
);
private:
// tracing::TraceProvider implementation:
void
StartTracing
(
const
mojo
::
String
&
categories
,
mojo
::
InterfaceHandle
<
tracing
::
TraceRecorder
>
recorder
)
override
;
void
StopTracing
()
override
;
void
SplitAndRecord
(
char
*
data
,
size_t
length
);
mojo
::
Binding
<
tracing
::
TraceProvider
>
binding_
;
tracing
::
TraceRecorderPtr
recorder_
;
DISALLOW_COPY_AND_ASSIGN
(
DartTraceProvider
);
};
class
DartTracingImpl
:
public
mojo
::
InterfaceFactory
<
tracing
::
TraceProvider
>
{
public:
DartTracingImpl
();
~
DartTracingImpl
()
override
;
// This connects to the tracing service and registers ourselves to provide
// tracing data on demand.
void
Initialize
(
mojo
::
ApplicationImpl
*
app
);
private:
// InterfaceFactory<tracing::TraceProvider> implementation.
void
Create
(
mojo
::
ApplicationConnection
*
connection
,
mojo
::
InterfaceRequest
<
tracing
::
TraceProvider
>
request
)
override
;
private:
DartTraceProvider
provider_impl_
;
DISALLOW_COPY_AND_ASSIGN
(
DartTracingImpl
);
};
}
// namespace dart
#endif // SKY_SHELL_PLATFORM_MOJO_DART_TRACING_H_
sky/shell/platform/mojo/main_mojo.cc
浏览文件 @
678409b8
...
...
@@ -16,14 +16,12 @@
#include "sky/engine/public/platform/sky_settings.h"
#include "sky/shell/shell.h"
#include "sky/shell/platform/mojo/content_handler_impl.h"
#include "sky/shell/platform/mojo/dart_tracing.h"
namespace
sky
{
namespace
shell
{
namespace
{
const
char
kEnableCheckedMode
[]
=
"--enable-checked-mode"
;
const
char
kVmCompleteTimeline
[]
=
"--vm-complete-timeline"
;
}
// namespace
...
...
@@ -37,15 +35,11 @@ class MojoApp : public mojo::ApplicationDelegate,
// Overridden from ApplicationDelegate:
void
Initialize
(
mojo
::
ApplicationImpl
*
app
)
override
{
mojo
::
icu
::
Initialize
(
app
);
// Tracing of content handler.
tracing_
.
Initialize
(
app
);
// Tracing of isolates and VM.
dart_tracing_
.
Initialize
(
app
);
blink
::
SkySettings
settings
;
settings
.
enable_observatory
=
true
;
settings
.
enable_dart_checked_mode
=
app
->
HasArg
(
kEnableCheckedMode
);
settings
.
vm_complete_timeline
=
app
->
HasArg
(
kVmCompleteTimeline
);
blink
::
SkySettings
::
Set
(
settings
);
Shell
::
Init
();
...
...
@@ -64,7 +58,6 @@ class MojoApp : public mojo::ApplicationDelegate,
}
mojo
::
TracingImpl
tracing_
;
dart
::
DartTracingImpl
dart_tracing_
;
DISALLOW_COPY_AND_ASSIGN
(
MojoApp
);
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录