| OLD | NEW |
| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 // Fallback to appending the original attribute. | 219 // Fallback to appending the original attribute. |
| 220 MarkupAccumulator::appendAttribute(out, element, attribute, namespaces); | 220 MarkupAccumulator::appendAttribute(out, element, attribute, namespaces); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void SerializerMarkupAccumulator::appendStartTag(Node& node, | 223 void SerializerMarkupAccumulator::appendStartTag(Node& node, |
| 224 Namespaces* namespaces) { | 224 Namespaces* namespaces) { |
| 225 MarkupAccumulator::appendStartTag(node, namespaces); | 225 MarkupAccumulator::appendStartTag(node, namespaces); |
| 226 m_nodes.append(&node); | 226 m_nodes.push_back(&node); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void SerializerMarkupAccumulator::appendEndTag(const Element& element) { | 229 void SerializerMarkupAccumulator::appendEndTag(const Element& element) { |
| 230 if (!shouldIgnoreElement(element)) | 230 if (!shouldIgnoreElement(element)) |
| 231 MarkupAccumulator::appendEndTag(element); | 231 MarkupAccumulator::appendEndTag(element); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void SerializerMarkupAccumulator::appendAttributeValue( | 234 void SerializerMarkupAccumulator::appendAttributeValue( |
| 235 StringBuilder& out, | 235 StringBuilder& out, |
| 236 const String& attributeValue) { | 236 const String& attributeValue) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 TRACE_EVENT0("page-serialization", "FrameSerializer::serializeFrame HTML"); | 288 TRACE_EVENT0("page-serialization", "FrameSerializer::serializeFrame HTML"); |
| 289 SCOPED_BLINK_UMA_HISTOGRAM_TIMER( | 289 SCOPED_BLINK_UMA_HISTOGRAM_TIMER( |
| 290 "PageSerialization.SerializationTime.Html"); | 290 "PageSerialization.SerializationTime.Html"); |
| 291 SerializerMarkupAccumulator accumulator(m_delegate, document, | 291 SerializerMarkupAccumulator accumulator(m_delegate, document, |
| 292 serializedNodes); | 292 serializedNodes); |
| 293 String text = | 293 String text = |
| 294 serializeNodes<EditingStrategy>(accumulator, document, IncludeNode); | 294 serializeNodes<EditingStrategy>(accumulator, document, IncludeNode); |
| 295 | 295 |
| 296 CString frameHTML = | 296 CString frameHTML = |
| 297 document.encoding().encode(text, WTF::EntitiesForUnencodables); | 297 document.encoding().encode(text, WTF::EntitiesForUnencodables); |
| 298 m_resources->append(SerializedResource( | 298 m_resources->push_back(SerializedResource( |
| 299 url, document.suggestedMIMEType(), | 299 url, document.suggestedMIMEType(), |
| 300 SharedBuffer::create(frameHTML.data(), frameHTML.length()))); | 300 SharedBuffer::create(frameHTML.data(), frameHTML.length()))); |
| 301 } | 301 } |
| 302 | 302 |
| 303 for (Node* node : serializedNodes) { | 303 for (Node* node : serializedNodes) { |
| 304 ASSERT(node); | 304 ASSERT(node); |
| 305 if (!node->isElementNode()) | 305 if (!node->isElementNode()) |
| 306 continue; | 306 continue; |
| 307 | 307 |
| 308 Element& element = toElement(*node); | 308 Element& element = toElement(*node); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 PassRefPtr<const SharedBuffer> data, | 465 PassRefPtr<const SharedBuffer> data, |
| 466 const KURL& url) { | 466 const KURL& url) { |
| 467 if (m_delegate.shouldSkipResource(hasCacheControlNoStoreHeader)) | 467 if (m_delegate.shouldSkipResource(hasCacheControlNoStoreHeader)) |
| 468 return; | 468 return; |
| 469 | 469 |
| 470 if (!data) { | 470 if (!data) { |
| 471 DLOG(ERROR) << "No data for resource " << url.getString(); | 471 DLOG(ERROR) << "No data for resource " << url.getString(); |
| 472 return; | 472 return; |
| 473 } | 473 } |
| 474 | 474 |
| 475 m_resources->append(SerializedResource(url, mimeType, std::move(data))); | 475 m_resources->push_back(SerializedResource(url, mimeType, std::move(data))); |
| 476 m_resourceURLs.add(url); | 476 m_resourceURLs.add(url); |
| 477 } | 477 } |
| 478 | 478 |
| 479 void FrameSerializer::addImageToResources(ImageResourceContent* image, | 479 void FrameSerializer::addImageToResources(ImageResourceContent* image, |
| 480 const KURL& url) { | 480 const KURL& url) { |
| 481 if (!image || !image->hasImage() || image->errorOccurred() || | 481 if (!image || !image->hasImage() || image->errorOccurred() || |
| 482 !shouldAddURL(url)) | 482 !shouldAddURL(url)) |
| 483 return; | 483 return; |
| 484 | 484 |
| 485 TRACE_EVENT2("page-serialization", "FrameSerializer::addImageToResources", | 485 TRACE_EVENT2("page-serialization", "FrameSerializer::addImageToResources", |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 emitsMinus = ch == '-'; | 579 emitsMinus = ch == '-'; |
| 580 builder.append(ch); | 580 builder.append(ch); |
| 581 } | 581 } |
| 582 CString escapedUrl = builder.toString().ascii(); | 582 CString escapedUrl = builder.toString().ascii(); |
| 583 return String::format("saved from url=(%04d)%s", | 583 return String::format("saved from url=(%04d)%s", |
| 584 static_cast<int>(escapedUrl.length()), | 584 static_cast<int>(escapedUrl.length()), |
| 585 escapedUrl.data()); | 585 escapedUrl.data()); |
| 586 } | 586 } |
| 587 | 587 |
| 588 } // namespace blink | 588 } // namespace blink |
| OLD | NEW |