Browse Source

Fix API changes of tracing API

Cheng Zhao 10 years ago
parent
commit
dfad907530
2 changed files with 18 additions and 22 deletions
  1. 11 16
      atom/browser/api/atom_api_content_tracing.cc
  2. 7 6
      docs/api/content-tracing.md

+ 11 - 16
atom/browser/api/atom_api_content_tracing.cc

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

+ 7 - 6
docs/api/content-tracing.md

@@ -86,8 +86,8 @@ Start monitoring on all processes.
 Monitoring begins immediately locally, and asynchronously on child processes as
 soon as they receive the `startMonitoring` request.
 
-Once all child processes have acked to the `startMonitoring` request, `callback`
-will be called back.
+Once all child processes have acked to the `startMonitoring` request,
+`callback` will be called back.
 
 ## 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.
 
 
-## tracing.getTraceBufferPercentFull(callback)
+## tracing.getTraceBufferUsage(callback)
 
 * `callback` Function
 
-Get the maximum across processes of trace buffer percent full state.  When the
-TraceBufferPercentFull value is determined, the `callback` is called.
+Get the maximum across processes of trace buffer percent full state. When the
+TraceBufferUsage value is determined, the `callback` is called.
 
 ## tracing.setWatchEvent(categoryName, eventName, callback)
 
@@ -128,7 +128,8 @@ TraceBufferPercentFull value is determined, the `callback` is called.
 * `eventName` String
 * `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()