Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google, Inc. All Rights Reserved. | 2 * Copyright (C) 2013 Google, 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 49 if (m_string.impl()) | 49 if (m_string.impl()) |
| 50 return; | 50 return; |
| 51 if (width == Likely8Bit) | 51 if (width == Likely8Bit) |
| 52 m_string = StringImpl::create8BitIfPossible(vector); | 52 m_string = StringImpl::create8BitIfPossible(vector); |
| 53 else if (width == Force8Bit) | 53 else if (width == Force8Bit) |
| 54 m_string = String::make8BitFrom16BitSource(vector); | 54 m_string = String::make8BitFrom16BitSource(vector); |
| 55 else | 55 else |
| 56 m_string = String(vector); | 56 m_string = String(vector); |
| 57 } | 57 } |
| 58 | 58 |
| 59 HTMLIdentifier(const AtomicString& str, CharacterWidth width) | |
|
abarth-chromium
2013/11/27 18:18:08
str -> string
Please use complete works in variab
oystein (OOO til 10th of July)
2013/11/27 18:46:33
Done.
| |
| 60 : m_string(findIfKnown(str.characters16(), str.length())) | |
|
abarth-chromium
2013/11/27 18:18:08
How do you know it's safe to call characters16? W
oystein (OOO til 10th of July)
2013/11/27 18:46:33
This is only ever used by the QualifiedName -> HTM
| |
| 61 { | |
| 62 if (m_string.impl()) | |
| 63 return; | |
| 64 if (width == Likely8Bit) | |
| 65 m_string = StringImpl::create8BitIfPossible(str.characters16(), str. length()); | |
| 66 else if (width == Force8Bit) | |
| 67 m_string = String::make8BitFrom16BitSource(str.characters16(), str.l ength()); | |
| 68 else | |
| 69 m_string = str; | |
| 70 } | |
| 71 | |
| 59 // asString should only be used on the main thread. | 72 // asString should only be used on the main thread. |
| 60 const String& asString() const; | 73 const String& asString() const; |
| 61 // asStringImpl() is safe to call from any thread. | 74 // asStringImpl() is safe to call from any thread. |
| 62 const StringImpl* asStringImpl() const; | 75 const StringImpl* asStringImpl() const; |
| 63 | 76 |
| 64 static void init(); | 77 static void init(); |
| 65 | 78 |
| 66 bool isSafeToSendToAnotherThread() const { return m_string.isSafeToSendToAno therThread(); } | 79 bool isSafeToSendToAnotherThread() const { return m_string.isSafeToSendToAno therThread(); } |
| 67 | 80 |
| 81 bool operator==(const QualifiedName&) const; | |
| 82 bool operator!=(const QualifiedName& b) const; | |
|
abarth-chromium
2013/11/27 18:18:08
Why does one of these functions have a formal para
oystein (OOO til 10th of July)
2013/11/27 18:46:33
Hm what ambiguity is there when comparing a Qualif
| |
| 83 | |
| 68 #ifndef NDEBUG | 84 #ifndef NDEBUG |
| 69 static bool isKnown(const StringImpl*); | 85 static bool isKnown(const StringImpl*); |
| 70 #endif | 86 #endif |
| 71 | 87 |
| 72 private: | 88 private: |
| 73 static unsigned maxNameLength; | 89 static unsigned maxNameLength; |
| 74 static StringImpl* findIfKnown(const UChar* characters, unsigned length); | 90 static StringImpl* findIfKnown(const UChar* characters, unsigned length); |
| 75 static void addNames(const QualifiedName* const* names, unsigned namesCount) ; | 91 static void addNames(const QualifiedName* const* names, unsigned namesCount) ; |
| 76 | 92 |
| 77 String m_string; | 93 String m_string; |
| 78 }; | 94 }; |
| 79 | 95 |
| 80 } | 96 } |
| 81 | 97 |
| 82 #endif | 98 #endif |
| OLD | NEW |