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

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

Issue 2516123002: Out-of-line WTF::String's destructor. (Closed)
Patch Set: Created 4 years, 1 month 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, 2010, 2012 Apple Inc. All rights 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights
4 * reserved. 4 * reserved.
5 * Copyright (C) 2007-2009 Torch Mobile, Inc. 5 * Copyright (C) 2007-2009 Torch Mobile, Inc.
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 // Construct a string with latin1 data, from a null-terminated source. 65 // Construct a string with latin1 data, from a null-terminated source.
66 String::String(const LChar* characters) 66 String::String(const LChar* characters)
67 : m_impl(characters ? StringImpl::create(characters) : nullptr) {} 67 : m_impl(characters ? StringImpl::create(characters) : nullptr) {}
68 68
69 String::String(const char* characters) 69 String::String(const char* characters)
70 : m_impl(characters ? StringImpl::create( 70 : m_impl(characters ? StringImpl::create(
71 reinterpret_cast<const LChar*>(characters)) 71 reinterpret_cast<const LChar*>(characters))
72 : nullptr) {} 72 : nullptr) {}
73 73
74 String::~String() {}
75
74 void String::append(const StringView& string) { 76 void String::append(const StringView& string) {
75 if (string.isEmpty()) 77 if (string.isEmpty())
76 return; 78 return;
77 if (!m_impl) { 79 if (!m_impl) {
78 m_impl = string.toString().releaseImpl(); 80 m_impl = string.toString().releaseImpl();
79 return; 81 return;
80 } 82 }
81 83
82 // FIXME: This is extremely inefficient. So much so that we might want to 84 // FIXME: This is extremely inefficient. So much so that we might want to
83 // take this out of String's API. We can make it better by optimizing the 85 // take this out of String's API. We can make it better by optimizing the
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 } 846 }
845 buffer.append('\0'); 847 buffer.append('\0');
846 return buffer; 848 return buffer;
847 } 849 }
848 850
849 Vector<char> asciiDebug(String& string) { 851 Vector<char> asciiDebug(String& string) {
850 return asciiDebug(string.impl()); 852 return asciiDebug(string.impl());
851 } 853 }
852 854
853 #endif 855 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698