11cb0ef41Sopenharmony_ci// Copyright 2019 the V8 project authors. All rights reserved. 21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be 31cb0ef41Sopenharmony_ci// found in the LICENSE file. 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#ifndef V8_TORQUE_LS_MESSAGE_HANDLER_H_ 61cb0ef41Sopenharmony_ci#define V8_TORQUE_LS_MESSAGE_HANDLER_H_ 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci#include "src/base/macros.h" 91cb0ef41Sopenharmony_ci#include "src/torque/ls/json.h" 101cb0ef41Sopenharmony_ci#include "src/torque/source-positions.h" 111cb0ef41Sopenharmony_ci#include "src/torque/torque-compiler.h" 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_cinamespace v8 { 141cb0ef41Sopenharmony_cinamespace internal { 151cb0ef41Sopenharmony_cinamespace torque { 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci// A list of source Ids for which the LS provided diagnostic information 181cb0ef41Sopenharmony_ci// after the last compile. The LS is responsible for syncing diagnostic 191cb0ef41Sopenharmony_ci// information with the client. Before updated information can be sent, 201cb0ef41Sopenharmony_ci// old diagnostic messages have to be reset. 211cb0ef41Sopenharmony_ciDECLARE_CONTEXTUAL_VARIABLE(DiagnosticsFiles, std::vector<SourceId>); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_cinamespace ls { 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ci// The message handler might send responses or follow up requests. 261cb0ef41Sopenharmony_ci// To allow unit testing, the "sending" function is configurable. 271cb0ef41Sopenharmony_ciusing MessageWriter = std::function<void(JsonValue)>; 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void HandleMessage(JsonValue raw_message, MessageWriter); 301cb0ef41Sopenharmony_ci 311cb0ef41Sopenharmony_ci// Called when a compilation run finishes. Exposed for testability. 321cb0ef41Sopenharmony_ciV8_EXPORT_PRIVATE void CompilationFinished(TorqueCompilerResult result, 331cb0ef41Sopenharmony_ci MessageWriter); 341cb0ef41Sopenharmony_ci 351cb0ef41Sopenharmony_ci} // namespace ls 361cb0ef41Sopenharmony_ci} // namespace torque 371cb0ef41Sopenharmony_ci} // namespace internal 381cb0ef41Sopenharmony_ci} // namespace v8 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci#endif // V8_TORQUE_LS_MESSAGE_HANDLER_H_ 41