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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/CompactHTMLToken.cpp

Issue 2751483005: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in core/html/parser/ (Closed)
Patch Set: rebase Created 3 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
OLDNEW
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 30 matching lines...) Expand all
41 "CompactHTMLToken should stay small"); 41 "CompactHTMLToken should stay small");
42 42
43 CompactHTMLToken::CompactHTMLToken(const HTMLToken* token, 43 CompactHTMLToken::CompactHTMLToken(const HTMLToken* token,
44 const TextPosition& textPosition) 44 const TextPosition& textPosition)
45 : m_type(token->type()), 45 : m_type(token->type()),
46 m_isAll8BitData(false), 46 m_isAll8BitData(false),
47 m_doctypeForcesQuirks(false), 47 m_doctypeForcesQuirks(false),
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 NOTREACHED();
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.push_back(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();
(...skipping 12 matching lines...) Expand all
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(
80 token->data(), token->isAll8BitData() ? Force8Bit : Force16Bit); 80 token->data(), token->isAll8BitData() ? Force8Bit : Force16Bit);
81 break; 81 break;
82 } 82 }
83 default: 83 default:
84 ASSERT_NOT_REACHED(); 84 NOTREACHED();
85 break; 85 break;
86 } 86 }
87 } 87 }
88 88
89 const CompactHTMLToken::Attribute* CompactHTMLToken::getAttributeItem( 89 const CompactHTMLToken::Attribute* CompactHTMLToken::getAttributeItem(
90 const QualifiedName& name) const { 90 const QualifiedName& name) const {
91 for (unsigned i = 0; i < m_attributes.size(); ++i) { 91 for (unsigned i = 0; i < m_attributes.size(); ++i) {
92 if (threadSafeMatch(m_attributes.at(i).name(), name)) 92 if (threadSafeMatch(m_attributes.at(i).name(), name))
93 return &m_attributes.at(i); 93 return &m_attributes.at(i);
94 } 94 }
95 return nullptr; 95 return nullptr;
96 } 96 }
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698