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 a361d32
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 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 @@ -18,20 +19,29 @@ using content::TracingController;

namespace mate {

template <>
template<>
struct Converter<base::trace_event::TraceConfig> {
static bool FromV8(v8::Isolate* isolate,
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 a361d32

Please sign in to comment.