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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameSerializer.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 m_document->isHTMLDocument()); 243 m_document->isHTMLDocument());
244 } 244 }
245 245
246 void SerializerMarkupAccumulator::appendRewrittenAttribute( 246 void SerializerMarkupAccumulator::appendRewrittenAttribute(
247 StringBuilder& out, 247 StringBuilder& out,
248 const Element& element, 248 const Element& element,
249 const String& attributeName, 249 const String& attributeName,
250 const String& attributeValue) { 250 const String& attributeValue) {
251 if (m_elementsWithRewrittenLinks.contains(&element)) 251 if (m_elementsWithRewrittenLinks.contains(&element))
252 return; 252 return;
253 m_elementsWithRewrittenLinks.add(&element); 253 m_elementsWithRewrittenLinks.insert(&element);
254 254
255 // Append the rewritten attribute. 255 // Append the rewritten attribute.
256 // TODO(tiger): Refactor MarkupAccumulator so it is easier to append an 256 // TODO(tiger): Refactor MarkupAccumulator so it is easier to append an
257 // attribute like this. 257 // attribute like this.
258 out.append(' '); 258 out.append(' ');
259 out.append(attributeName); 259 out.append(attributeName);
260 out.append("=\""); 260 out.append("=\"");
261 appendAttributeValue(out, attributeValue); 261 appendAttributeValue(out, attributeValue);
262 out.append("\""); 262 out.append("\"");
263 } 263 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 } 388 }
389 389
390 WTF::TextEncoding textEncoding(styleSheet.contents()->charset()); 390 WTF::TextEncoding textEncoding(styleSheet.contents()->charset());
391 ASSERT(textEncoding.isValid()); 391 ASSERT(textEncoding.isValid());
392 String textString = cssText.toString(); 392 String textString = cssText.toString();
393 CString text = 393 CString text =
394 textEncoding.encode(textString, WTF::CSSEncodedEntitiesForUnencodables); 394 textEncoding.encode(textString, WTF::CSSEncodedEntitiesForUnencodables);
395 m_resources->append( 395 m_resources->append(
396 SerializedResource(url, String("text/css"), 396 SerializedResource(url, String("text/css"),
397 SharedBuffer::create(text.data(), text.length()))); 397 SharedBuffer::create(text.data(), text.length())));
398 m_resourceURLs.add(url); 398 m_resourceURLs.insert(url);
399 } 399 }
400 400
401 // Sub resources need to be serialized even if the CSS definition doesn't 401 // Sub resources need to be serialized even if the CSS definition doesn't
402 // need to be. 402 // need to be.
403 for (unsigned i = 0; i < styleSheet.length(); ++i) 403 for (unsigned i = 0; i < styleSheet.length(); ++i)
404 serializeCSSRule(styleSheet.item(i)); 404 serializeCSSRule(styleSheet.item(i));
405 405
406 if (cssStartTime != 0) { 406 if (cssStartTime != 0) {
407 m_isSerializingCss = false; 407 m_isSerializingCss = false;
408 DEFINE_STATIC_LOCAL(CustomCountHistogram, cssHistogram, 408 DEFINE_STATIC_LOCAL(CustomCountHistogram, cssHistogram,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 const KURL& url) { 471 const KURL& url) {
472 if (m_delegate.shouldSkipResource(hasCacheControlNoStoreHeader)) 472 if (m_delegate.shouldSkipResource(hasCacheControlNoStoreHeader))
473 return; 473 return;
474 474
475 if (!data) { 475 if (!data) {
476 DLOG(ERROR) << "No data for resource " << url.getString(); 476 DLOG(ERROR) << "No data for resource " << url.getString();
477 return; 477 return;
478 } 478 }
479 479
480 m_resources->append(SerializedResource(url, mimeType, std::move(data))); 480 m_resources->append(SerializedResource(url, mimeType, std::move(data)));
481 m_resourceURLs.add(url); 481 m_resourceURLs.insert(url);
482 } 482 }
483 483
484 void FrameSerializer::addImageToResources(ImageResourceContent* image, 484 void FrameSerializer::addImageToResources(ImageResourceContent* image,
485 const KURL& url) { 485 const KURL& url) {
486 if (!image || !image->hasImage() || image->errorOccurred() || 486 if (!image || !image->hasImage() || image->errorOccurred() ||
487 !shouldAddURL(url)) 487 !shouldAddURL(url))
488 return; 488 return;
489 489
490 TRACE_EVENT2("page-serialization", "FrameSerializer::addImageToResources", 490 TRACE_EVENT2("page-serialization", "FrameSerializer::addImageToResources",
491 "type", "image", "url", url.elidedString().utf8().data()); 491 "type", "image", "url", url.elidedString().utf8().data());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 emitsMinus = ch == '-'; 584 emitsMinus = ch == '-';
585 builder.append(ch); 585 builder.append(ch);
586 } 586 }
587 CString escapedUrl = builder.toString().ascii(); 587 CString escapedUrl = builder.toString().ascii();
588 return String::format("saved from url=(%04d)%s", 588 return String::format("saved from url=(%04d)%s",
589 static_cast<int>(escapedUrl.length()), 589 static_cast<int>(escapedUrl.length()),
590 escapedUrl.data()); 590 escapedUrl.data());
591 } 591 }
592 592
593 } // namespace blink 593 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameConsole.cpp ('k') | third_party/WebKit/Source/core/frame/FrameView.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698