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

Unified Diff: components/pdf_viewer/pdf_viewer.cc

Issue 1431573002: Fix hangs in Mandoline page cycler on Linux with --enable-multiprocess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 1 month 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/pdf_viewer/pdf_viewer.cc
diff --git a/components/pdf_viewer/pdf_viewer.cc b/components/pdf_viewer/pdf_viewer.cc
index 9da79895cd25cc3cc096dcfa7cbfa8ea59b6020e..0934fab36aaa531f8b309247d991f4967c5be273 100644
--- a/components/pdf_viewer/pdf_viewer.cc
+++ b/components/pdf_viewer/pdf_viewer.cc
@@ -509,13 +509,15 @@ class PDFViewerApplicationDelegate
public:
PDFViewerApplicationDelegate(
mojo::InterfaceRequest<mojo::Application> request,
- mojo::URLResponsePtr response)
+ mojo::URLResponsePtr response,
+ const mojo::Callback<void()>& destruct_callback)
: app_(this,
request.Pass(),
base::Bind(&PDFViewerApplicationDelegate::OnTerminate,
base::Unretained(this))),
doc_(nullptr),
- is_destroying_(false) {
+ is_destroying_(false),
+ destruct_callback_(destruct_callback) {
FetchPDF(response.Pass());
}
@@ -525,6 +527,7 @@ class PDFViewerApplicationDelegate
FPDF_CloseDocument(doc_);
while (!pdf_views_.empty())
pdf_views_.front()->Close();
+ destruct_callback_.Run();
}
private:
@@ -574,6 +577,7 @@ class PDFViewerApplicationDelegate
std::vector<PDFView*> pdf_views_;
FPDF_DOCUMENT doc_;
bool is_destroying_;
+ mojo::Callback<void()> destruct_callback_;
DISALLOW_COPY_AND_ASSIGN(PDFViewerApplicationDelegate);
};
@@ -586,9 +590,12 @@ class ContentHandlerImpl : public mojo::ContentHandler {
private:
// ContentHandler:
- void StartApplication(mojo::InterfaceRequest<mojo::Application> request,
- mojo::URLResponsePtr response) override {
- new PDFViewerApplicationDelegate(request.Pass(), response.Pass());
+ void StartApplication(
+ mojo::InterfaceRequest<mojo::Application> request,
+ mojo::URLResponsePtr response,
+ const mojo::Callback<void()>& destruct_callback) override {
+ new PDFViewerApplicationDelegate(
+ request.Pass(), response.Pass(), destruct_callback);
}
mojo::StrongBinding<mojo::ContentHandler> binding_;

Powered by Google App Engine
This is Rietveld 408576698