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

Unified Diff: mojo/application/public/cpp/lib/content_handler_factory.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: mojo/application/public/cpp/lib/content_handler_factory.cc
diff --git a/mojo/application/public/cpp/lib/content_handler_factory.cc b/mojo/application/public/cpp/lib/content_handler_factory.cc
index 3ce666faa7c06be58087af387b1143cb84c00e6d..b01868cc2c8ef593d5c7e3b8160afe4447bb7c91 100644
--- a/mojo/application/public/cpp/lib/content_handler_factory.cc
+++ b/mojo/application/public/cpp/lib/content_handler_factory.cc
@@ -31,12 +31,18 @@ class ApplicationThread : public base::PlatformThread::Delegate {
const base::Callback<void(ApplicationThread*)>& termination_callback,
ContentHandlerFactory::Delegate* handler_delegate,
InterfaceRequest<Application> application_request,
- URLResponsePtr response)
+ URLResponsePtr response,
+ const Callback<void()>& destruct_callback)
: handler_thread_(handler_thread),
termination_callback_(termination_callback),
handler_delegate_(handler_delegate),
application_request_(application_request.Pass()),
- response_(response.Pass()) {}
+ response_(response.Pass()),
+ destruct_callback_(destruct_callback) {}
+
+ ~ApplicationThread() override {
+ destruct_callback_.Run();
+ }
private:
void ThreadMain() override {
@@ -51,6 +57,7 @@ class ApplicationThread : public base::PlatformThread::Delegate {
ContentHandlerFactory::Delegate* handler_delegate_;
InterfaceRequest<Application> application_request_;
URLResponsePtr response_;
+ Callback<void()> destruct_callback_;
DISALLOW_COPY_AND_ASSIGN(ApplicationThread);
};
@@ -76,13 +83,16 @@ class ContentHandlerImpl : public ContentHandler {
private:
// Overridden from ContentHandler:
- void StartApplication(InterfaceRequest<Application> application_request,
- URLResponsePtr response) override {
+ void StartApplication(
+ InterfaceRequest<Application> application_request,
+ URLResponsePtr response,
+ const Callback<void()>& destruct_callback) override {
ApplicationThread* thread = new ApplicationThread(
base::ThreadTaskRunnerHandle::Get(),
base::Bind(&ContentHandlerImpl::OnThreadEnd,
weak_factory_.GetWeakPtr()),
- delegate_, application_request.Pass(), response.Pass());
+ delegate_, application_request.Pass(), response.Pass(),
+ destruct_callback);
base::PlatformThreadHandle handle;
bool launched = base::PlatformThread::Create(0, thread, &handle);
DCHECK(launched);

Powered by Google App Engine
This is Rietveld 408576698