| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/chrome_browser_main_posix.h" | 5 #include "chrome/browser/chrome_browser_main_posix.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <limits.h> | 8 #include <limits.h> |
| 9 #include <pthread.h> | 9 #include <pthread.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // ExitHandler takes care of servicing an exit (from a signal) at the | 88 // ExitHandler takes care of servicing an exit (from a signal) at the |
| 89 // appropriate time. Specifically if we get an exit and have not finished | 89 // appropriate time. Specifically if we get an exit and have not finished |
| 90 // session restore we delay the exit. To do otherwise means we're exiting part | 90 // session restore we delay the exit. To do otherwise means we're exiting part |
| 91 // way through startup which causes all sorts of problems. | 91 // way through startup which causes all sorts of problems. |
| 92 class ExitHandler : public content::NotificationObserver { | 92 class ExitHandler : public content::NotificationObserver { |
| 93 public: | 93 public: |
| 94 // Invokes exit when appropriate. | 94 // Invokes exit when appropriate. |
| 95 static void ExitWhenPossibleOnUIThread(); | 95 static void ExitWhenPossibleOnUIThread(); |
| 96 | 96 |
| 97 // Overridden from content::NotificationObserver: | 97 // Overridden from content::NotificationObserver: |
| 98 virtual void Observe(int type, | 98 void Observe(int type, |
| 99 const content::NotificationSource& source, | 99 const content::NotificationSource& source, |
| 100 const content::NotificationDetails& details) override; | 100 const content::NotificationDetails& details) override; |
| 101 | 101 |
| 102 private: | 102 private: |
| 103 ExitHandler(); | 103 ExitHandler(); |
| 104 virtual ~ExitHandler(); | 104 ~ExitHandler() override; |
| 105 | 105 |
| 106 // Does the appropriate call to Exit. | 106 // Does the appropriate call to Exit. |
| 107 static void Exit(); | 107 static void Exit(); |
| 108 | 108 |
| 109 content::NotificationRegistrar registrar_; | 109 content::NotificationRegistrar registrar_; |
| 110 | 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(ExitHandler); | 111 DISALLOW_COPY_AND_ASSIGN(ExitHandler); |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 // static | 114 // static |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 chrome::ExitCleanly(); | 151 chrome::ExitCleanly(); |
| 152 #else | 152 #else |
| 153 chrome::AttemptExit(); | 153 chrome::AttemptExit(); |
| 154 #endif | 154 #endif |
| 155 } | 155 } |
| 156 | 156 |
| 157 class ShutdownDetector : public base::PlatformThread::Delegate { | 157 class ShutdownDetector : public base::PlatformThread::Delegate { |
| 158 public: | 158 public: |
| 159 explicit ShutdownDetector(int shutdown_fd); | 159 explicit ShutdownDetector(int shutdown_fd); |
| 160 | 160 |
| 161 virtual void ThreadMain() override; | 161 void ThreadMain() override; |
| 162 | 162 |
| 163 private: | 163 private: |
| 164 const int shutdown_fd_; | 164 const int shutdown_fd_; |
| 165 | 165 |
| 166 DISALLOW_COPY_AND_ASSIGN(ShutdownDetector); | 166 DISALLOW_COPY_AND_ASSIGN(ShutdownDetector); |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 ShutdownDetector::ShutdownDetector(int shutdown_fd) | 169 ShutdownDetector::ShutdownDetector(int shutdown_fd) |
| 170 : shutdown_fd_(shutdown_fd) { | 170 : shutdown_fd_(shutdown_fd) { |
| 171 CHECK_NE(shutdown_fd_, -1); | 171 CHECK_NE(shutdown_fd_, -1); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Not called on Mac because we load the locale files differently. | 316 // Not called on Mac because we load the locale files differently. |
| 317 NOTREACHED(); | 317 NOTREACHED(); |
| 318 #elif defined(USE_AURA) | 318 #elif defined(USE_AURA) |
| 319 // TODO(port): We may want a views based message dialog here eventually, but | 319 // TODO(port): We may want a views based message dialog here eventually, but |
| 320 // for now, crash. | 320 // for now, crash. |
| 321 NOTREACHED(); | 321 NOTREACHED(); |
| 322 #else | 322 #else |
| 323 #error "Need MessageBox implementation." | 323 #error "Need MessageBox implementation." |
| 324 #endif | 324 #endif |
| 325 } | 325 } |
| OLD | NEW |