Skip to content

Commit

Permalink
inspector: store generated code
Browse files Browse the repository at this point in the history
This is instead of generating on each build. When a developer changes
the protocol, it will require checking in the generated source.
  • Loading branch information
refack committed Sep 4, 2018
1 parent 3f5cbd0 commit 4de9f99
Show file tree
Hide file tree
Showing 7 changed files with 3,059 additions and 1 deletion.
6 changes: 5 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -508,9 +508,13 @@
'src/inspector/main_thread_interface.h',
'src/inspector/node_string.h',
'src/inspector/tracing_agent.h',
'src/inspector/node_protocol/Forward.h',
'src/inspector/node_protocol/Protocol.cpp',
'src/inspector/node_protocol/Protocol.h',
'src/inspector/node_protocol/NodeTracing.cpp',
'src/inspector/node_protocol/NodeTracing.h',
],
'dependencies': [
'src/inspector/inspector_protocol.gyp:generate_concatenated_inspector_sources',
'src/inspector/inspector_protocol.gyp:generate_concatenated_inspector_protocol',
],
}, {
Expand Down
88 changes: 88 additions & 0 deletions src/inspector/node_protocol.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"version": {
"major": "1",
"minor": "0"
},
"domains": [
{
"domain": "NodeTracing",
"experimental": true,
"types": [
{
"id": "TraceConfig",
"type": "object",
"properties": [
{
"name": "recordMode",
"description": "Controls how the trace buffer stores data.",
"optional": true,
"type": "string",
"enum": [
"recordUntilFull",
"recordContinuously",
"recordAsMuchAsPossible"
]
},
{
"name": "includedCategories",
"description": "Included category filters.",
"type": "array",
"items": {
"type": "string"
}
}
]
}
],
"commands": [
{
"name": "getCategories",
"description": "Gets supported tracing categories.",
"returns": [
{
"name": "categories",
"description": "A list of supported tracing categories.",
"type": "array",
"items": {
"type": "string"
}
}
]
},
{
"name": "start",
"description": "Start trace events collection.",
"parameters": [
{
"name": "traceConfig",
"$ref": "TraceConfig"
}
]
},
{
"name": "stop",
"description": "Stop trace events collection. Remaining collected events will be sent as a sequence of\ndataCollected events followed by tracingComplete event."
}
],
"events": [
{
"name": "dataCollected",
"description": "Contains an bucket of collected trace events.",
"parameters": [
{
"name": "value",
"type": "array",
"items": {
"type": "object"
}
}
]
},
{
"name": "tracingComplete",
"description": "Signals that tracing is stopped and there is no trace buffers pending flush, all data were\ndelivered via dataCollected events."
}
]
}
]
}
98 changes: 98 additions & 0 deletions src/inspector/node_protocol/Forward.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef node_inspector_protocol_Forward_h
#define node_inspector_protocol_Forward_h

#include "inspector/node_string.h"

#include <vector>

namespace node {
namespace inspector {
namespace protocol {

template<typename T> class Array;
class DictionaryValue;
class DispatchResponse;
class ErrorSupport;
class FundamentalValue;
class ListValue;
template<typename T> class Maybe;
class Object;
using Response = DispatchResponse;
class SerializedValue;
class StringValue;
class UberDispatcher;
class Value;

} // namespace node
} // namespace inspector
} // namespace protocol

#endif // !defined(node_inspector_protocol_Forward_h)


// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef node_inspector_protocol_Allocator_h
#define node_inspector_protocol_Allocator_h

namespace node {
namespace inspector {
namespace protocol {

enum NotNullTagEnum { NotNullLiteral };

#define PROTOCOL_DISALLOW_NEW() \
private: \
void* operator new(size_t) = delete; \
void* operator new(size_t, NotNullTagEnum, void*) = delete; \
void* operator new(size_t, void*) = delete; \
public:

#define PROTOCOL_DISALLOW_COPY(ClassName) \
private: \
ClassName(const ClassName&) = delete; \
ClassName& operator=(const ClassName&) = delete

} // namespace node
} // namespace inspector
} // namespace protocol

#endif // !defined(node_inspector_protocol_Allocator_h)


// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef node_inspector_protocol_FrontendChannel_h
#define node_inspector_protocol_FrontendChannel_h

namespace node {
namespace inspector {
namespace protocol {

class Serializable {
public:
virtual String serialize() = 0;
virtual ~Serializable() = default;
};

class FrontendChannel {
public:
virtual ~FrontendChannel() { }
virtual void sendProtocolResponse(int callId, std::unique_ptr<Serializable> message) = 0;
virtual void sendProtocolNotification(std::unique_ptr<Serializable> message) = 0;
virtual void flushProtocolNotifications() = 0;
};

} // namespace node
} // namespace inspector
} // namespace protocol

#endif // !defined(node_inspector_protocol_FrontendChannel_h)
Loading

0 comments on commit 4de9f99

Please sign in to comment.