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

Side by Side Diff: chrome/browser/process_singleton_posix.cc

Issue 624173002: replace OVERRIDE and FINAL with override and final in chrome/browser/[j-q]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // On Linux, when the user tries to launch a second copy of chrome, we check 5 // On Linux, when the user tries to launch a second copy of chrome, we check
6 // for a socket in the user's profile directory. If the socket file is open we 6 // for a socket in the user's profile directory. If the socket file is open we
7 // send a message to the first chrome browser process with the current 7 // send a message to the first chrome browser process with the current
8 // directory and second process command line flags. The second process then 8 // directory and second process command line flags. The second process then
9 // exits. 9 // exits.
10 // 10 //
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // If we haven't completed in a reasonable amount of time, give up. 484 // If we haven't completed in a reasonable amount of time, give up.
485 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutInSeconds), 485 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutInSeconds),
486 this, &SocketReader::CleanupAndDeleteSelf); 486 this, &SocketReader::CleanupAndDeleteSelf);
487 } 487 }
488 488
489 virtual ~SocketReader() { 489 virtual ~SocketReader() {
490 CloseSocket(fd_); 490 CloseSocket(fd_);
491 } 491 }
492 492
493 // MessageLoopForIO::Watcher impl. 493 // MessageLoopForIO::Watcher impl.
494 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 494 virtual void OnFileCanReadWithoutBlocking(int fd) override;
495 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { 495 virtual void OnFileCanWriteWithoutBlocking(int fd) override {
496 // SocketReader only watches for accept (read) events. 496 // SocketReader only watches for accept (read) events.
497 NOTREACHED(); 497 NOTREACHED();
498 } 498 }
499 499
500 // Finish handling the incoming message by optionally sending back an ACK 500 // Finish handling the incoming message by optionally sending back an ACK
501 // message and removing this SocketReader. 501 // message and removing this SocketReader.
502 void FinishWithACK(const char *message, size_t length); 502 void FinishWithACK(const char *message, size_t length);
503 503
504 private: 504 private:
505 void CleanupAndDeleteSelf() { 505 void CleanupAndDeleteSelf() {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 void StartListening(int socket); 543 void StartListening(int socket);
544 544
545 // This method determines if we should use the same process and if we should, 545 // This method determines if we should use the same process and if we should,
546 // opens a new browser tab. This runs on the UI thread. 546 // opens a new browser tab. This runs on the UI thread.
547 // |reader| is for sending back ACK message. 547 // |reader| is for sending back ACK message.
548 void HandleMessage(const std::string& current_dir, 548 void HandleMessage(const std::string& current_dir,
549 const std::vector<std::string>& argv, 549 const std::vector<std::string>& argv,
550 SocketReader* reader); 550 SocketReader* reader);
551 551
552 // MessageLoopForIO::Watcher impl. These run on the IO thread. 552 // MessageLoopForIO::Watcher impl. These run on the IO thread.
553 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; 553 virtual void OnFileCanReadWithoutBlocking(int fd) override;
554 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE { 554 virtual void OnFileCanWriteWithoutBlocking(int fd) override {
555 // ProcessSingleton only watches for accept (read) events. 555 // ProcessSingleton only watches for accept (read) events.
556 NOTREACHED(); 556 NOTREACHED();
557 } 557 }
558 558
559 // MessageLoop::DestructionObserver 559 // MessageLoop::DestructionObserver
560 virtual void WillDestroyCurrentMessageLoop() OVERRIDE { 560 virtual void WillDestroyCurrentMessageLoop() override {
561 fd_watcher_.StopWatchingFileDescriptor(); 561 fd_watcher_.StopWatchingFileDescriptor();
562 } 562 }
563 563
564 private: 564 private:
565 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; 565 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
566 friend class base::DeleteHelper<ProcessSingleton::LinuxWatcher>; 566 friend class base::DeleteHelper<ProcessSingleton::LinuxWatcher>;
567 567
568 virtual ~LinuxWatcher() { 568 virtual ~LinuxWatcher() {
569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 569 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
570 STLDeleteElements(&readers_); 570 STLDeleteElements(&readers_);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 } 1069 }
1070 1070
1071 void ProcessSingleton::KillProcess(int pid) { 1071 void ProcessSingleton::KillProcess(int pid) {
1072 // TODO(james.su@gmail.com): Is SIGKILL ok? 1072 // TODO(james.su@gmail.com): Is SIGKILL ok?
1073 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); 1073 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL);
1074 // ESRCH = No Such Process (can happen if the other process is already in 1074 // ESRCH = No Such Process (can happen if the other process is already in
1075 // progress of shutting down and finishes before we try to kill it). 1075 // progress of shutting down and finishes before we try to kill it).
1076 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " 1076 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: "
1077 << safe_strerror(errno); 1077 << safe_strerror(errno);
1078 } 1078 }
OLDNEW
« no previous file with comments | « chrome/browser/process_singleton_browsertest.cc ('k') | chrome/browser/profile_resetter/automatic_profile_resetter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698