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

Side by Side Diff: third_party/WebKit/Source/wtf/text/WTFString.h

Issue 2655853003: Replace StringImpl::empty{16Bit}() with a static member (Closed)
Patch Set: annotate race Created 3 years, 10 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 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
4 * All rights reserved. 4 * All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 // Construct a string referencing an existing StringImpl. 98 // Construct a string referencing an existing StringImpl.
99 String(StringImpl* impl) : m_impl(impl) {} 99 String(StringImpl* impl) : m_impl(impl) {}
100 String(PassRefPtr<StringImpl> impl) : m_impl(impl) {} 100 String(PassRefPtr<StringImpl> impl) : m_impl(impl) {}
101 101
102 void swap(String& o) { m_impl.swap(o.m_impl); } 102 void swap(String& o) { m_impl.swap(o.m_impl); }
103 103
104 template <typename CharType> 104 template <typename CharType>
105 static String adopt(StringBuffer<CharType>& buffer) { 105 static String adopt(StringBuffer<CharType>& buffer) {
106 if (!buffer.length()) 106 if (!buffer.length())
107 return StringImpl::empty(); 107 return StringImpl::empty;
108 return String(buffer.release()); 108 return String(buffer.release());
109 } 109 }
110 110
111 explicit operator bool() const { return !isNull(); } 111 explicit operator bool() const { return !isNull(); }
112 bool isNull() const { return !m_impl; } 112 bool isNull() const { return !m_impl; }
113 bool isEmpty() const { return !m_impl || !m_impl->length(); } 113 bool isEmpty() const { return !m_impl || !m_impl->length(); }
114 114
115 StringImpl* impl() const { return m_impl.get(); } 115 StringImpl* impl() const { return m_impl.get(); }
116 PassRefPtr<StringImpl> releaseImpl() { return m_impl.release(); } 116 PassRefPtr<StringImpl> releaseImpl() { return m_impl.release(); }
117 117
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 482
483 inline void swap(String& a, String& b) { 483 inline void swap(String& a, String& b) {
484 a.swap(b); 484 a.swap(b);
485 } 485 }
486 486
487 // Definitions of string operations 487 // Definitions of string operations
488 488
489 template <size_t inlineCapacity> 489 template <size_t inlineCapacity>
490 String::String(const Vector<UChar, inlineCapacity>& vector) 490 String::String(const Vector<UChar, inlineCapacity>& vector)
491 : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) 491 : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size())
492 : StringImpl::empty()) {} 492 : StringImpl::empty) {}
493 493
494 template <> 494 template <>
495 inline const LChar* String::getCharacters<LChar>() const { 495 inline const LChar* String::getCharacters<LChar>() const {
496 DCHECK(is8Bit()); 496 DCHECK(is8Bit());
497 return characters8(); 497 return characters8();
498 } 498 }
499 499
500 template <> 500 template <>
501 inline const UChar* String::getCharacters<UChar>() const { 501 inline const UChar* String::getCharacters<UChar>() const {
502 DCHECK(!is8Bit()); 502 DCHECK(!is8Bit());
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 using WTF::String; 593 using WTF::String;
594 using WTF::emptyString; 594 using WTF::emptyString;
595 using WTF::emptyString16Bit; 595 using WTF::emptyString16Bit;
596 using WTF::charactersAreAllASCII; 596 using WTF::charactersAreAllASCII;
597 using WTF::equal; 597 using WTF::equal;
598 using WTF::find; 598 using WTF::find;
599 using WTF::isSpaceOrNewline; 599 using WTF::isSpaceOrNewline;
600 600
601 #include "wtf/text/AtomicString.h" 601 #include "wtf/text/AtomicString.h"
602 #endif // WTFString_h 602 #endif // WTFString_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringView.h ('k') | third_party/WebKit/Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698