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

Unified Diff: content/browser/devtools/protocol/system_info_handler.cc

Issue 665123002: [DevTools] Move SystemInfo domain to generated handler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@browserProtocol
Patch Set: Rebased Created 6 years, 1 month 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/devtools/protocol/system_info_handler.h ('k') | content/browser/gpu/compositor_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/system_info_handler.cc
diff --git a/content/browser/devtools/protocol/system_info_handler.cc b/content/browser/devtools/protocol/system_info_handler.cc
index 2a0366e95900411c153f7dad7269facb2305eb05..d0fd5087d05cb49b22c5b7d35dd60ae7559b09f8 100644
--- a/content/browser/devtools/protocol/system_info_handler.cc
+++ b/content/browser/devtools/protocol/system_info_handler.cc
@@ -4,10 +4,79 @@
#include "content/browser/devtools/protocol/system_info_handler.h"
+#include "content/browser/gpu/compositor_util.h"
+#include "content/browser/gpu/gpu_data_manager_impl.h"
+#include "gpu/config/gpu_info.h"
+
namespace content {
namespace devtools {
namespace system_info {
+namespace {
+
+class AuxGPUInfoEnumerator : public gpu::GPUInfo::Enumerator {
+ public:
+ AuxGPUInfoEnumerator(base::DictionaryValue* dictionary)
+ : dictionary_(dictionary),
+ in_aux_attributes_(false) { }
+
+ void AddInt64(const char* name, int64 value) override {
+ if (in_aux_attributes_)
+ dictionary_->SetDouble(name, value);
+ }
+
+ void AddInt(const char* name, int value) override {
+ if (in_aux_attributes_)
+ dictionary_->SetInteger(name, value);
+ }
+
+ void AddString(const char* name, const std::string& value) override {
+ if (in_aux_attributes_)
+ dictionary_->SetString(name, value);
+ }
+
+ void AddBool(const char* name, bool value) override {
+ if (in_aux_attributes_)
+ dictionary_->SetBoolean(name, value);
+ }
+
+ void AddTimeDeltaInSecondsF(const char* name,
+ const base::TimeDelta& value) override {
+ if (in_aux_attributes_)
+ dictionary_->SetDouble(name, value.InSecondsF());
+ }
+
+ void BeginGPUDevice() override {}
+
+ void EndGPUDevice() override {}
+
+ void BeginVideoEncodeAcceleratorSupportedProfile() override {}
+
+ void EndVideoEncodeAcceleratorSupportedProfile() override {}
+
+ void BeginAuxAttributes() override {
+ in_aux_attributes_ = true;
+ }
+
+ void EndAuxAttributes() override {
+ in_aux_attributes_ = false;
+ }
+
+ private:
+ base::DictionaryValue* dictionary_;
+ bool in_aux_attributes_;
+};
+
+scoped_refptr<GPUDevice> GPUDeviceToProtocol(
+ const gpu::GPUInfo::GPUDevice& device) {
+ return GPUDevice::Create()->set_vendor_id(device.vendor_id)
+ ->set_device_id(device.device_id)
+ ->set_vendor_string(device.vendor_string)
+ ->set_device_string(device.device_string);
+}
+
+} // namespace
+
typedef DevToolsProtocolClient::Response Response;
SystemInfoHandler::SystemInfoHandler() {
@@ -16,8 +85,29 @@ SystemInfoHandler::SystemInfoHandler() {
SystemInfoHandler::~SystemInfoHandler() {
}
-Response SystemInfoHandler::GetInfo(scoped_refptr<SystemInfo>* info) {
- return Response::FallThrough();
+Response SystemInfoHandler::GetInfo(
+ scoped_refptr<devtools::system_info::GPUInfo>* gpu,
+ std::string* model_name,
+ std::string* model_version) {
+ gpu::GPUInfo gpu_info = GpuDataManagerImpl::GetInstance()->GetGPUInfo();
+
+ std::vector<scoped_refptr<GPUDevice>> devices;
+ devices.push_back(GPUDeviceToProtocol(gpu_info.gpu));
+ for (const auto& device : gpu_info.secondary_gpus)
+ devices.push_back(GPUDeviceToProtocol(device));
+
+ scoped_ptr<base::DictionaryValue> aux_attributes(new base::DictionaryValue);
+ AuxGPUInfoEnumerator enumerator(aux_attributes.get());
+ gpu_info.EnumerateFields(&enumerator);
+
+ *model_name = gpu_info.machine_model_name;
+ *model_version = gpu_info.machine_model_version;
+ *gpu = GPUInfo::Create()
+ ->set_devices(devices)
+ ->set_aux_attributes(aux_attributes.Pass())
+ ->set_feature_status(make_scoped_ptr(GetFeatureStatus()))
+ ->set_driver_bug_workarounds(GetDriverBugWorkarounds());
+ return Response::OK();
}
} // namespace system_info
« no previous file with comments | « content/browser/devtools/protocol/system_info_handler.h ('k') | content/browser/gpu/compositor_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698