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

Side by Side Diff: remoting/host/curtain_mode_mac.cc

Issue 1026553005: Add logging to CHECK failure during curtain-mode on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "remoting/host/curtain_mode.h" 5 #include "remoting/host/curtain_mode.h"
6 6
7 #include <ApplicationServices/ApplicationServices.h> 7 #include <ApplicationServices/ApplicationServices.h>
8 #include <Carbon/Carbon.h> 8 #include <Carbon/Carbon.h>
9 #include <Security/Security.h> 9 #include <Security/Security.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 base::ScopedCFTypeRef<CFDictionaryRef> session( 137 base::ScopedCFTypeRef<CFDictionaryRef> session(
138 CGSessionCopyCurrentDictionary()); 138 CGSessionCopyCurrentDictionary());
139 139
140 // CGSessionCopyCurrentDictionary has been observed to return nullptr in some 140 // CGSessionCopyCurrentDictionary has been observed to return nullptr in some
141 // cases. Once the system is in this state, curtain mode will fail as the 141 // cases. Once the system is in this state, curtain mode will fail as the
142 // CGSession command thinks the session is not attached to the console. The 142 // CGSession command thinks the session is not attached to the console. The
143 // only known remedy is logout or reboot. Since we're not sure what causes 143 // only known remedy is logout or reboot. Since we're not sure what causes
144 // this, or how common it is, a crash report is useful in this case (note 144 // this, or how common it is, a crash report is useful in this case (note
145 // that the connection would have to be refused in any case, so this is no 145 // that the connection would have to be refused in any case, so this is no
146 // loss of functionality). 146 // loss of functionality).
147 CHECK(session != nullptr); 147 CHECK(session != nullptr)
148 << "Error activating curtain-mode: "
149 << "CGSessionCopyCurrentDictionary() returned NULL.";
Jamie 2015/03/24 19:24:47 Can you add a message to the effect that logging o
148 150
149 const void* on_console = CFDictionaryGetValue(session, 151 const void* on_console = CFDictionaryGetValue(session,
150 kCGSessionOnConsoleKey); 152 kCGSessionOnConsoleKey);
151 const void* logged_in = CFDictionaryGetValue(session, kCGSessionLoginDoneKey); 153 const void* logged_in = CFDictionaryGetValue(session, kCGSessionLoginDoneKey);
152 if (logged_in == kCFBooleanTrue && on_console == kCFBooleanTrue) { 154 if (logged_in == kCFBooleanTrue && on_console == kCFBooleanTrue) {
153 pid_t child = fork(); 155 pid_t child = fork();
154 if (child == 0) { 156 if (child == 0) {
155 execl(kCGSessionPath, kCGSessionPath, "-suspend", nullptr); 157 execl(kCGSessionPath, kCGSessionPath, "-suspend", nullptr);
156 _exit(1); 158 _exit(1);
157 } else if (child > 0) { 159 } else if (child > 0) {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // static 260 // static
259 scoped_ptr<CurtainMode> CurtainMode::Create( 261 scoped_ptr<CurtainMode> CurtainMode::Create(
260 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, 262 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
261 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, 263 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
262 base::WeakPtr<ClientSessionControl> client_session_control) { 264 base::WeakPtr<ClientSessionControl> client_session_control) {
263 return make_scoped_ptr(new CurtainModeMac( 265 return make_scoped_ptr(new CurtainModeMac(
264 caller_task_runner, ui_task_runner, client_session_control)); 266 caller_task_runner, ui_task_runner, client_session_control));
265 } 267 }
266 268
267 } // namespace remoting 269 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698