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

Unified Diff: mojo/edk/system/raw_channel.h

Issue 1471123002: Don't leak the WatcherThreadManager background thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: also posix 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
« no previous file with comments | « base/threading/thread.cc ('k') | mojo/edk/system/raw_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/raw_channel.h
diff --git a/mojo/edk/system/raw_channel.h b/mojo/edk/system/raw_channel.h
index 07b7881640218a5cdd63ee2f6514d6fe41022697..b261a792b806ee757557a5723c4d70fbb3fa773f 100644
--- a/mojo/edk/system/raw_channel.h
+++ b/mojo/edk/system/raw_channel.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
+#include "base/message_loop/message_loop.h"
#include "base/synchronization/lock.h"
#include "mojo/edk/embedder/platform_handle_vector.h"
#include "mojo/edk/embedder/scoped_platform_handle.h"
@@ -35,7 +36,8 @@ namespace edk {
// With the exception of |WriteMessage()|, this class is thread-unsafe (and in
// general its methods should only be used on the I/O thread, i.e., the thread
// on which |Init()| is called).
-class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
+class MOJO_SYSTEM_IMPL_EXPORT RawChannel :
+ public base::MessageLoop::DestructionObserver {
public:
// The |Delegate| is only accessed on the same thread as the message loop
@@ -239,11 +241,11 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
// Shutdown must be called on the IO thread. This object deletes itself once
// it's flushed all pending writes and insured that the other side of the pipe
// read them.
- virtual ~RawChannel();
+ ~RawChannel() override;
// |result| must not be |IO_PENDING|. Must be called on the I/O thread WITHOUT
// |write_lock_| held. This object may be destroyed by this call. This
- // acquires |read_lock_| inside of it. The caller needs to acquire read_lock_
+ // acquires |write_lock_| inside of it. The caller needs to acquire read_lock_
// first.
void OnReadCompletedNoLock(IOResult io_result, size_t bytes_read);
// |result| must not be |IO_PENDING|. Must be called on the I/O thread WITHOUT
@@ -414,6 +416,9 @@ class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
// Connects to the OS pipe.
void LazyInitialize();
+ // base::MessageLoop::DestructionObserver:
+ void WillDestroyCurrentMessageLoop() override;
+
« no previous file with comments | « base/threading/thread.cc ('k') | mojo/edk/system/raw_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698