Skip to content

Commit

Permalink
fix: extending tracing startRecording API to take a full tracing config
Browse files Browse the repository at this point in the history
This allows memory-infra to be traced correctly.
Fixes #12506.
  • Loading branch information
ZacWalk authored and alexeykuzmin committed Nov 12, 2018
1 parent a54dd10 commit 4ff6f96
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions atom/browser/api/atom_api_content_tracing.cc
Expand Up @@ -7,6 +7,7 @@

#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "content/public/browser/tracing_controller.h"
Expand All @@ -24,14 +25,22 @@ struct Converter<base::trace_event::TraceConfig> {
v8::Local<v8::Value> val,
base::trace_event::TraceConfig* out) {
Dictionary options;
if (!ConvertFromV8(isolate, val, &options))
return false;
std::string category_filter, trace_options;
if (!options.Get("categoryFilter", &category_filter) ||
!options.Get("traceOptions", &trace_options))
return false;
*out = base::trace_event::TraceConfig(category_filter, trace_options);
return true;
if (ConvertFromV8(isolate, val, &options)) {
std::string category_filter, trace_options;
if (options.Get("categoryFilter", &category_filter) &&
options.Get("traceOptions", &trace_options)) {
*out = base::trace_event::TraceConfig(category_filter, trace_options);
return true;
}
}

base::DictionaryValue memory_dump_config;
if (ConvertFromV8(isolate, val, &memory_dump_config)) {
*out = base::trace_event::TraceConfig(memory_dump_config);
return true;
}

return false;
}
};

Expand Down

0 comments on commit 4ff6f96

Please sign in to comment.