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

Unified Diff: chrome/browser/process_singleton_linux.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
Index: chrome/browser/process_singleton_linux.cc
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index fbe930cc68547a62a66ef86046fe23297cc86831..6a96ab3a2bc2ca315efabf56ba5642ddc4878184 100644
--- a/chrome/browser/process_singleton_linux.cc
+++ b/chrome/browser/process_singleton_linux.cc
@@ -405,17 +405,17 @@ bool ConnectSocket(ScopedSocket* socket,
// A helper class for a Linux specific implementation of the process singleton.
// This class sets up a listener on the singleton socket and handles parsing
// messages that come in on the singleton socket.
-class ProcessSingleton::LinuxWatcher
- : public MessageLoopForIO::Watcher,
- public MessageLoop::DestructionObserver,
- public base::RefCountedThreadSafe<ProcessSingleton::LinuxWatcher,
- BrowserThread::DeleteOnIOThread> {
+class ProcessSingleton::LinuxWatcher :
+ public base::MessageLoopForIO::Watcher,
+ public base::MessageLoop::DestructionObserver,
+ public base::RefCountedThreadSafe<ProcessSingleton::LinuxWatcher,
+ BrowserThread::DeleteOnIOThread> {
public:
// A helper class to read message from an established socket.
- class SocketReader : public MessageLoopForIO::Watcher {
+ class SocketReader : public base::MessageLoopForIO::Watcher {
public:
SocketReader(ProcessSingleton::LinuxWatcher* parent,
- MessageLoop* ui_message_loop,
+ base::MessageLoop* ui_message_loop,
int fd)
: parent_(parent),
ui_message_loop_(ui_message_loop),
@@ -423,8 +423,8 @@ class ProcessSingleton::LinuxWatcher
bytes_read_(0) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Wait for reads.
- MessageLoopForIO::current()->WatchFileDescriptor(
- fd, true, MessageLoopForIO::WATCH_READ, &fd_reader_, this);
+ base::MessageLoopForIO::current()->WatchFileDescriptor(
+ fd, true, base::MessageLoopForIO::WATCH_READ, &fd_reader_, this);
// If we haven't completed in a reasonable amount of time, give up.
timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutInSeconds),
this, &SocketReader::CleanupAndDeleteSelf);
@@ -453,13 +453,13 @@ class ProcessSingleton::LinuxWatcher
// We're deleted beyond this point.
}
- MessageLoopForIO::FileDescriptorWatcher fd_reader_;
+ base::MessageLoopForIO::FileDescriptorWatcher fd_reader_;
// The ProcessSingleton::LinuxWatcher that owns us.
ProcessSingleton::LinuxWatcher* const parent_;
// A reference to the UI message loop.
- MessageLoop* const ui_message_loop_;
+ base::MessageLoop* const ui_message_loop_;
// The file descriptor we're reading.
const int fd_;
@@ -478,9 +478,7 @@ class ProcessSingleton::LinuxWatcher
// We expect to only be constructed on the UI thread.
explicit LinuxWatcher(ProcessSingleton* parent)
- : ui_message_loop_(MessageLoop::current()),
- parent_(parent) {
- }
+ : ui_message_loop_(base::MessageLoop::current()), parent_(parent) {}
// Start listening for connections on the socket. This method should be
// called from the IO thread.
@@ -513,18 +511,18 @@ class ProcessSingleton::LinuxWatcher
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
STLDeleteElements(&readers_);
- MessageLoopForIO* ml = MessageLoopForIO::current();
+ base::MessageLoopForIO* ml = base::MessageLoopForIO::current();
ml->RemoveDestructionObserver(this);
}
// Removes and deletes the SocketReader.
void RemoveSocketReader(SocketReader* reader);
- MessageLoopForIO::FileDescriptorWatcher fd_watcher_;
+ base::MessageLoopForIO::FileDescriptorWatcher fd_watcher_;
// A reference to the UI message loop (i.e., the message loop we were
// constructed on).
- MessageLoop* ui_message_loop_;
+ base::MessageLoop* ui_message_loop_;
// The ProcessSingleton that owns us.
ProcessSingleton* const parent_;
@@ -556,16 +554,16 @@ void ProcessSingleton::LinuxWatcher::OnFileCanReadWithoutBlocking(int fd) {
void ProcessSingleton::LinuxWatcher::StartListening(int socket) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
// Watch for client connections on this socket.
- MessageLoopForIO* ml = MessageLoopForIO::current();
+ base::MessageLoopForIO* ml = base::MessageLoopForIO::current();
ml->AddDestructionObserver(this);
- ml->WatchFileDescriptor(socket, true, MessageLoopForIO::WATCH_READ,
- &fd_watcher_, this);
+ ml->WatchFileDescriptor(
+ socket, true, base::MessageLoopForIO::WATCH_READ, &fd_watcher_, this);
}
void ProcessSingleton::LinuxWatcher::HandleMessage(
const std::string& current_dir, const std::vector<std::string>& argv,
SocketReader* reader) {
- DCHECK(ui_message_loop_ == MessageLoop::current());
+ DCHECK(ui_message_loop_ == base::MessageLoop::current());
DCHECK(reader);
if (parent_->notification_callback_.Run(CommandLine(argv),

Powered by Google App Engine
This is Rietveld 408576698