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

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

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "base/time/time.h" 75 #include "base/time/time.h"
76 #include "base/timer/timer.h" 76 #include "base/timer/timer.h"
77 #include "chrome/browser/ui/process_singleton_dialog_linux.h" 77 #include "chrome/browser/ui/process_singleton_dialog_linux.h"
78 #include "chrome/common/chrome_constants.h" 78 #include "chrome/common/chrome_constants.h"
79 #include "content/public/browser/browser_thread.h" 79 #include "content/public/browser/browser_thread.h"
80 #include "grit/chromium_strings.h" 80 #include "grit/chromium_strings.h"
81 #include "grit/generated_resources.h" 81 #include "grit/generated_resources.h"
82 #include "net/base/net_util.h" 82 #include "net/base/net_util.h"
83 #include "ui/base/l10n/l10n_util.h" 83 #include "ui/base/l10n/l10n_util.h"
84 84
85 #if defined(TOOLKIT_GTK)
86 #include <gdk/gdk.h>
87 #endif
88 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) 85 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)
89 #include "ui/views/linux_ui/linux_ui.h" 86 #include "ui/views/linux_ui/linux_ui.h"
90 #endif 87 #endif
91 88
92 using content::BrowserThread; 89 using content::BrowserThread;
93 90
94 const int ProcessSingleton::kTimeoutInSeconds; 91 const int ProcessSingleton::kTimeoutInSeconds;
95 92
96 namespace { 93 namespace {
97 94
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 if (!kill_unresponsive || !KillProcessByLockPath()) 805 if (!kill_unresponsive || !KillProcessByLockPath())
809 return PROFILE_IN_USE; 806 return PROFILE_IN_USE;
810 return PROCESS_NONE; 807 return PROCESS_NONE;
811 } 808 }
812 809
813 buf[len] = '\0'; 810 buf[len] = '\0';
814 if (strncmp(buf, kShutdownToken, arraysize(kShutdownToken) - 1) == 0) { 811 if (strncmp(buf, kShutdownToken, arraysize(kShutdownToken) - 1) == 0) {
815 // The other process is shutting down, it's safe to start a new process. 812 // The other process is shutting down, it's safe to start a new process.
816 return PROCESS_NONE; 813 return PROCESS_NONE;
817 } else if (strncmp(buf, kACKToken, arraysize(kACKToken) - 1) == 0) { 814 } else if (strncmp(buf, kACKToken, arraysize(kACKToken) - 1) == 0) {
818 #if defined(TOOLKIT_GTK)
819 // Notify the window manager that we've started up; if we do not open a
820 // window, GTK will not automatically call this for us.
821 gdk_notify_startup_complete();
822 #endif
823 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS) 815 #if defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)
824 // Likely NULL in unit tests. 816 // Likely NULL in unit tests.
825 views::LinuxUI* linux_ui = views::LinuxUI::instance(); 817 views::LinuxUI* linux_ui = views::LinuxUI::instance();
826 if (linux_ui) 818 if (linux_ui)
827 linux_ui->NotifyWindowManagerStartupComplete(); 819 linux_ui->NotifyWindowManagerStartupComplete();
828 #endif 820 #endif
829 821
830 // Assume the other process is handling the request. 822 // Assume the other process is handling the request.
831 return PROCESS_NOTIFIED; 823 return PROCESS_NOTIFIED;
832 } 824 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 } 977 }
986 978
987 void ProcessSingleton::KillProcess(int pid) { 979 void ProcessSingleton::KillProcess(int pid) {
988 // TODO(james.su@gmail.com): Is SIGKILL ok? 980 // TODO(james.su@gmail.com): Is SIGKILL ok?
989 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL); 981 int rv = kill(static_cast<base::ProcessHandle>(pid), SIGKILL);
990 // ESRCH = No Such Process (can happen if the other process is already in 982 // ESRCH = No Such Process (can happen if the other process is already in
991 // progress of shutting down and finishes before we try to kill it). 983 // progress of shutting down and finishes before we try to kill it).
992 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: " 984 DCHECK(rv == 0 || errno == ESRCH) << "Error killing process: "
993 << safe_strerror(errno); 985 << safe_strerror(errno);
994 } 986 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698