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

Unified Diff: base/message_loop/message_pump_io_ios.h

Issue 19661004: Made MessagePump a non-thread safe class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding a missing header. Created 7 years, 5 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 | « base/message_loop/message_pump_gtk.cc ('k') | base/message_loop/message_pump_io_ios.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop/message_pump_io_ios.h
diff --git a/base/message_loop/message_pump_io_ios.h b/base/message_loop/message_pump_io_ios.h
index 6596862b88b43e1d874ddc880bdc99a3720f3b27..52de9fd6891d7e23b57f21f2cd1c5c7e20791470 100644
--- a/base/message_loop/message_pump_io_ios.h
+++ b/base/message_loop/message_pump_io_ios.h
@@ -9,6 +9,7 @@
#include "base/mac/scoped_cffiledescriptorref.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/message_loop/message_pump_mac.h"
#include "base/observer_list.h"
@@ -70,8 +71,8 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
CFRunLoopSourceRef fd_source,
bool is_persistent);
- void set_pump(MessagePumpIOSForIO* pump) { pump_ = pump; }
- MessagePumpIOSForIO* pump() const { return pump_; }
+ void set_pump(base::WeakPtr<MessagePumpIOSForIO> pump) { pump_ = pump; }
+ const base::WeakPtr<MessagePumpIOSForIO>& pump() const { return pump_; }
void set_watcher(Watcher* watcher) { watcher_ = watcher; }
@@ -82,7 +83,7 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
base::mac::ScopedCFFileDescriptorRef fdref_;
CFOptionFlags callback_types_;
base::ScopedCFTypeRef<CFRunLoopSourceRef> fd_source_;
- scoped_refptr<MessagePumpIOSForIO> pump_;
+ base::WeakPtr<MessagePumpIOSForIO> pump_;
Watcher* watcher_;
DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher);
@@ -95,6 +96,7 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
};
MessagePumpIOSForIO();
+ virtual ~MessagePumpIOSForIO();
// Have the current thread's message loop watch for a a situation in which
// reading/writing to the FD can be performed without blocking.
@@ -118,9 +120,6 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
void AddIOObserver(IOObserver* obs);
void RemoveIOObserver(IOObserver* obs);
- protected:
- virtual ~MessagePumpIOSForIO();
-
private:
friend class MessagePumpIOSForIOTest;
@@ -134,6 +133,8 @@ class BASE_EXPORT MessagePumpIOSForIO : public MessagePumpNSRunLoop {
ObserverList<IOObserver> io_observers_;
ThreadChecker watch_file_descriptor_caller_checker_;
+ base::WeakPtrFactory<MessagePumpIOSForIO> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(MessagePumpIOSForIO);
};
« no previous file with comments | « base/message_loop/message_pump_gtk.cc ('k') | base/message_loop/message_pump_io_ios.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698