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

Side by Side Diff: content/browser/gpu/gpu_internals_ui.cc

Issue 1000373002: favor DCHECK_CURRENTLY_ON for better logs in content/browser/[f-p]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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
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 "content/browser/gpu/gpu_internals_ui.h" 5 #include "content/browser/gpu/gpu_internals_ui.h"
6 6
7 #if defined(OS_LINUX) && defined(USE_X11) 7 #if defined(OS_LINUX) && defined(USE_X11)
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 #endif 9 #endif
10 10
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 : observing_(false) { 269 : observing_(false) {
270 } 270 }
271 271
272 GpuMessageHandler::~GpuMessageHandler() { 272 GpuMessageHandler::~GpuMessageHandler() {
273 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this); 273 ui::GpuSwitchingManager::GetInstance()->RemoveObserver(this);
274 GpuDataManagerImpl::GetInstance()->RemoveObserver(this); 274 GpuDataManagerImpl::GetInstance()->RemoveObserver(this);
275 } 275 }
276 276
277 /* BrowserBridge.callAsync prepends a requestID to these messages. */ 277 /* BrowserBridge.callAsync prepends a requestID to these messages. */
278 void GpuMessageHandler::RegisterMessages() { 278 void GpuMessageHandler::RegisterMessages() {
279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 279 DCHECK_CURRENTLY_ON(BrowserThread::UI);
280 280
281 web_ui()->RegisterMessageCallback("browserBridgeInitialized", 281 web_ui()->RegisterMessageCallback("browserBridgeInitialized",
282 base::Bind(&GpuMessageHandler::OnBrowserBridgeInitialized, 282 base::Bind(&GpuMessageHandler::OnBrowserBridgeInitialized,
283 base::Unretained(this))); 283 base::Unretained(this)));
284 web_ui()->RegisterMessageCallback("callAsync", 284 web_ui()->RegisterMessageCallback("callAsync",
285 base::Bind(&GpuMessageHandler::OnCallAsync, 285 base::Bind(&GpuMessageHandler::OnCallAsync,
286 base::Unretained(this))); 286 base::Unretained(this)));
287 } 287 }
288 288
289 void GpuMessageHandler::OnCallAsync(const base::ListValue* args) { 289 void GpuMessageHandler::OnCallAsync(const base::ListValue* args) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 *ret); 328 *ret);
329 delete ret; 329 delete ret;
330 } else { 330 } else {
331 web_ui()->CallJavascriptFunction("browserBridge.onCallAsyncReply", 331 web_ui()->CallJavascriptFunction("browserBridge.onCallAsyncReply",
332 *requestId); 332 *requestId);
333 } 333 }
334 } 334 }
335 335
336 void GpuMessageHandler::OnBrowserBridgeInitialized( 336 void GpuMessageHandler::OnBrowserBridgeInitialized(
337 const base::ListValue* args) { 337 const base::ListValue* args) {
338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 338 DCHECK_CURRENTLY_ON(BrowserThread::UI);
339 339
340 // Watch for changes in GPUInfo 340 // Watch for changes in GPUInfo
341 if (!observing_) { 341 if (!observing_) {
342 GpuDataManagerImpl::GetInstance()->AddObserver(this); 342 GpuDataManagerImpl::GetInstance()->AddObserver(this);
343 ui::GpuSwitchingManager::GetInstance()->AddObserver(this); 343 ui::GpuSwitchingManager::GetInstance()->AddObserver(this);
344 } 344 }
345 observing_ = true; 345 observing_ = true;
346 346
347 // Tell GpuDataManager it should have full GpuInfo. If the 347 // Tell GpuDataManager it should have full GpuInfo. If the
348 // Gpu process has not run yet, this will trigger its launch. 348 // Gpu process has not run yet, this will trigger its launch.
349 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded(); 349 GpuDataManagerImpl::GetInstance()->RequestCompleteGpuInfoIfNeeded();
350 350
351 // Run callback immediately in case the info is ready and no update in the 351 // Run callback immediately in case the info is ready and no update in the
352 // future. 352 // future.
353 OnGpuInfoUpdate(); 353 OnGpuInfoUpdate();
354 } 354 }
355 355
356 base::Value* GpuMessageHandler::OnRequestClientInfo( 356 base::Value* GpuMessageHandler::OnRequestClientInfo(
357 const base::ListValue* list) { 357 const base::ListValue* list) {
358 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 358 DCHECK_CURRENTLY_ON(BrowserThread::UI);
359 359
360 base::DictionaryValue* dict = new base::DictionaryValue(); 360 base::DictionaryValue* dict = new base::DictionaryValue();
361 361
362 dict->SetString("version", GetContentClient()->GetProduct()); 362 dict->SetString("version", GetContentClient()->GetProduct());
363 dict->SetString("command_line", 363 dict->SetString("command_line",
364 base::CommandLine::ForCurrentProcess()->GetCommandLineString()); 364 base::CommandLine::ForCurrentProcess()->GetCommandLineString());
365 dict->SetString("operating_system", 365 dict->SetString("operating_system",
366 base::SysInfo::OperatingSystemName() + " " + 366 base::SysInfo::OperatingSystemName() + " " +
367 base::SysInfo::OperatingSystemVersion()); 367 base::SysInfo::OperatingSystemVersion());
368 dict->SetString("angle_commit_id", ANGLE_COMMIT_HASH); 368 dict->SetString("angle_commit_id", ANGLE_COMMIT_HASH);
369 dict->SetString("graphics_backend", "Skia"); 369 dict->SetString("graphics_backend", "Skia");
370 dict->SetString("blacklist_version", 370 dict->SetString("blacklist_version",
371 GpuDataManagerImpl::GetInstance()->GetBlacklistVersion()); 371 GpuDataManagerImpl::GetInstance()->GetBlacklistVersion());
372 dict->SetString("driver_bug_list_version", 372 dict->SetString("driver_bug_list_version",
373 GpuDataManagerImpl::GetInstance()->GetDriverBugListVersion()); 373 GpuDataManagerImpl::GetInstance()->GetDriverBugListVersion());
374 374
375 return dict; 375 return dict;
376 } 376 }
377 377
378 base::Value* GpuMessageHandler::OnRequestLogMessages(const base::ListValue*) { 378 base::Value* GpuMessageHandler::OnRequestLogMessages(const base::ListValue*) {
379 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 379 DCHECK_CURRENTLY_ON(BrowserThread::UI);
380 380
381 return GpuDataManagerImpl::GetInstance()->GetLogMessages(); 381 return GpuDataManagerImpl::GetInstance()->GetLogMessages();
382 } 382 }
383 383
384 void GpuMessageHandler::OnGpuInfoUpdate() { 384 void GpuMessageHandler::OnGpuInfoUpdate() {
385 // Get GPU Info. 385 // Get GPU Info.
386 scoped_ptr<base::DictionaryValue> gpu_info_val(GpuInfoAsDictionaryValue()); 386 scoped_ptr<base::DictionaryValue> gpu_info_val(GpuInfoAsDictionaryValue());
387 387
388 388
389 // Add in blacklisting features 389 // Add in blacklisting features
(...skipping 28 matching lines...) Expand all
418 : WebUIController(web_ui) { 418 : WebUIController(web_ui) {
419 web_ui->AddMessageHandler(new GpuMessageHandler()); 419 web_ui->AddMessageHandler(new GpuMessageHandler());
420 420
421 // Set up the chrome://gpu/ source. 421 // Set up the chrome://gpu/ source.
422 BrowserContext* browser_context = 422 BrowserContext* browser_context =
423 web_ui->GetWebContents()->GetBrowserContext(); 423 web_ui->GetWebContents()->GetBrowserContext();
424 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource()); 424 WebUIDataSource::Add(browser_context, CreateGpuHTMLSource());
425 } 425 }
426 426
427 } // namespace content 427 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698