OLD | NEW |
---|---|
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 "content/browser/devtools/protocol/system_info_handler.h" | 5 #include "content/browser/devtools/protocol/system_info_handler.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/command_line.h" | |
11 #include "content/browser/gpu/compositor_util.h" | 12 #include "content/browser/gpu/compositor_util.h" |
12 #include "content/public/browser/gpu_data_manager.h" | 13 #include "content/public/browser/gpu_data_manager.h" |
14 #include "gpu/config/gpu_feature_type.h" | |
13 #include "gpu/config/gpu_info.h" | 15 #include "gpu/config/gpu_info.h" |
16 #include "gpu/config/gpu_switches.h" | |
14 | 17 |
15 namespace content { | 18 namespace content { |
16 namespace devtools { | 19 namespace devtools { |
17 namespace system_info { | 20 namespace system_info { |
18 | 21 |
19 namespace { | 22 namespace { |
20 | 23 |
21 using Response = DevToolsProtocolClient::Response; | 24 using Response = DevToolsProtocolClient::Response; |
22 | 25 |
23 // Give the GPU process a few seconds to provide GPU info. | 26 // Give the GPU process a few seconds to provide GPU info. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 } | 143 } |
141 | 144 |
142 SystemInfoHandler::~SystemInfoHandler() { | 145 SystemInfoHandler::~SystemInfoHandler() { |
143 } | 146 } |
144 | 147 |
145 void SystemInfoHandler::SetClient(scoped_ptr<Client> client) { | 148 void SystemInfoHandler::SetClient(scoped_ptr<Client> client) { |
146 client_.swap(client); | 149 client_.swap(client); |
147 } | 150 } |
148 | 151 |
149 Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) { | 152 Response SystemInfoHandler::GetInfo(DevToolsCommandId command_id) { |
153 bool skip_request_collection = false; | |
154 #if defined(OS_LINUX) | |
155 skip_request_collection = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
156 switches::kGpuTestingNoCompleteInfoCollection); | |
157 for (int feature = 0; feature < gpu::NUMBER_OF_GPU_FEATURE_TYPES; ++feature) { | |
Zhenyao Mo
2016/02/02 22:22:34
I don't think this for-loop logic is necessary. I
| |
158 skip_request_collection &= | |
159 GpuDataManager::GetInstance()->IsFeatureBlacklisted(feature); | |
160 if (!skip_request_collection) | |
161 break; | |
162 } | |
163 #endif | |
164 | |
150 std::string reason; | 165 std::string reason; |
151 if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) || | 166 if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) || |
152 GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable()) { | 167 GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable() || |
168 skip_request_collection) { | |
153 // The GpuDataManager already has all of the information needed to make | 169 // The GpuDataManager already has all of the information needed to make |
154 // GPU-based blacklisting decisions. Post a task to give it to the | 170 // GPU-based blacklisting decisions. Post a task to give it to the |
155 // client asynchronously. | 171 // client asynchronously. |
156 // | 172 // |
157 // Waiting for complete GPU info in the if-test above seems to | 173 // Waiting for complete GPU info in the if-test above seems to |
158 // frequently hit internal timeouts in the launching of the unsandboxed | 174 // frequently hit internal timeouts in the launching of the unsandboxed |
159 // GPU process in debug builds on Windows. | 175 // GPU process in debug builds on Windows. |
160 BrowserThread::PostTask( | 176 BrowserThread::PostTask( |
161 BrowserThread::UI, | 177 BrowserThread::UI, |
162 FROM_HERE, | 178 FROM_HERE, |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 SendGetInfoResponse(command_id); | 244 SendGetInfoResponse(command_id); |
229 // For the time being we want to know about this event in the test logs. | 245 // For the time being we want to know about this event in the test logs. |
230 LOG(ERROR) << "SystemInfoHandler: request for GPU info timed out!" | 246 LOG(ERROR) << "SystemInfoHandler: request for GPU info timed out!" |
231 << " Most recent info sent."; | 247 << " Most recent info sent."; |
232 } | 248 } |
233 } | 249 } |
234 | 250 |
235 } // namespace system_info | 251 } // namespace system_info |
236 } // namespace devtools | 252 } // namespace devtools |
237 } // namespace content | 253 } // namespace content |
OLD | NEW |