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

Unified Diff: content/browser/gpu/gpu_data_manager.cc

Issue 7555005: Moving the contents of chrome://gpu Profiling to chrome://tracing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/gpu/gpu_data_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/gpu_data_manager.cc
diff --git a/content/browser/gpu/gpu_data_manager.cc b/content/browser/gpu/gpu_data_manager.cc
index 079191a9e2757d8b83f9db82f5bd0b94660e26a5..779ca26ac02de33a3def72e913633bc319e1821e 100644
--- a/content/browser/gpu/gpu_data_manager.cc
+++ b/content/browser/gpu/gpu_data_manager.cc
@@ -40,6 +40,45 @@ void DisplayReconfigCallback(CGDirectDisplayID display,
}
#endif
+DictionaryValue* NewDescriptionValuePair(const std::string& desc,
+ const std::string& value) {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("description", desc);
+ dict->SetString("value", value);
+ return dict;
+}
+
+DictionaryValue* NewDescriptionValuePair(const std::string& desc,
+ Value* value) {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("description", desc);
+ dict->Set("value", value);
+ return dict;
+}
+
+#if defined(OS_WIN)
+// Output DxDiagNode tree as nested array of {description,value} pairs
+ListValue* DxDiagNodeToList(const DxDiagNode& node) {
+ ListValue* list = new ListValue();
+ for (std::map<std::string, std::string>::const_iterator it =
+ node.values.begin();
+ it != node.values.end();
+ ++it) {
+ list->Append(NewDescriptionValuePair(it->first, it->second));
+ }
+
+ for (std::map<std::string, DxDiagNode>::const_iterator it =
+ node.children.begin();
+ it != node.children.end();
+ ++it) {
+ ListValue* sublist = DxDiagNodeToList(it->second);
+ list->Append(NewDescriptionValuePair(it->first, sublist));
+ }
+ return list;
+}
+
+#endif // OS_WIN
+
} // namespace anonymous
GpuDataManager::GpuDataManager()
@@ -243,6 +282,51 @@ void GpuDataManager::HandleGpuSwitch() {
// relaunch GPU process.
}
+DictionaryValue* GpuDataManager::GpuInfoAsDictionaryValue() const {
+ ListValue* basic_info = new ListValue();
+ basic_info->Append(NewDescriptionValuePair(
+ "Initialization time",
+ base::Int64ToString(gpu_info().initialization_time.InMilliseconds())));
+ basic_info->Append(NewDescriptionValuePair(
+ "Vendor Id", base::StringPrintf("0x%04x", gpu_info().vendor_id)));
+ basic_info->Append(NewDescriptionValuePair(
+ "Device Id", base::StringPrintf("0x%04x", gpu_info().device_id)));
+ basic_info->Append(NewDescriptionValuePair("Driver vendor",
+ gpu_info().driver_vendor));
+ basic_info->Append(NewDescriptionValuePair("Driver version",
+ gpu_info().driver_version));
+ basic_info->Append(NewDescriptionValuePair("Driver date",
+ gpu_info().driver_date));
+ basic_info->Append(NewDescriptionValuePair("Pixel shader version",
+ gpu_info().pixel_shader_version));
+ basic_info->Append(NewDescriptionValuePair("Vertex shader version",
+ gpu_info().vertex_shader_version));
+ basic_info->Append(NewDescriptionValuePair("GL version",
+ gpu_info().gl_version));
+ basic_info->Append(NewDescriptionValuePair("GL_VENDOR",
+ gpu_info().gl_vendor));
+ basic_info->Append(NewDescriptionValuePair("GL_RENDERER",
+ gpu_info().gl_renderer));
+ basic_info->Append(NewDescriptionValuePair("GL_VERSION",
+ gpu_info().gl_version_string));
+ basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS",
+ gpu_info().gl_extensions));
+
+ DictionaryValue* info = new DictionaryValue();
+ info->Set("basic_info", basic_info);
+
+#if defined(OS_WIN)
+ Value* dx_info;
+ if (gpu_info().dx_diagnostics.children.size())
+ dx_info = DxDiagNodeToList(gpu_info().dx_diagnostics);
+ else
+ dx_info = Value::CreateNullValue();
+ info->Set("diagnostics", dx_info);
+#endif
+
+ return info;
+}
+
void GpuDataManager::RunGpuInfoUpdateCallbacks() {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
« no previous file with comments | « content/browser/gpu/gpu_data_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698