1// Copyright 2015 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_INSPECTOR_REMOTE_OBJECT_ID_H_ 6#define V8_INSPECTOR_REMOTE_OBJECT_ID_H_ 7 8#include <memory> 9 10#include "src/inspector/protocol/Forward.h" 11 12namespace v8_inspector { 13 14using protocol::Response; 15 16class RemoteObjectIdBase { 17 public: 18 uint64_t isolateId() const { return m_isolateId; } 19 int contextId() const { return m_injectedScriptId; } 20 21 protected: 22 RemoteObjectIdBase(); 23 ~RemoteObjectIdBase() = default; 24 25 bool parseId(const String16&); 26 27 uint64_t m_isolateId; 28 int m_injectedScriptId; 29 int m_id; 30}; 31 32class RemoteObjectId final : public RemoteObjectIdBase { 33 public: 34 static Response parse(const String16&, std::unique_ptr<RemoteObjectId>*); 35 ~RemoteObjectId() = default; 36 int id() const { return m_id; } 37 38 static String16 serialize(uint64_t isolateId, int injectedScriptId, int id); 39}; 40 41class RemoteCallFrameId final : public RemoteObjectIdBase { 42 public: 43 static Response parse(const String16&, std::unique_ptr<RemoteCallFrameId>*); 44 ~RemoteCallFrameId() = default; 45 46 int frameOrdinal() const { return m_id; } 47 48 static String16 serialize(uint64_t isolateId, int injectedScriptId, 49 int frameOrdinal); 50}; 51 52} // namespace v8_inspector 53 54#endif // V8_INSPECTOR_REMOTE_OBJECT_ID_H_ 55