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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 m_textPosition(textPosition) { | 48 m_textPosition(textPosition) { |
49 switch (m_type) { | 49 switch (m_type) { |
50 case HTMLToken::Uninitialized: | 50 case HTMLToken::Uninitialized: |
51 ASSERT_NOT_REACHED(); | 51 ASSERT_NOT_REACHED(); |
52 break; | 52 break; |
53 case HTMLToken::DOCTYPE: { | 53 case HTMLToken::DOCTYPE: { |
54 m_data = attemptStaticStringCreation(token->name(), Likely8Bit); | 54 m_data = attemptStaticStringCreation(token->name(), Likely8Bit); |
55 | 55 |
56 // There is only 1 DOCTYPE token per document, so to avoid increasing the | 56 // There is only 1 DOCTYPE token per document, so to avoid increasing the |
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( | 58 m_attributes.push_back(Attribute( |
59 attemptStaticStringCreation(token->publicIdentifier(), Likely8Bit), | 59 attemptStaticStringCreation(token->publicIdentifier(), Likely8Bit), |
60 String(token->systemIdentifier()))); | 60 String(token->systemIdentifier()))); |
61 m_doctypeForcesQuirks = token->forceQuirks(); | 61 m_doctypeForcesQuirks = token->forceQuirks(); |
62 break; | 62 break; |
63 } | 63 } |
64 case HTMLToken::EndOfFile: | 64 case HTMLToken::EndOfFile: |
65 break; | 65 break; |
66 case HTMLToken::StartTag: | 66 case HTMLToken::StartTag: |
67 m_attributes.reserveInitialCapacity(token->attributes().size()); | 67 m_attributes.reserveInitialCapacity(token->attributes().size()); |
68 for (const HTMLToken::Attribute& attribute : token->attributes()) | 68 for (const HTMLToken::Attribute& attribute : token->attributes()) |
69 m_attributes.append( | 69 m_attributes.push_back( |
70 Attribute(attribute.nameAttemptStaticStringCreation(), | 70 Attribute(attribute.nameAttemptStaticStringCreation(), |
71 attribute.value8BitIfNecessary())); | 71 attribute.value8BitIfNecessary())); |
72 // Fall through! | 72 // Fall through! |
73 case HTMLToken::EndTag: | 73 case HTMLToken::EndTag: |
74 m_selfClosing = token->selfClosing(); | 74 m_selfClosing = token->selfClosing(); |
75 // Fall through! | 75 // Fall through! |
76 case HTMLToken::Comment: | 76 case HTMLToken::Comment: |
77 case HTMLToken::Character: { | 77 case HTMLToken::Character: { |
78 m_isAll8BitData = token->isAll8BitData(); | 78 m_isAll8BitData = token->isAll8BitData(); |
79 m_data = attemptStaticStringCreation( | 79 m_data = attemptStaticStringCreation( |
(...skipping 17 matching lines...) Expand all Loading... |
97 | 97 |
98 bool CompactHTMLToken::isSafeToSendToAnotherThread() const { | 98 bool CompactHTMLToken::isSafeToSendToAnotherThread() const { |
99 for (const Attribute& attribute : m_attributes) { | 99 for (const Attribute& attribute : m_attributes) { |
100 if (!attribute.isSafeToSendToAnotherThread()) | 100 if (!attribute.isSafeToSendToAnotherThread()) |
101 return false; | 101 return false; |
102 } | 102 } |
103 return m_data.isSafeToSendToAnotherThread(); | 103 return m_data.isSafeToSendToAnotherThread(); |
104 } | 104 } |
105 | 105 |
106 } // namespace blink | 106 } // namespace blink |
OLD | NEW |