v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8-debugger-id.cc
Go to the documentation of this file.
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
6
10
11namespace v8_inspector {
12
13V8DebuggerId::V8DebuggerId(std::pair<int64_t, int64_t> pair)
14 : m_first(pair.first), m_second(pair.second) {}
15
16std::unique_ptr<StringBuffer> V8DebuggerId::toString() const {
19}
20
21bool V8DebuggerId::isValid() const { return m_first || m_second; }
22
23std::pair<int64_t, int64_t> V8DebuggerId::pair() const {
24 return std::make_pair(m_first, m_second);
25}
26
27namespace internal {
28
29V8DebuggerId::V8DebuggerId(std::pair<int64_t, int64_t> pair)
30 : m_debugger_id(pair) {}
31
32// static
34 return V8DebuggerId(std::make_pair(inspector->generateUniqueId(),
35 inspector->generateUniqueId()));
36}
37
39 const UChar dot = '.';
40 size_t pos = debuggerId.find(dot);
41 if (pos == String16::kNotFound) return;
42 bool ok = false;
43 int64_t first = debuggerId.substring(0, pos).toInteger64(&ok);
44 if (!ok) return;
45 int64_t second = debuggerId.substring(pos + 1).toInteger64(&ok);
46 if (!ok) return;
47 m_debugger_id = v8_inspector::V8DebuggerId(std::make_pair(first, second));
48}
49
51 return toString16(m_debugger_id.toString()->string());
52}
53
55
56std::pair<int64_t, int64_t> V8DebuggerId::pair() const {
57 return m_debugger_id.pair();
58}
59
60} // namespace internal
61} // namespace v8_inspector
SourcePosition pos
String16 substring(size_t pos, size_t len=UINT_MAX) const
Definition string-16.h:61
static String16 fromInteger64(int64_t)
Definition string-16.cc:91
int64_t toInteger64(bool *ok=nullptr) const
Definition string-16.cc:114
size_t find(const String16 &str, size_t start=0) const
Definition string-16.h:64
static const size_t kNotFound
Definition string-16.h:26
std::unique_ptr< StringBuffer > toString() const
std::pair< int64_t, int64_t > pair() const
friend class internal::V8DebuggerId
v8_inspector::V8DebuggerId m_debugger_id
static V8DebuggerId generate(V8InspectorImpl *)
std::pair< int64_t, int64_t > pair() const
double second
char16_t UChar
Definition string-16.h:22
std::unique_ptr< StringBuffer > StringBufferFrom(String16 str)
String16 toString16(const StringView &string)