Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: src/inspector/StringUtil.h

Issue 2300823002: Revert of [inspector] Initial import of v8_inspector. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/inspector/String16.cpp ('k') | src/inspector/StringUtil.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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_STRINGUTIL_H_
6 #define V8_INSPECTOR_STRINGUTIL_H_
7
8 #include "src/inspector/Allocator.h"
9 #include "src/inspector/String16.h"
10 #include "src/inspector/public/StringBuffer.h"
11 #include "src/inspector/public/StringView.h"
12
13 #include <v8.h>
14
15 namespace v8_inspector {
16
17 namespace protocol {
18
19 class Value;
20
21 using String = v8_inspector::String16;
22 using StringBuilder = v8_inspector::String16Builder;
23
24 class StringUtil {
25 public:
26 static String substring(const String& s, unsigned pos, unsigned len) { retur n s.substring(pos, len); }
27 static String fromInteger(int number) { return String::fromInteger(number); }
28 static String fromDouble(double number) { return String::fromDouble(number); }
29 static const size_t kNotFound = String::kNotFound;
30 static void builderReserve(StringBuilder& builder, unsigned capacity) { buil der.reserveCapacity(capacity); }
31 };
32
33 std::unique_ptr<protocol::Value> parseJSON(const StringView& json);
34 std::unique_ptr<protocol::Value> parseJSON(const String16& json);
35
36 } // namespace protocol
37
38 std::unique_ptr<protocol::Value> toProtocolValue(v8::Local<v8::Context>, v8::Loc al<v8::Value>, int maxDepth = 1000);
39
40 v8::Local<v8::String> toV8String(v8::Isolate*, const String16&);
41 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const String16&);
42 v8::Local<v8::String> toV8StringInternalized(v8::Isolate*, const char*);
43 v8::Local<v8::String> toV8String(v8::Isolate*, const StringView&);
44 // TODO(dgozman): rename to toString16.
45 String16 toProtocolString(v8::Local<v8::String>);
46 String16 toProtocolStringWithTypeCheck(v8::Local<v8::Value>);
47 String16 toString16(const StringView&);
48 StringView toStringView(const String16&);
49 bool stringViewStartsWith(const StringView&, const char*);
50
51 class StringBufferImpl : public StringBuffer {
52 V8_INSPECTOR_DISALLOW_COPY(StringBufferImpl);
53 public:
54 // Destroys string's content.
55 static std::unique_ptr<StringBufferImpl> adopt(String16&);
56 const StringView& string() override { return m_string; }
57
58 private:
59 explicit StringBufferImpl(String16&);
60 String16 m_owner;
61 StringView m_string;
62 };
63
64 } // namespace v8_inspector
65
66
67 #endif // V8_INSPECTOR_STRINGUTIL_H_
OLDNEW
« no previous file with comments | « src/inspector/String16.cpp ('k') | src/inspector/StringUtil.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698