summaryrefslogtreecommitdiff
path: root/deps/v8/src/inspector/remote-object-id.h
blob: b199032359e88cca9f5d4712e439854d625b16b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Copyright 2015 the V8 project 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 V8_INSPECTOR_REMOTE_OBJECT_ID_H_
#define V8_INSPECTOR_REMOTE_OBJECT_ID_H_

#include "src/inspector/protocol/Forward.h"

namespace v8_inspector {

using protocol::Response;

class RemoteObjectIdBase {
 public:
  int contextId() const { return m_injectedScriptId; }

 protected:
  RemoteObjectIdBase();
  ~RemoteObjectIdBase() = default;

  std::unique_ptr<protocol::DictionaryValue> parseInjectedScriptId(
      const String16&);

  int m_injectedScriptId;
};

class RemoteObjectId final : public RemoteObjectIdBase {
 public:
  static Response parse(const String16&, std::unique_ptr<RemoteObjectId>*);
  ~RemoteObjectId() = default;
  int id() const { return m_id; }

 private:
  RemoteObjectId();

  int m_id;
};

class RemoteCallFrameId final : public RemoteObjectIdBase {
 public:
  static Response parse(const String16&, std::unique_ptr<RemoteCallFrameId>*);
  ~RemoteCallFrameId() = default;

  int frameOrdinal() const { return m_frameOrdinal; }

  static String16 serialize(int injectedScriptId, int frameOrdinal);

 private:
  RemoteCallFrameId();

  int m_frameOrdinal;
};

}  // namespace v8_inspector

#endif  // V8_INSPECTOR_REMOTE_OBJECT_ID_H_