OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/gpu_internals_ui.h" | 5 #include "chrome/browser/dom_ui/gpu_internals_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 basic_info->Append(NewDescriptionValuePair("GL_RENDERER", | 294 basic_info->Append(NewDescriptionValuePair("GL_RENDERER", |
295 gpu_info.gl_renderer())); | 295 gpu_info.gl_renderer())); |
296 basic_info->Append(NewDescriptionValuePair("GL_VERSION", | 296 basic_info->Append(NewDescriptionValuePair("GL_VERSION", |
297 gpu_info.gl_version_string())); | 297 gpu_info.gl_version_string())); |
298 basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", | 298 basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", |
299 gpu_info.gl_extensions())); | 299 gpu_info.gl_extensions())); |
300 | 300 |
301 DictionaryValue* info = new DictionaryValue(); | 301 DictionaryValue* info = new DictionaryValue(); |
302 info->Set("basic_info", basic_info); | 302 info->Set("basic_info", basic_info); |
303 | 303 |
304 if (gpu_info.level() == GPUInfo::kPartial) { | 304 if (gpu_info.progress() == GPUInfo::kPartial) { |
305 info->SetString("level", "partial"); | 305 info->SetString("progress", "partial"); |
306 } else { | 306 } else { |
307 info->SetString("level", "complete"); | 307 info->SetString("progress", "complete"); |
308 } | 308 } |
309 #if defined(OS_WIN) | 309 #if defined(OS_WIN) |
310 if (gpu_info.level() == GPUInfo::kComplete) { | 310 if (gpu_info.progress() == GPUInfo::kComplete) { |
311 ListValue* dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics()); | 311 ListValue* dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics()); |
312 info->Set("diagnostics", dx_info); | 312 info->Set("diagnostics", dx_info); |
313 } | 313 } |
314 #endif | 314 #endif |
315 | 315 |
316 return info; | 316 return info; |
317 } | 317 } |
318 | 318 |
319 Value* GpuMessageHandler::OnRequestGpuInfo(const ListValue* list) { | 319 Value* GpuMessageHandler::OnRequestGpuInfo(const ListValue* list) { |
320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 320 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
321 | 321 |
322 // Get GPU Info. | 322 // Get GPU Info. |
323 GPUInfo gpu_info = GpuProcessHostUIShim::GetInstance()->gpu_info(); | 323 GPUInfo gpu_info = GpuProcessHostUIShim::GetInstance()->gpu_info(); |
324 | 324 |
325 std::string html; | 325 std::string html; |
326 if (gpu_info.level() != GPUInfo::kComplete) { | 326 if (gpu_info.progress() != GPUInfo::kComplete) { |
327 GpuProcessHostUIShim::GetInstance()->CollectGraphicsInfoAsynchronously( | 327 GpuProcessHostUIShim::GetInstance()->CollectGraphicsInfoAsynchronously(); |
328 GPUInfo::kComplete); | |
329 } | 328 } |
330 | 329 |
331 if (gpu_info.level() != GPUInfo::kUninitialized) { | 330 if (gpu_info.progress() != GPUInfo::kUninitialized) { |
332 return GpuInfoToDict(gpu_info); | 331 return GpuInfoToDict(gpu_info); |
333 } else { | 332 } else { |
334 return NULL; | 333 return NULL; |
335 } | 334 } |
336 } | 335 } |
337 | 336 |
338 } // namespace | 337 } // namespace |
339 | 338 |
340 | 339 |
341 //////////////////////////////////////////////////////////////////////////////// | 340 //////////////////////////////////////////////////////////////////////////////// |
342 // | 341 // |
343 // GpuInternalsUI | 342 // GpuInternalsUI |
344 // | 343 // |
345 //////////////////////////////////////////////////////////////////////////////// | 344 //////////////////////////////////////////////////////////////////////////////// |
346 | 345 |
347 GpuInternalsUI::GpuInternalsUI(TabContents* contents) : DOMUI(contents) { | 346 GpuInternalsUI::GpuInternalsUI(TabContents* contents) : DOMUI(contents) { |
348 AddMessageHandler((new GpuMessageHandler())->Attach(this)); | 347 AddMessageHandler((new GpuMessageHandler())->Attach(this)); |
349 | 348 |
350 GpuHTMLSource* html_source = new GpuHTMLSource(); | 349 GpuHTMLSource* html_source = new GpuHTMLSource(); |
351 | 350 |
352 // Set up the chrome://gpu/ source. | 351 // Set up the chrome://gpu/ source. |
353 BrowserThread::PostTask( | 352 BrowserThread::PostTask( |
354 BrowserThread::IO, FROM_HERE, | 353 BrowserThread::IO, FROM_HERE, |
355 NewRunnableMethod( | 354 NewRunnableMethod( |
356 ChromeURLDataManager::GetInstance(), | 355 ChromeURLDataManager::GetInstance(), |
357 &ChromeURLDataManager::AddDataSource, | 356 &ChromeURLDataManager::AddDataSource, |
358 make_scoped_refptr(html_source))); | 357 make_scoped_refptr(html_source))); |
359 } | 358 } |
360 | 359 |
OLD | NEW |