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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // There is only 1 DOCTYPE token per document, so to avoid increasing th
e | 56 // There is only 1 DOCTYPE token per document, so to avoid increasing th
e |
57 // size of CompactHTMLToken, we just use the m_attributes vector. | 57 // size of CompactHTMLToken, we just use the m_attributes vector. |
58 m_attributes.append(Attribute(attemptStaticStringCreation(token->publicI
dentifier(), Likely8Bit), String(token->systemIdentifier()))); | 58 m_attributes.append(Attribute(attemptStaticStringCreation(token->publicI
dentifier(), Likely8Bit), String(token->systemIdentifier()))); |
59 m_doctypeForcesQuirks = token->forceQuirks(); | 59 m_doctypeForcesQuirks = token->forceQuirks(); |
60 break; | 60 break; |
61 } | 61 } |
62 case HTMLToken::EndOfFile: | 62 case HTMLToken::EndOfFile: |
63 break; | 63 break; |
64 case HTMLToken::StartTag: | 64 case HTMLToken::StartTag: |
65 m_attributes.reserveInitialCapacity(token->attributes().size()); | 65 m_attributes.reserveInitialCapacity(token->attributes().size()); |
66 for (Vector<HTMLToken::Attribute>::const_iterator it = token->attributes
().begin(); it != token->attributes().end(); ++it) | 66 for (const auto& attribute : token->attributes()) |
67 m_attributes.append(Attribute(attemptStaticStringCreation(it->name,
Likely8Bit), StringImpl::create8BitIfPossible(it->value))); | 67 m_attributes.append(Attribute(attemptStaticStringCreation(attribute.
name, Likely8Bit), StringImpl::create8BitIfPossible(attribute.value))); |
68 // Fall through! | 68 // Fall through! |
69 case HTMLToken::EndTag: | 69 case HTMLToken::EndTag: |
70 m_selfClosing = token->selfClosing(); | 70 m_selfClosing = token->selfClosing(); |
71 // Fall through! | 71 // Fall through! |
72 case HTMLToken::Comment: | 72 case HTMLToken::Comment: |
73 case HTMLToken::Character: { | 73 case HTMLToken::Character: { |
74 m_isAll8BitData = token->isAll8BitData(); | 74 m_isAll8BitData = token->isAll8BitData(); |
75 m_data = attemptStaticStringCreation(token->data(), token->isAll8BitData
() ? Force8Bit : Force16Bit); | 75 m_data = attemptStaticStringCreation(token->data(), token->isAll8BitData
() ? Force8Bit : Force16Bit); |
76 break; | 76 break; |
77 } | 77 } |
78 default: | 78 default: |
79 ASSERT_NOT_REACHED(); | 79 ASSERT_NOT_REACHED(); |
80 break; | 80 break; |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 const CompactHTMLToken::Attribute* CompactHTMLToken::getAttributeItem(const Qual
ifiedName& name) const | 84 const CompactHTMLToken::Attribute* CompactHTMLToken::getAttributeItem(const Qual
ifiedName& name) const |
85 { | 85 { |
86 for (unsigned i = 0; i < m_attributes.size(); ++i) { | 86 for (unsigned i = 0; i < m_attributes.size(); ++i) { |
87 if (threadSafeMatch(m_attributes.at(i).name, name)) | 87 if (threadSafeMatch(m_attributes.at(i).name, name)) |
88 return &m_attributes.at(i); | 88 return &m_attributes.at(i); |
89 } | 89 } |
90 return 0; | 90 return 0; |
91 } | 91 } |
92 | 92 |
93 bool CompactHTMLToken::isSafeToSendToAnotherThread() const | 93 bool CompactHTMLToken::isSafeToSendToAnotherThread() const |
94 { | 94 { |
95 for (Vector<Attribute>::const_iterator it = m_attributes.begin(); it != m_at
tributes.end(); ++it) { | 95 for (const auto& attribute : m_attributes) { |
96 if (!it->name.isSafeToSendToAnotherThread()) | 96 if (!attribute.name.isSafeToSendToAnotherThread()) |
97 return false; | 97 return false; |
98 if (!it->value.isSafeToSendToAnotherThread()) | 98 if (!attribute.value.isSafeToSendToAnotherThread()) |
99 return false; | 99 return false; |
100 } | 100 } |
101 return m_data.isSafeToSendToAnotherThread(); | 101 return m_data.isSafeToSendToAnotherThread(); |
102 } | 102 } |
103 | 103 |
104 } | 104 } |
OLD | NEW |