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

Unified Diff: components/offline_pages/core/prefetch/prefetch_proto_utils.cc

Issue 2928243002: Return operation name in prefetch request callback and add internal page hookup (Closed)
Patch Set: Fix comment indent in JS Created 3 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/core/prefetch/prefetch_proto_utils.cc
diff --git a/components/offline_pages/core/prefetch/prefetch_proto_utils.cc b/components/offline_pages/core/prefetch/prefetch_proto_utils.cc
index 0fe504049bc45368c1e3c5e567e40727b7f53fbb..0fcdfb7beb293c8f586061099103ee11e189d635 100644
--- a/components/offline_pages/core/prefetch/prefetch_proto_utils.cc
+++ b/components/offline_pages/core/prefetch/prefetch_proto_utils.cc
@@ -123,18 +123,19 @@ bool ParsePendingOperationResponse(const proto::Operation& operation,
} // namespace
-bool ParseOperationResponse(const std::string& data,
- std::vector<RenderPageInfo>* pages) {
+std::string ParseOperationResponse(const std::string& data,
+ std::vector<RenderPageInfo>* pages) {
proto::Operation operation;
if (!operation.ParseFromString(data)) {
DVLOG(1) << "Failed to parse operation";
- return false;
+ return std::string();
}
- if (operation.done())
- return ParseDoneOperationResponse(operation, pages);
- else
- return ParsePendingOperationResponse(operation, pages);
+ std::string name = operation.name();
+ bool success = operation.done()
+ ? ParseDoneOperationResponse(operation, pages)
+ : ParsePendingOperationResponse(operation, pages);
+ return success ? name : std::string();
}
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698