Fix API changes of tracing API

This commit is contained in:
Cheng Zhao 2015-03-10 16:02:22 -07:00
parent 04d1075db5
commit dfad907530
2 changed files with 18 additions and 22 deletions

View file

@ -62,31 +62,26 @@ namespace {
void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused, void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context, void* priv) { v8::Handle<v8::Context> context, void* priv) {
TracingController* controller = TracingController::GetInstance(); auto controller = base::Unretained(TracingController::GetInstance());
mate::Dictionary dict(context->GetIsolate(), exports); mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("getCategories", base::Bind( dict.SetMethod("getCategories", base::Bind(
&TracingController::GetCategories, base::Unretained(controller))); &TracingController::GetCategories, controller));
dict.SetMethod("startRecording", base::Bind( dict.SetMethod("startRecording", base::Bind(
&TracingController::EnableRecording, base::Unretained(controller))); &TracingController::EnableRecording, controller));
dict.SetMethod("stopRecording", base::Bind( dict.SetMethod("stopRecording", base::Bind(
&TracingController::DisableRecording, &TracingController::DisableRecording, controller, nullptr));
base::Unretained(controller),
nullptr));
dict.SetMethod("startMonitoring", base::Bind( dict.SetMethod("startMonitoring", base::Bind(
&TracingController::EnableMonitoring, base::Unretained(controller))); &TracingController::EnableMonitoring, controller));
dict.SetMethod("stopMonitoring", base::Bind( dict.SetMethod("stopMonitoring", base::Bind(
&TracingController::DisableMonitoring, base::Unretained(controller))); &TracingController::DisableMonitoring, controller));
dict.SetMethod("captureMonitoringSnapshot", base::Bind( dict.SetMethod("captureMonitoringSnapshot", base::Bind(
&TracingController::CaptureMonitoringSnapshot, &TracingController::CaptureMonitoringSnapshot, controller, nullptr));
base::Unretained(controller), dict.SetMethod("getTraceBufferUsage", base::Bind(
nullptr)); &TracingController::GetTraceBufferUsage, controller));
dict.SetMethod("getTraceBufferPercentFull", base::Bind(
&TracingController::GetTraceBufferPercentFull,
base::Unretained(controller)));
dict.SetMethod("setWatchEvent", base::Bind( dict.SetMethod("setWatchEvent", base::Bind(
&TracingController::SetWatchEvent, base::Unretained(controller))); &TracingController::SetWatchEvent, controller));
dict.SetMethod("cancelWatchEvent", base::Bind( dict.SetMethod("cancelWatchEvent", base::Bind(
&TracingController::CancelWatchEvent, base::Unretained(controller))); &TracingController::CancelWatchEvent, controller));
} }
} // namespace } // namespace

View file

@ -86,8 +86,8 @@ Start monitoring on all processes.
Monitoring begins immediately locally, and asynchronously on child processes as Monitoring begins immediately locally, and asynchronously on child processes as
soon as they receive the `startMonitoring` request. soon as they receive the `startMonitoring` request.
Once all child processes have acked to the `startMonitoring` request, `callback` Once all child processes have acked to the `startMonitoring` request,
will be called back. `callback` will be called back.
## tracing.stopMonitoring(callback); ## tracing.stopMonitoring(callback);
@ -115,12 +115,12 @@ Once all child processes have acked to the `captureMonitoringSnapshot` request,
`callback` will be called back with a file that contains the traced data. `callback` will be called back with a file that contains the traced data.
## tracing.getTraceBufferPercentFull(callback) ## tracing.getTraceBufferUsage(callback)
* `callback` Function * `callback` Function
Get the maximum across processes of trace buffer percent full state. When the Get the maximum across processes of trace buffer percent full state. When the
TraceBufferPercentFull value is determined, the `callback` is called. TraceBufferUsage value is determined, the `callback` is called.
## tracing.setWatchEvent(categoryName, eventName, callback) ## tracing.setWatchEvent(categoryName, eventName, callback)
@ -128,7 +128,8 @@ TraceBufferPercentFull value is determined, the `callback` is called.
* `eventName` String * `eventName` String
* `callback` Function * `callback` Function
`callback` will will be called every time the given event occurs on any process. `callback` will will be called every time the given event occurs on any
process.
## tracing.cancelWatchEvent() ## tracing.cancelWatchEvent()