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

Side by Side Diff: third_party/WebKit/Source/core/html/parser/AtomicHTMLToken.h

Issue 2050123002: Remove OwnPtr from Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: First attempt to land. Created 4 years, 6 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 13 matching lines...) Expand all
24 */ 24 */
25 25
26 #ifndef AtomicHTMLToken_h 26 #ifndef AtomicHTMLToken_h
27 #define AtomicHTMLToken_h 27 #define AtomicHTMLToken_h
28 28
29 #include "core/HTMLElementLookupTrie.h" 29 #include "core/HTMLElementLookupTrie.h"
30 #include "core/dom/Attribute.h" 30 #include "core/dom/Attribute.h"
31 #include "core/html/parser/CompactHTMLToken.h" 31 #include "core/html/parser/CompactHTMLToken.h"
32 #include "core/html/parser/HTMLToken.h" 32 #include "core/html/parser/HTMLToken.h"
33 #include "wtf/Allocator.h" 33 #include "wtf/Allocator.h"
34 #include "wtf/PtrUtil.h"
35 #include <memory>
34 36
35 namespace blink { 37 namespace blink {
36 38
37 class CORE_EXPORT AtomicHTMLToken { 39 class CORE_EXPORT AtomicHTMLToken {
38 STACK_ALLOCATED(); 40 STACK_ALLOCATED();
39 WTF_MAKE_NONCOPYABLE(AtomicHTMLToken); 41 WTF_MAKE_NONCOPYABLE(AtomicHTMLToken);
40 public: 42 public:
41 43
42 bool forceQuirks() const 44 bool forceQuirks() const
43 { 45 {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 146
145 explicit AtomicHTMLToken(const CompactHTMLToken& token) 147 explicit AtomicHTMLToken(const CompactHTMLToken& token)
146 : m_type(token.type()) 148 : m_type(token.type())
147 { 149 {
148 switch (m_type) { 150 switch (m_type) {
149 case HTMLToken::Uninitialized: 151 case HTMLToken::Uninitialized:
150 ASSERT_NOT_REACHED(); 152 ASSERT_NOT_REACHED();
151 break; 153 break;
152 case HTMLToken::DOCTYPE: 154 case HTMLToken::DOCTYPE:
153 m_name = AtomicString(token.data()); 155 m_name = AtomicString(token.data());
154 m_doctypeData = adoptPtr(new DoctypeData()); 156 m_doctypeData = wrapUnique(new DoctypeData());
155 m_doctypeData->m_hasPublicIdentifier = true; 157 m_doctypeData->m_hasPublicIdentifier = true;
156 append(m_doctypeData->m_publicIdentifier, token.publicIdentifier()); 158 append(m_doctypeData->m_publicIdentifier, token.publicIdentifier());
157 m_doctypeData->m_hasSystemIdentifier = true; 159 m_doctypeData->m_hasSystemIdentifier = true;
158 append(m_doctypeData->m_systemIdentifier, token.systemIdentifier()); 160 append(m_doctypeData->m_systemIdentifier, token.systemIdentifier());
159 m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks(); 161 m_doctypeData->m_forceQuirks = token.doctypeForcesQuirks();
160 break; 162 break;
161 case HTMLToken::EndOfFile: 163 case HTMLToken::EndOfFile:
162 break; 164 break;
163 case HTMLToken::StartTag: 165 case HTMLToken::StartTag:
164 m_attributes.reserveInitialCapacity(token.attributes().size()); 166 m_attributes.reserveInitialCapacity(token.attributes().size());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 207
206 bool usesAttributes() const; 208 bool usesAttributes() const;
207 209
208 // "name" for DOCTYPE, StartTag, and EndTag 210 // "name" for DOCTYPE, StartTag, and EndTag
209 AtomicString m_name; 211 AtomicString m_name;
210 212
211 // "data" for Comment, "characters" for Character 213 // "data" for Comment, "characters" for Character
212 String m_data; 214 String m_data;
213 215
214 // For DOCTYPE 216 // For DOCTYPE
215 OwnPtr<DoctypeData> m_doctypeData; 217 std::unique_ptr<DoctypeData> m_doctypeData;
216 218
217 // For StartTag and EndTag 219 // For StartTag and EndTag
218 bool m_selfClosing; 220 bool m_selfClosing;
219 221
220 Vector<Attribute> m_attributes; 222 Vector<Attribute> m_attributes;
221 }; 223 };
222 224
223 inline void AtomicHTMLToken::initializeAttributes(const HTMLToken::AttributeList & attributes) 225 inline void AtomicHTMLToken::initializeAttributes(const HTMLToken::AttributeList & attributes)
224 { 226 {
225 size_t size = attributes.size(); 227 size_t size = attributes.size();
(...skipping 16 matching lines...) Expand all
242 const QualifiedName& name = nameForAttribute(attribute); 244 const QualifiedName& name = nameForAttribute(attribute);
243 // FIXME: This is N^2 for the number of attributes. 245 // FIXME: This is N^2 for the number of attributes.
244 if (!findAttributeInVector(m_attributes, name)) 246 if (!findAttributeInVector(m_attributes, name))
245 m_attributes.append(Attribute(name, value)); 247 m_attributes.append(Attribute(name, value));
246 } 248 }
247 } 249 }
248 250
249 } // namespace blink 251 } // namespace blink
250 252
251 #endif 253 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698