1// Copyright 2020 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_TOOLS_V8WINDBG_SRC_LOCAL_VARIABLES_H_
6#define V8_TOOLS_V8WINDBG_SRC_LOCAL_VARIABLES_H_
7
8#include <comutil.h>
9#include <wrl/implements.h>
10
11#include "tools/v8windbg/base/dbgext.h"
12
13// An implementation of the property accessor for the "LocalVariables" or
14// "Parameters" property on Debugger.Models.StackFrame. This allows us to modify
15// the variables shown in each frame.
16class V8LocalVariables
17    : public WRL::RuntimeClass<
18          WRL::RuntimeClassFlags<WRL::RuntimeClassType::ClassicCom>,
19          IModelPropertyAccessor> {
20 public:
21  V8LocalVariables(WRL::ComPtr<IModelPropertyAccessor> original,
22                   bool is_parameters);
23  ~V8LocalVariables() override;
24
25  IFACEMETHOD(GetValue)
26  (PCWSTR key, IModelObject* context, IModelObject** value);
27  IFACEMETHOD(SetValue)(PCWSTR key, IModelObject* context, IModelObject* value);
28
29 private:
30  // The built-in accessor which we are overriding.
31  WRL::ComPtr<IModelPropertyAccessor> original_;
32  // Whether this is for Parameters rather than LocalVariables.
33  bool is_parameters_;
34};
35
36#endif  // V8_TOOLS_V8WINDBG_SRC_LOCAL_VARIABLES_H_
37