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

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

Issue 2658703005: Make WTFString constructor that takes const char* call strlen inline (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Construct a string with UTF-16 data, from a null-terminated source. 83 // Construct a string with UTF-16 data, from a null-terminated source.
84 String(const UChar*); 84 String(const UChar*);
85 String(const char16_t* chars) 85 String(const char16_t* chars)
86 : String(reinterpret_cast<const UChar*>(chars)) {} 86 : String(reinterpret_cast<const UChar*>(chars)) {}
87 87
88 // Construct a string with latin1 data. 88 // Construct a string with latin1 data.
89 String(const LChar* characters, unsigned length); 89 String(const LChar* characters, unsigned length);
90 String(const char* characters, unsigned length); 90 String(const char* characters, unsigned length);
91 91
92 // Construct a string with latin1 data, from a null-terminated source. 92 // Construct a string with latin1 data, from a null-terminated source.
93 String(const LChar* characters); 93 String(const LChar* characters)
94 String(const char* characters); 94 : String(characters,
esprehn 2017/01/27 09:25:51 Delegate to the other constructor. : String(reint
kinuko 2017/01/27 12:52:24 Good idea, done.
95 characters ? strlen(reinterpret_cast<const char*>(characters))
96 : 0) {}
97 String(const char* characters)
98 : String(characters, characters ? strlen(characters) : 0) {}
95 99
96 // Construct a string referencing an existing StringImpl. 100 // Construct a string referencing an existing StringImpl.
97 String(StringImpl* impl) : m_impl(impl) {} 101 String(StringImpl* impl) : m_impl(impl) {}
98 String(PassRefPtr<StringImpl> impl) : m_impl(impl) {} 102 String(PassRefPtr<StringImpl> impl) : m_impl(impl) {}
99 103
100 void swap(String& o) { m_impl.swap(o.m_impl); } 104 void swap(String& o) { m_impl.swap(o.m_impl); }
101 105
102 template <typename CharType> 106 template <typename CharType>
103 static String adopt(StringBuffer<CharType>& buffer) { 107 static String adopt(StringBuffer<CharType>& buffer) {
104 if (!buffer.length()) 108 if (!buffer.length())
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 using WTF::String; 595 using WTF::String;
592 using WTF::emptyString; 596 using WTF::emptyString;
593 using WTF::emptyString16Bit; 597 using WTF::emptyString16Bit;
594 using WTF::charactersAreAllASCII; 598 using WTF::charactersAreAllASCII;
595 using WTF::equal; 599 using WTF::equal;
596 using WTF::find; 600 using WTF::find;
597 using WTF::isSpaceOrNewline; 601 using WTF::isSpaceOrNewline;
598 602
599 #include "wtf/text/AtomicString.h" 603 #include "wtf/text/AtomicString.h"
600 #endif // WTFString_h 604 #endif // WTFString_h
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/wtf/text/WTFString.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698