• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_TORQUE_LS_MESSAGE_HANDLER_H_
6 #define V8_TORQUE_LS_MESSAGE_HANDLER_H_
7 
8 #include "src/base/macros.h"
9 #include "src/torque/ls/json.h"
10 #include "src/torque/source-positions.h"
11 #include "src/torque/torque-compiler.h"
12 
13 namespace v8 {
14 namespace internal {
15 namespace torque {
16 
17 // A list of source Ids for which the LS provided diagnostic information
18 // after the last compile. The LS is responsible for syncing diagnostic
19 // information with the client. Before updated information can be sent,
20 // old diagnostic messages have to be reset.
21 DECLARE_CONTEXTUAL_VARIABLE(DiagnosticsFiles, std::vector<SourceId>);
22 
23 namespace ls {
24 
25 // The message handler might send responses or follow up requests.
26 // To allow unit testing, the "sending" function is configurable.
27 using MessageWriter = std::function<void(JsonValue)>;
28 
29 V8_EXPORT_PRIVATE void HandleMessage(JsonValue raw_message, MessageWriter);
30 
31 // Called when a compilation run finishes. Exposed for testability.
32 V8_EXPORT_PRIVATE void CompilationFinished(TorqueCompilerResult result,
33                                            MessageWriter);
34 
35 }  // namespace ls
36 }  // namespace torque
37 }  // namespace internal
38 }  // namespace v8
39 
40 #endif  // V8_TORQUE_LS_MESSAGE_HANDLER_H_
41