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

Unified Diff: components/font_service/public/cpp/font_service_thread.h

Issue 1916003002: Fixes possible deadlock in fontservice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « no previous file | components/font_service/public/cpp/font_service_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/font_service/public/cpp/font_service_thread.h
diff --git a/components/font_service/public/cpp/font_service_thread.h b/components/font_service/public/cpp/font_service_thread.h
index 04c75a2a465c958aab04556ad808ea9487ec804e..db7598c1b048fccc35cf640defe277bec8c9b7cf 100644
--- a/components/font_service/public/cpp/font_service_thread.h
+++ b/components/font_service/public/cpp/font_service_thread.h
@@ -7,8 +7,11 @@
#include <stdint.h>
+#include <set>
+
#include "base/files/file.h"
#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
#include "base/threading/thread.h"
#include "components/font_service/public/interfaces/font_service.mojom.h"
#include "third_party/skia/include/core/SkStream.h"
@@ -79,6 +82,10 @@ class FontServiceThread : public base::Thread,
base::File* output_file,
mojo::ScopedHandle handle);
+ // Connection to |font_service_| has gone away. Called on the background
+ // thread.
+ void OnFontServiceConnectionError();
+
// base::Thread
void Init() override;
void CleanUp() override;
@@ -91,6 +98,16 @@ class FontServiceThread : public base::Thread,
// non-thread bound, and binds it to the newly created thread.
mojo::InterfacePtr<FontService> font_service_;
+ // All WaitableEvents supplied to OpenStreamImpl() are added here while
+ // waiting on the response from the |font_service_| (FontService::OpenStream()
+ // was called, but the callback has not been processed yet). If
+ // |font_service_| gets an error during this time all events in
+ // |pending_waitable_events_| are signaled. This is necessary as when the
+ // pipe is closed the callbacks are never received.
+ std::set<base::WaitableEvent*> pending_waitable_events_;
+
+ base::WeakPtrFactory<FontServiceThread> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(FontServiceThread);
};
« no previous file with comments | « no previous file | components/font_service/public/cpp/font_service_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698