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

Side by Side Diff: third_party/WebKit/Source/core/inspector/V8InspectorString.h

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8InspectorString_h 5 #ifndef V8InspectorString_h
6 #define V8InspectorString_h 6 #define V8InspectorString_h
7 7
8 #include "core/CoreExport.h" 8 #include "core/CoreExport.h"
9 #include "platform/Decimal.h"
9 #include "platform/v8_inspector/public/StringBuffer.h" 10 #include "platform/v8_inspector/public/StringBuffer.h"
10 #include "platform/v8_inspector/public/StringView.h" 11 #include "platform/v8_inspector/public/StringView.h"
12 #include "wtf/Allocator.h"
13 #include "wtf/text/StringBuilder.h"
14 #include "wtf/text/StringHash.h"
11 #include "wtf/text/StringView.h" 15 #include "wtf/text/StringView.h"
12 #include "wtf/text/WTFString.h" 16 #include "wtf/text/WTFString.h"
13 17
14 #include <memory> 18 #include <memory>
15 19
16 namespace blink { 20 namespace blink {
17 21
18 // Note that passed string must outlive the resulting StringView. This implies i t must not be a temporary object. 22 // Note that passed string must outlive the resulting StringView. This implies i t must not be a temporary object.
19 CORE_EXPORT v8_inspector::StringView toV8InspectorStringView(const StringView&); 23 CORE_EXPORT v8_inspector::StringView toV8InspectorStringView(const StringView&);
20 CORE_EXPORT std::unique_ptr<v8_inspector::StringBuffer> toV8InspectorStringBuffe r(const StringView&); 24 CORE_EXPORT std::unique_ptr<v8_inspector::StringBuffer> toV8InspectorStringBuffe r(const StringView&);
21 CORE_EXPORT String toCoreString(const v8_inspector::StringView&); 25 CORE_EXPORT String toCoreString(const v8_inspector::StringView&);
22 CORE_EXPORT String toCoreString(std::unique_ptr<v8_inspector::StringBuffer>); 26 CORE_EXPORT String toCoreString(std::unique_ptr<v8_inspector::StringBuffer>);
23 27
28 namespace protocol {
29
30 class Value;
31
32 using String = WTF::String;
33 using StringBuilder = WTF::StringBuilder;
34
35 class CORE_EXPORT StringUtil {
36 STATIC_ONLY(StringUtil);
37 public:
38 static String substring(const String& s, unsigned pos, unsigned len) { retur n s.substring(pos, len); }
39 static String fromInteger(int number) { return String::number(number); }
40 static String fromDouble(double number) { return Decimal::fromDouble(number) .toString(); }
41 static const size_t kNotFound = WTF::kNotFound;
42 static void builderReserve(StringBuilder& builder, unsigned capacity) { buil der.reserveCapacity(capacity); }
43 };
44
45 CORE_EXPORT std::unique_ptr<protocol::Value> parseJSON(const String&);
46
47 } // namespace protocol
48
24 } // namespace blink 49 } // namespace blink
25 50
51 // TODO(dgozman): migrate core/inspector/protocol to wtf::HashMap.
52 namespace std {
53 template<> struct hash<WTF::String> {
54 std::size_t operator()(const WTF::String& string) const
55 {
56 return StringHash::hash(string);
57 }
58 };
59 } // namespace std
60
26 #endif // V8InspectorString_h 61 #endif // V8InspectorString_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698