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

Side by Side Diff: content/browser/devtools/protocol/system_info_handler.cc

Issue 2590293003: [DevTools] Rework DevToolsSession interaction with domain handlers. (Closed)
Patch Set: includes Created 3 years, 12 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 "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 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 GpuDataManager::GetInstance()->RemoveObserver(this); 167 GpuDataManager::GetInstance()->RemoveObserver(this);
168 SendGetInfoResponse(std::move(callback_)); 168 SendGetInfoResponse(std::move(callback_));
169 delete this; 169 delete this;
170 } 170 }
171 171
172 private: 172 private:
173 std::unique_ptr<GetInfoCallback> callback_; 173 std::unique_ptr<GetInfoCallback> callback_;
174 base::WeakPtrFactory<SystemInfoHandlerGpuObserver> weak_factory_; 174 base::WeakPtrFactory<SystemInfoHandlerGpuObserver> weak_factory_;
175 }; 175 };
176 176
177 SystemInfoHandler::SystemInfoHandler() { 177 SystemInfoHandler::SystemInfoHandler()
178 : DevToolsDomainHandler(SystemInfo::Metainfo::domainName) {
178 } 179 }
179 180
180 SystemInfoHandler::~SystemInfoHandler() { 181 SystemInfoHandler::~SystemInfoHandler() {
181 } 182 }
182 183
183 void SystemInfoHandler::Wire(UberDispatcher* dispatcher) { 184 void SystemInfoHandler::Wire(UberDispatcher* dispatcher) {
184 SystemInfo::Dispatcher::wire(dispatcher, this); 185 SystemInfo::Dispatcher::wire(dispatcher, this);
185 } 186 }
186 187
187 Response SystemInfoHandler::Disable() {
188 return Response::OK();
189 }
190
191 void SystemInfoHandler::GetInfo( 188 void SystemInfoHandler::GetInfo(
192 std::unique_ptr<GetInfoCallback> callback) { 189 std::unique_ptr<GetInfoCallback> callback) {
193 std::string reason; 190 std::string reason;
194 if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) || 191 if (!GpuDataManager::GetInstance()->GpuAccessAllowed(&reason) ||
195 GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable() || 192 GpuDataManager::GetInstance()->IsEssentialGpuInfoAvailable() ||
196 base::CommandLine::ForCurrentProcess()->HasSwitch( 193 base::CommandLine::ForCurrentProcess()->HasSwitch(
197 switches::kGpuTestingNoCompleteInfoCollection)) { 194 switches::kGpuTestingNoCompleteInfoCollection)) {
198 // The GpuDataManager already has all of the information needed to make 195 // The GpuDataManager already has all of the information needed to make
199 // GPU-based blacklisting decisions. Post a task to give it to the 196 // GPU-based blacklisting decisions. Post a task to give it to the
200 // client asynchronously. 197 // client asynchronously.
201 // 198 //
202 // Waiting for complete GPU info in the if-test above seems to 199 // Waiting for complete GPU info in the if-test above seems to
203 // frequently hit internal timeouts in the launching of the unsandboxed 200 // frequently hit internal timeouts in the launching of the unsandboxed
204 // GPU process in debug builds on Windows. 201 // GPU process in debug builds on Windows.
205 BrowserThread::PostTask( 202 BrowserThread::PostTask(
206 BrowserThread::UI, 203 BrowserThread::UI,
207 FROM_HERE, 204 FROM_HERE,
208 base::Bind(&SendGetInfoResponse, base::Passed(std::move(callback)))); 205 base::Bind(&SendGetInfoResponse, base::Passed(std::move(callback))));
209 } else { 206 } else {
210 // We will be able to get more information from the GpuDataManager. 207 // We will be able to get more information from the GpuDataManager.
211 // Register a transient observer with it to call us back when the 208 // Register a transient observer with it to call us back when the
212 // information is available. 209 // information is available.
213 new SystemInfoHandlerGpuObserver(std::move(callback)); 210 new SystemInfoHandlerGpuObserver(std::move(callback));
214 } 211 }
215 } 212 }
216 213
217 } // namespace protocol 214 } // namespace protocol
218 } // namespace content 215 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/devtools/protocol/system_info_handler.h ('k') | content/browser/devtools/protocol/target_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698