Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Record JavaScript calls in DevTools timeline on Node/ipc callback #8159

Merged
merged 2 commits into from
Dec 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions atom/common/node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/trace_event/trace_event.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_paths.h"
#include "native_mate/dictionary.h"
Expand Down Expand Up @@ -239,8 +240,15 @@ void NodeBindings::UvRunOnce() {
v8::MicrotasksScope script_scope(env->isolate(),
v8::MicrotasksScope::kRunMicrotasks);

if (!is_browser_)
TRACE_EVENT_BEGIN0("devtools.timeline", "FunctionCall");

// Deal with uv events.
int r = uv_run(uv_loop_, UV_RUN_NOWAIT);

if (!is_browser_)
TRACE_EVENT_END0("devtools.timeline", "FunctionCall");

if (r == 0)
message_loop_->QuitWhenIdle(); // Quit from uv.

Expand Down
2 changes: 2 additions & 0 deletions atom/renderer/atom_render_view_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "atom/renderer/atom_renderer_client.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/trace_event.h"
#include "content/public/renderer/render_view.h"
#include "ipc/ipc_message_macros.h"
#include "native_mate/dictionary.h"
Expand Down Expand Up @@ -102,6 +103,7 @@ void AtomRenderViewObserver::EmitIPCEvent(blink::WebFrame* frame,

v8::Local<v8::Object> ipc;
if (GetIPCObject(isolate, context, &ipc)) {
TRACE_EVENT0("devtools.timeline", "FunctionCall");
auto args_vector = ListValueToVector(isolate, args);
// Insert the Event object, event.sender is ipc.
mate::Dictionary event = mate::Dictionary::CreateEmpty(isolate);
Expand Down