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

Unified Diff: third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.cpp

Issue 2803873002: return pointer (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « third_party/WebKit/Source/modules/document_metadata/CopylessPasteExtractor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698