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

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

Issue 587173005: Add WTF::String::emptyString16Bit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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/wtf/text/StringImpl.h ('k') | Source/wtf/text/WTFString.h » ('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 * Copyright (C) 2010 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2010 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 19 matching lines...) Expand all
30 #include "StringImpl.h" 30 #include "StringImpl.h"
31 #include "wtf/DynamicAnnotations.h" 31 #include "wtf/DynamicAnnotations.h"
32 #include "wtf/MainThread.h" 32 #include "wtf/MainThread.h"
33 #include "wtf/StaticConstructors.h" 33 #include "wtf/StaticConstructors.h"
34 34
35 namespace WTF { 35 namespace WTF {
36 36
37 StringImpl* StringImpl::empty() 37 StringImpl* StringImpl::empty()
38 { 38 {
39 DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString)); 39 DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString));
40 WTF_ANNOTATE_BENIGN_RACE(&emptyString, "Benign race on StringImpl::emptyStri ng reference counter"); 40 WTF_ANNOTATE_BENIGN_RACE(&emptyString,
41 "Benign race on the reference counter of a static string created by Stri ngImpl::empty");
41 return &emptyString; 42 return &emptyString;
42 } 43 }
43 44
45 StringImpl* StringImpl::empty16Bit()
46 {
47 DEFINE_STATIC_LOCAL(StringImpl, emptyString, (ConstructEmptyString16Bit));
48 WTF_ANNOTATE_BENIGN_RACE(&emptyString,
49 "Benign race on the reference counter of a static string created by Stri ngImpl::empty16Bit");
50 return &emptyString;
51 }
52
44 WTF_EXPORT DEFINE_GLOBAL(AtomicString, nullAtom) 53 WTF_EXPORT DEFINE_GLOBAL(AtomicString, nullAtom)
45 WTF_EXPORT DEFINE_GLOBAL(AtomicString, emptyAtom) 54 WTF_EXPORT DEFINE_GLOBAL(AtomicString, emptyAtom)
46 WTF_EXPORT DEFINE_GLOBAL(AtomicString, starAtom) 55 WTF_EXPORT DEFINE_GLOBAL(AtomicString, starAtom)
47 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlAtom) 56 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlAtom)
48 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlnsAtom) 57 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xmlnsAtom)
49 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xlinkAtom) 58 WTF_EXPORT DEFINE_GLOBAL(AtomicString, xlinkAtom)
50 59
51 // This is not an AtomicString because it is unlikely to be used as an 60 // This is not an AtomicString because it is unlikely to be used as an
52 // event/element/attribute name, so it shouldn't pollute the AtomicString hash 61 // event/element/attribute name, so it shouldn't pollute the AtomicString hash
53 // table. 62 // table.
(...skipping 22 matching lines...) Expand all
76 85
77 // FIXME: These should be allocated at compile time. 86 // FIXME: These should be allocated at compile time.
78 new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFro mLiteral); 87 new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFro mLiteral);
79 new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFr omLiteral); 88 new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFr omLiteral);
80 new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::Constru ctFromLiteral); 89 new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::Constru ctFromLiteral);
81 new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::Constru ctFromLiteral); 90 new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::Constru ctFromLiteral);
82 new (NotNull, (void*)&xmlnsWithColon) String("xmlns:"); 91 new (NotNull, (void*)&xmlnsWithColon) String("xmlns:");
83 } 92 }
84 93
85 } 94 }
OLDNEW
« no previous file with comments | « Source/wtf/text/StringImpl.h ('k') | Source/wtf/text/WTFString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698