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

Unified Diff: third_party/WebKit/Source/wtf/text/StringView.cpp

Issue 2025503002: Revert of Expand WTF::StringView's API to be more like StringPiece. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/wtf/text/StringView.cpp
diff --git a/third_party/WebKit/Source/wtf/text/StringView.cpp b/third_party/WebKit/Source/wtf/text/StringView.cpp
deleted file mode 100644
index 126272933a3b934b1baa4841b2dff01e73bcdddd..0000000000000000000000000000000000000000
--- a/third_party/WebKit/Source/wtf/text/StringView.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "wtf/text/StringView.h"
-
-namespace WTF {
-
-StringView::StringView(const UChar* chars, unsigned length)
- : m_length(length)
- , m_is8Bit(false)
-{
- SECURITY_DCHECK(!chars || length <= lengthOfNullTerminatedString(chars));
- m_data.characters16 = chars;
-}
-
-StringView::StringView(const UChar* chars)
- : StringView(chars, chars ? lengthOfNullTerminatedString(chars) : 0) {}
-
-#if DCHECK_IS_ON()
-StringView::~StringView()
-{
- // StringView does not own the StringImpl, we must not be the last ref.
- DCHECK(!m_impl || !m_impl->hasOneRef());
-}
-#endif
-
-String StringView::toString() const
-{
- if (isNull())
- return String();
- if (isEmpty())
- return emptyString();
- if (is8Bit())
- return String(m_data.characters8, m_length);
- return String(m_data.characters16, m_length);
-}
-
-bool equalStringView(const StringView& a, const StringView& b)
-{
- if (a.length() != b.length())
- return false;
- if (a.isEmpty() || b.isEmpty())
- return a.isEmpty() == b.isEmpty();
- if (a.is8Bit()) {
- if (b.is8Bit())
- return equal(a.characters8(), b.characters8(), a.length());
- return equal(a.characters8(), b.characters16(), a.length());
- }
- if (b.is8Bit())
- return equal(a.characters16(), b.characters8(), a.length());
- return equal(a.characters16(), b.characters16(), a.length());
-}
-
-} // namespace WTF
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringView.h ('k') | third_party/WebKit/Source/wtf/text/StringViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698