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

Side by Side Diff: Source/wtf/text/WTFString.cpp

Issue 21274008: Remove ASCIILiteral optimization from StringImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « Source/wtf/text/WTFString.h ('k') | Source/wtf/wtf.gypi » ('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, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2007-2009 Torch Mobile, Inc.
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 String::String(const LChar* characters) 72 String::String(const LChar* characters)
73 : m_impl(characters ? StringImpl::create(characters) : 0) 73 : m_impl(characters ? StringImpl::create(characters) : 0)
74 { 74 {
75 } 75 }
76 76
77 String::String(const char* characters) 77 String::String(const char* characters)
78 : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(char acters)) : 0) 78 : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(char acters)) : 0)
79 { 79 {
80 } 80 }
81 81
82 String::String(ASCIILiteral characters)
83 : m_impl(StringImpl::createFromLiteral(characters))
84 {
85 }
86
87 void String::append(const String& string) 82 void String::append(const String& string)
88 { 83 {
89 if (string.isEmpty()) 84 if (string.isEmpty())
90 return; 85 return;
91 if (!m_impl) { 86 if (!m_impl) {
92 m_impl = string.m_impl; 87 m_impl = string.m_impl;
93 return; 88 return;
94 } 89 }
95 90
96 // FIXME: This is extremely inefficient. So much so that we might want to ta ke this 91 // FIXME: This is extremely inefficient. So much so that we might want to ta ke this
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 buffer.append('\0'); 1252 buffer.append('\0');
1258 return buffer; 1253 return buffer;
1259 } 1254 }
1260 1255
1261 Vector<char> asciiDebug(String& string) 1256 Vector<char> asciiDebug(String& string)
1262 { 1257 {
1263 return asciiDebug(string.impl()); 1258 return asciiDebug(string.impl());
1264 } 1259 }
1265 1260
1266 #endif 1261 #endif
OLDNEW
« no previous file with comments | « Source/wtf/text/WTFString.h ('k') | Source/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698