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

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

Issue 178803006: Turn MQ classes into thread safe (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved string comparison optimization to StringImpl Created 6 years, 9 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 | « Source/core/html/parser/HTMLParserIdioms.cpp ('k') | no next file » | 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 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) 4 * (C) 2001 Dirk Mueller ( mueller@kde.org )
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights reserved. 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All r ights reserved.
6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) 6 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net)
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 1927
1928 return equal(a->characters16(), b->characters16(), aLength); 1928 return equal(a->characters16(), b->characters16(), aLength);
1929 } 1929 }
1930 1930
1931 bool equal(const StringImpl* a, const StringImpl* b) 1931 bool equal(const StringImpl* a, const StringImpl* b)
1932 { 1932 {
1933 if (a == b) 1933 if (a == b)
1934 return true; 1934 return true;
1935 if (!a || !b) 1935 if (!a || !b)
1936 return false; 1936 return false;
1937 if (a->isAtomic() && b->isAtomic())
1938 return false;
abarth-chromium 2014/03/06 18:52:05 Can we land this change separately? This code is c
1937 1939
1938 return stringImplContentEqual(a, b); 1940 return stringImplContentEqual(a, b);
1939 } 1941 }
1940 1942
1941 template <typename CharType> 1943 template <typename CharType>
1942 inline bool equalInternal(const StringImpl* a, const CharType* b, unsigned lengt h) 1944 inline bool equalInternal(const StringImpl* a, const CharType* b, unsigned lengt h)
1943 { 1945 {
1944 if (!a) 1946 if (!a)
1945 return !b; 1947 return !b;
1946 if (!b) 1948 if (!b)
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 2107
2106 size_t StringImpl::sizeInBytes() const 2108 size_t StringImpl::sizeInBytes() const
2107 { 2109 {
2108 size_t size = length(); 2110 size_t size = length();
2109 if (!is8Bit()) 2111 if (!is8Bit())
2110 size *= 2; 2112 size *= 2;
2111 return size + sizeof(*this); 2113 return size + sizeof(*this);
2112 } 2114 }
2113 2115
2114 } // namespace WTF 2116 } // namespace WTF
OLDNEW
« no previous file with comments | « Source/core/html/parser/HTMLParserIdioms.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698