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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/public/StringView.h

Issue 2260233002: [DevTools] Migrate v8_inspector/public from String16 to String{View,Buffer}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: styling 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
(Empty)
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
3 // found in the LICENSE file.
4
5 // Note: this include guard is very specific to not clash with wtf. Will be chan ged after moving out of blink.
6 #ifndef v8_inspector_public_StringView_h
7 #define v8_inspector_public_StringView_h
8
9 #include "platform/PlatformExport.h"
10
11 #include <cctype>
12 #include <stdint.h>
13
14 namespace v8_inspector {
15
16 class PLATFORM_EXPORT StringView {
17 public:
18 StringView()
19 : m_is8Bit(true)
20 , m_length(0)
21 , m_characters8(nullptr) {}
22
23 StringView(const uint8_t* characters, unsigned length)
24 : m_is8Bit(true)
25 , m_length(length)
26 , m_characters8(characters) {}
27
28 StringView(const uint16_t* characters, unsigned length)
29 : m_is8Bit(false)
30 , m_length(length)
31 , m_characters16(characters) {}
32
33 bool is8Bit() const { return m_is8Bit; }
34 unsigned length() const { return m_length; }
35
36 // TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be use d here.
37 const uint8_t* characters8() const { return m_characters8; }
38 const uint16_t* characters16() const { return m_characters16; }
39
40 private:
41 bool m_is8Bit;
42 unsigned m_length;
43 union {
44 const uint8_t* m_characters8;
45 const uint16_t* m_characters16;
46 };
47 };
48
49 } // namespace v8_inspector
50
51 #endif // v8_inspector_public_StringView_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698