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

Side by Side Diff: chrome/browser/chromeos/system/input_device_settings_impl_x11.cc

Issue 1049873005: [chrome/browser/chromeos/] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 #include "chrome/browser/chromeos/system/input_device_settings.h" 5 #include "chrome/browser/chromeos/system/input_device_settings.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (!ScriptExists(script)) 55 if (!ScriptExists(script))
56 return; 56 return;
57 57
58 base::Process process = 58 base::Process process =
59 base::LaunchProcess(base::CommandLine(argv), base::LaunchOptions()); 59 base::LaunchProcess(base::CommandLine(argv), base::LaunchOptions());
60 if (process.IsValid()) 60 if (process.IsValid())
61 base::EnsureProcessGetsReaped(process.Pid()); 61 base::EnsureProcessGetsReaped(process.Pid());
62 } 62 }
63 63
64 void ExecuteScript(const std::vector<std::string>& argv) { 64 void ExecuteScript(const std::vector<std::string>& argv) {
65 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 65 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
66 66
67 if (argv.size() == 1) 67 if (argv.size() == 1)
68 return; 68 return;
69 69
70 VLOG(1) << "About to launch: \"" 70 VLOG(1) << "About to launch: \""
71 << base::CommandLine(argv).GetCommandLineString() << "\""; 71 << base::CommandLine(argv).GetCommandLineString() << "\"";
72 72
73 // Control scripts can take long enough to cause SIGART during shutdown 73 // Control scripts can take long enough to cause SIGART during shutdown
74 // (http://crbug.com/261426). Run the blocking pool task with 74 // (http://crbug.com/261426). Run the blocking pool task with
75 // CONTINUE_ON_SHUTDOWN so it won't be joined when Chrome shuts down. 75 // CONTINUE_ON_SHUTDOWN so it won't be joined when Chrome shuts down.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 std::string output; 108 std::string output;
109 // Output is empty if the device is not found. 109 // Output is empty if the device is not found.
110 exists->data = 110 exists->data =
111 base::GetAppOutput(base::CommandLine(argv), &output) && !output.empty(); 111 base::GetAppOutput(base::CommandLine(argv), &output) && !output.empty();
112 DVLOG(1) << "DeviceExistsBlockingPool:" << device_type << "=" << exists->data; 112 DVLOG(1) << "DeviceExistsBlockingPool:" << device_type << "=" << exists->data;
113 } 113 }
114 114
115 void RunCallbackUIThread( 115 void RunCallbackUIThread(
116 scoped_refptr<RefCountedBool> exists, 116 scoped_refptr<RefCountedBool> exists,
117 const InputDeviceSettings::DeviceExistsCallback& callback) { 117 const InputDeviceSettings::DeviceExistsCallback& callback) {
118 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 118 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
119 DVLOG(1) << "RunCallbackUIThread " << exists->data; 119 DVLOG(1) << "RunCallbackUIThread " << exists->data;
120 callback.Run(exists->data); 120 callback.Run(exists->data);
121 } 121 }
122 122
123 void DeviceExists(const char* script, 123 void DeviceExists(const char* script,
124 const InputDeviceSettings::DeviceExistsCallback& callback) { 124 const InputDeviceSettings::DeviceExistsCallback& callback) {
125 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 125 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
126 126
127 // One or both of the control scripts can apparently hang during shutdown 127 // One or both of the control scripts can apparently hang during shutdown
128 // (http://crbug.com/255546). Run the blocking pool task with 128 // (http://crbug.com/255546). Run the blocking pool task with
129 // CONTINUE_ON_SHUTDOWN so it won't be joined when Chrome shuts down. 129 // CONTINUE_ON_SHUTDOWN so it won't be joined when Chrome shuts down.
130 scoped_refptr<RefCountedBool> exists(new RefCountedBool(false)); 130 scoped_refptr<RefCountedBool> exists(new RefCountedBool(false));
131 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); 131 base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
132 scoped_refptr<base::TaskRunner> runner = 132 scoped_refptr<base::TaskRunner> runner =
133 pool->GetTaskRunnerWithShutdownBehavior( 133 pool->GetTaskRunnerWithShutdownBehavior(
134 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN); 134 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN);
135 runner->PostTaskAndReply( 135 runner->PostTaskAndReply(
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 void InputDeviceSettings::SetSettingsForTesting( 315 void InputDeviceSettings::SetSettingsForTesting(
316 InputDeviceSettings* test_settings) { 316 InputDeviceSettings* test_settings) {
317 if (g_test_instance == test_settings) 317 if (g_test_instance == test_settings)
318 return; 318 return;
319 delete g_test_instance; 319 delete g_test_instance;
320 g_test_instance = test_settings; 320 g_test_instance = test_settings;
321 } 321 }
322 322
323 } // namespace system 323 } // namespace system
324 } // namespace chromeos 324 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698