| Index: third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp
|
| diff --git a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp
|
| index 4d1d951ba3ede1aeead0c6064c5476d1a22d7b90..c609c1f65c4eb1a1349cc116d23d9d6ce32ba1db 100644
|
| --- a/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp
|
| +++ b/third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp
|
| @@ -268,33 +268,34 @@ bool extractMetadata(const Element& root, Vector<EntityPtr>& entities) {
|
|
|
| } // namespace
|
|
|
| -bool CopylessPasteExtractor::extract(const Document& document,
|
| - mojom::blink::WebPage& page) {
|
| +mojom::blink::WebPagePtr CopylessPasteExtractor::extract(
|
| + const Document& document) {
|
| TRACE_EVENT0("blink", "CopylessPasteExtractor::extract");
|
|
|
| if (!document.frame() || !document.frame()->isMainFrame())
|
| - return false;
|
| + return nullptr;
|
|
|
| DCHECK(document.hasFinishedParsing());
|
|
|
| Element* html = document.documentElement();
|
| if (!html)
|
| - return false;
|
| + return nullptr;
|
|
|
| double startTime = monotonicallyIncreasingTime();
|
|
|
| + mojom::blink::WebPagePtr page = mojom::blink::WebPage::New();
|
| // Traverse the DOM tree and extract the metadata.
|
| - if (!extractMetadata(*html, page.entities))
|
| - return false;
|
| - page.url = document.url();
|
| - page.title = document.title();
|
| + if (!extractMetadata(*html, page->entities))
|
| + return nullptr;
|
| + page->url = document.url();
|
| + page->title = document.title();
|
|
|
| double elapsedTime = monotonicallyIncreasingTime() - startTime;
|
|
|
| DEFINE_STATIC_LOCAL(CustomCountHistogram, extractionHistogram,
|
| ("CopylessPaste.ExtractionUs", 1, 1000000, 50));
|
| extractionHistogram.count(static_cast<int>(1e6 * elapsedTime));
|
| - return true;
|
| + return page;
|
| }
|
|
|
| } // namespace blink
|
|
|