diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 17:59:42 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-08 17:59:42 +0000 |
commit | a61508e5901304418d0c861a79b788c6fd74a997 (patch) | |
tree | c1f48290c209f8ac3726b3e734cb8b9404816ab3 | |
parent | a37d7ec1af822aa3524308c58c5160e3bf117965 (diff) | |
download | chromium_src-a61508e5901304418d0c861a79b788c6fd74a997.zip chromium_src-a61508e5901304418d0c861a79b788c6fd74a997.tar.gz chromium_src-a61508e5901304418d0c861a79b788c6fd74a997.tar.bz2 |
Make GPUInfo a struct, which it should be according to the C++ guidelines. This makes it easy to write automated serilization code for it.
Review URL: http://codereview.chromium.org/6621057
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77300 0039d316-1c4b-4281-b951-d872f2087c98
30 files changed, 295 insertions, 502 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index dc1693c..bfa1fae 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -39,7 +39,6 @@ #include "chrome/common/about_handler.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_version_info.h" -#include "chrome/common/gpu_info.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/net/gaia/google_service_auth_error.h" #include "chrome/common/render_messages.h" diff --git a/chrome/browser/gpu_data_manager.cc b/chrome/browser/gpu_data_manager.cc index e5b986c..8b7274e 100644 --- a/chrome/browser/gpu_data_manager.cc +++ b/chrome/browser/gpu_data_manager.cc @@ -74,7 +74,7 @@ void GpuDataManager::RequestCompleteGpuInfoIfNeeded() { void GpuDataManager::UpdateGpuInfo(const GPUInfo& gpu_info) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (gpu_info_.level() >= gpu_info.level()) + if (gpu_info_.level >= gpu_info.level) return; gpu_info_ = gpu_info; child_process_logging::SetGpuInfo(gpu_info); @@ -228,7 +228,7 @@ bool GpuDataManager::UpdateGpuBlacklist() { void GpuDataManager::UpdateGpuFeatureFlags() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - if (gpu_info_.level() == GPUInfo::kUninitialized) + if (gpu_info_.level == GPUInfo::kUninitialized) return; // Need to call this before checking gpu_feature_flags_set_ because it might @@ -249,7 +249,7 @@ void GpuDataManager::UpdateGpuFeatureFlags() { uint32 max_entry_id = gpu_blacklist->max_entry_id(); if (gpu_feature_flags_.flags() != 0) { // If gpu is blacklisted, no further GPUInfo will be collected. - gpu_info_.SetLevel(GPUInfo::kComplete); + gpu_info_.level = GPUInfo::kComplete; // Notify clients that GpuInfo state has changed RunGpuInfoUpdateCallbacks(); diff --git a/chrome/browser/gpu_data_manager.h b/chrome/browser/gpu_data_manager.h index dd41e0f..1e4b0d4 100644 --- a/chrome/browser/gpu_data_manager.h +++ b/chrome/browser/gpu_data_manager.h @@ -19,7 +19,7 @@ class CommandLine; class DictionaryValue; class GpuBlacklist; -class GPUInfo; +struct GPUInfo; class GpuDataManager { public: diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h index c0a0858..40df849 100644 --- a/chrome/browser/gpu_process_host_ui_shim.h +++ b/chrome/browser/gpu_process_host_ui_shim.h @@ -31,9 +31,9 @@ class Size; class GpuDataManager; struct GPUCreateCommandBufferConfig; -class GPUInfo; struct GpuHostMsg_AcceleratedSurfaceSetIOSurface_Params; struct GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params; +struct GPUInfo; namespace IPC { struct ChannelHandle; diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 37a693e..52ae898 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -340,12 +340,8 @@ void MetricsLog::RecordEnvironment( OPEN_ELEMENT_FOR_SCOPE("gpu"); GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::GetForRenderer(0); if (ui_shim) { - WriteIntAttribute( - "vendorid", - ui_shim->gpu_info().vendor_id()); - WriteIntAttribute( - "deviceid", - ui_shim->gpu_info().device_id()); + WriteIntAttribute("vendorid", ui_shim->gpu_info().vendor_id); + WriteIntAttribute("deviceid", ui_shim->gpu_info().device_id); } } diff --git a/chrome/browser/ui/webui/gpu_internals_ui.cc b/chrome/browser/ui/webui/gpu_internals_ui.cc index d0e03cf..b7cd155 100644 --- a/chrome/browser/ui/webui/gpu_internals_ui.cc +++ b/chrome/browser/ui/webui/gpu_internals_ui.cc @@ -313,38 +313,38 @@ std::string VersionNumberToString(uint32 value) { DictionaryValue* GpuInfoToDict(const GPUInfo& gpu_info) { ListValue* basic_info = new ListValue(); basic_info->Append(NewDescriptionValuePair("Initialization time", - base::Int64ToString(gpu_info.initialization_time().InMilliseconds()))); + base::Int64ToString(gpu_info.initialization_time.InMilliseconds()))); basic_info->Append(NewDescriptionValuePair("Vendor Id", - base::StringPrintf("0x%04x", gpu_info.vendor_id()))); + base::StringPrintf("0x%04x", gpu_info.vendor_id))); basic_info->Append(NewDescriptionValuePair("Device Id", - base::StringPrintf("0x%04x", gpu_info.device_id()))); + base::StringPrintf("0x%04x", gpu_info.device_id))); basic_info->Append(NewDescriptionValuePair("Driver vendor", - gpu_info.driver_vendor())); + gpu_info.driver_vendor)); basic_info->Append(NewDescriptionValuePair("Driver version", - gpu_info.driver_version())); + gpu_info.driver_version)); basic_info->Append(NewDescriptionValuePair("Driver date", - gpu_info.driver_date())); + gpu_info.driver_date)); basic_info->Append(NewDescriptionValuePair("Pixel shader version", - VersionNumberToString(gpu_info.pixel_shader_version()))); + VersionNumberToString(gpu_info.pixel_shader_version))); basic_info->Append(NewDescriptionValuePair("Vertex shader version", - VersionNumberToString(gpu_info.vertex_shader_version()))); + VersionNumberToString(gpu_info.vertex_shader_version))); basic_info->Append(NewDescriptionValuePair("GL version", - VersionNumberToString(gpu_info.gl_version()))); + VersionNumberToString(gpu_info.gl_version))); basic_info->Append(NewDescriptionValuePair("GL_VENDOR", - gpu_info.gl_vendor())); + gpu_info.gl_vendor)); basic_info->Append(NewDescriptionValuePair("GL_RENDERER", - gpu_info.gl_renderer())); + gpu_info.gl_renderer)); basic_info->Append(NewDescriptionValuePair("GL_VERSION", - gpu_info.gl_version_string())); + gpu_info.gl_version_string)); basic_info->Append(NewDescriptionValuePair("GL_EXTENSIONS", - gpu_info.gl_extensions())); + gpu_info.gl_extensions)); DictionaryValue* info = new DictionaryValue(); info->Set("basic_info", basic_info); #if defined(OS_WIN) - if (gpu_info.level() == GPUInfo::kComplete) { - ListValue* dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics()); + if (gpu_info.level == GPUInfo::kComplete) { + ListValue* dx_info = DxDiagNodeToList(gpu_info.dx_diagnostics); info->Set("diagnostics", dx_info); } #endif @@ -360,7 +360,7 @@ Value* GpuMessageHandler::OnRequestLogMessages(const ListValue*) { void GpuMessageHandler::OnGpuInfoUpdate() { const GPUInfo& gpu_info = gpu_data_manager_->gpu_info(); - if (gpu_info.level() == GPUInfo::kUninitialized) + if (gpu_info.level == GPUInfo::kUninitialized) return; // Get GPU Info. diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h index 4c4343c..36dd486 100644 --- a/chrome/common/child_process_logging.h +++ b/chrome/common/child_process_logging.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "googleurl/src/gurl.h" -class GPUInfo; +struct GPUInfo; #if defined(OS_WIN) || defined(OS_MACOSX) // The maximum number of active extensions we will report. diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index e14aa36..2c93f78 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -145,22 +145,22 @@ void SetGpuKeyValue(const char* param_name, const std::string& value_str, void SetGpuInfoImpl(const GPUInfo& gpu_info, SetCrashKeyValueFuncPtr set_key_func) { SetGpuKeyValue(kGPUVendorIdParamName, - base::UintToString(gpu_info.vendor_id()), + base::UintToString(gpu_info.vendor_id), set_key_func); SetGpuKeyValue(kGPUDeviceIdParamName, - base::UintToString(gpu_info.device_id()), + base::UintToString(gpu_info.device_id), set_key_func); SetGpuKeyValue(kGPUDriverVersionParamName, - gpu_info.driver_version(), + gpu_info.driver_version, set_key_func); SetGpuKeyValue(kGPUPixelShaderVersionParamName, - base::UintToString(gpu_info.pixel_shader_version()), + base::UintToString(gpu_info.pixel_shader_version), set_key_func); SetGpuKeyValue(kGPUVertexShaderVersionParamName, - base::UintToString(gpu_info.vertex_shader_version()), + base::UintToString(gpu_info.vertex_shader_version), set_key_func); SetGpuKeyValue(kGPUGLVersionParamName, - base::UintToString(gpu_info.gl_version()), + base::UintToString(gpu_info.gl_version), set_key_func); } diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index 0753f44..29e188c 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -137,11 +137,11 @@ void SetGpuInfo(const GPUInfo& gpu_info) { return; } (set_gpu_info)( - base::UintToString16(gpu_info.vendor_id()).c_str(), - base::UintToString16(gpu_info.device_id()).c_str(), - UTF8ToUTF16(gpu_info.driver_version()).c_str(), - base::UintToString16(gpu_info.pixel_shader_version()).c_str(), - base::UintToString16(gpu_info.vertex_shader_version()).c_str()); + base::UintToString16(gpu_info.vendor_id).c_str(), + base::UintToString16(gpu_info.device_id).c_str(), + UTF8ToUTF16(gpu_info.driver_version).c_str(), + base::UintToString16(gpu_info.pixel_shader_version).c_str(), + base::UintToString16(gpu_info.vertex_shader_version).c_str()); } void SetNumberOfViews(int number_of_views) { diff --git a/chrome/common/gpu_info.cc b/chrome/common/gpu_info.cc index 07b2461..3b04528 100644 --- a/chrome/common/gpu_info.cc +++ b/chrome/common/gpu_info.cc @@ -5,154 +5,22 @@ #include "chrome/common/gpu_info.h" GPUInfo::GPUInfo() - : level_(kUninitialized), - vendor_id_(0), - device_id_(0), - driver_vendor_(""), - driver_version_(""), - driver_date_(""), - pixel_shader_version_(0), - vertex_shader_version_(0), - gl_version_(0), - gl_version_string_(""), - gl_vendor_(""), - gl_renderer_(""), - gl_extensions_(""), - can_lose_context_(false), - collection_error_(false) { + : level(kUninitialized), + vendor_id(0), + device_id(0), + driver_vendor(""), + driver_version(""), + driver_date(""), + pixel_shader_version(0), + vertex_shader_version(0), + gl_version(0), + gl_version_string(""), + gl_vendor(""), + gl_renderer(""), + gl_extensions(""), + can_lose_context(false), + collection_error(false) { +} + +GPUInfo::~GPUInfo() { } - -GPUInfo::~GPUInfo() {} - -GPUInfo::Level GPUInfo::level() const { - return level_; -} - -base::TimeDelta GPUInfo::initialization_time() const { - return initialization_time_; -} - -uint32 GPUInfo::vendor_id() const { - return vendor_id_; -} - -uint32 GPUInfo::device_id() const { - return device_id_; -} - -std::string GPUInfo::driver_vendor() const { - return driver_vendor_; -} - -std::string GPUInfo::driver_version() const { - return driver_version_; -} - -std::string GPUInfo::driver_date() const { - return driver_date_; -} - -uint32 GPUInfo::pixel_shader_version() const { - return pixel_shader_version_; -} - -uint32 GPUInfo::vertex_shader_version() const { - return vertex_shader_version_; -} - -uint32 GPUInfo::gl_version() const { - return gl_version_; -} - -std::string GPUInfo::gl_version_string() const { - return gl_version_string_; -} - -std::string GPUInfo::gl_vendor() const { - return gl_vendor_; -} - -std::string GPUInfo::gl_renderer() const { - return gl_renderer_; -} - -std::string GPUInfo::gl_extensions() const { - return gl_extensions_; -} - -bool GPUInfo::can_lose_context() const { - return can_lose_context_; -} - -bool GPUInfo::collection_error() const { - return collection_error_; -} - -void GPUInfo::SetLevel(Level level) { - level_ = level; -} - -void GPUInfo::SetInitializationTime( - const base::TimeDelta& initialization_time) { - initialization_time_ = initialization_time; -} - -void GPUInfo::SetVideoCardInfo(uint32 vendor_id, uint32 device_id) { - vendor_id_ = vendor_id; - device_id_ = device_id; -} - -void GPUInfo::SetDriverInfo(const std::string& driver_vendor, - const std::string& driver_version, - const std::string& driver_date) { - if (driver_vendor.length() > 0) - driver_vendor_ = driver_vendor; - if (driver_version.length() > 0) - driver_version_ = driver_version; - if (driver_date.length() > 0) - driver_date_ = driver_date; -} - -void GPUInfo::SetShaderVersion(uint32 pixel_shader_version, - uint32 vertex_shader_version) { - pixel_shader_version_ = pixel_shader_version; - vertex_shader_version_ = vertex_shader_version; -} - -void GPUInfo::SetGLVersion(uint32 gl_version) { - gl_version_ = gl_version; -} - -void GPUInfo::SetGLVersionString(const std::string& gl_version_string) { - gl_version_string_ = gl_version_string; -} - -void GPUInfo::SetGLVendor(const std::string& gl_vendor) { - gl_vendor_ = gl_vendor; -} - -void GPUInfo::SetGLRenderer(const std::string& gl_renderer) { - gl_renderer_ = gl_renderer; -} - -void GPUInfo::SetGLExtensions(const std::string& gl_extensions) { - gl_extensions_ = gl_extensions; -} - -void GPUInfo::SetCanLoseContext(bool can_lose_context) { - can_lose_context_ = can_lose_context; -} - -void GPUInfo::SetCollectionError(bool collection_error) { - collection_error_ = collection_error; -} - -#if defined(OS_WIN) -const DxDiagNode& GPUInfo::dx_diagnostics() const { - return dx_diagnostics_; -} - -void GPUInfo::SetDxDiagnostics(const DxDiagNode& dx_diagnostics) { - dx_diagnostics_ = dx_diagnostics; -} -#endif diff --git a/chrome/common/gpu_info.h b/chrome/common/gpu_info.h index 9593f56..8ce5b51 100644 --- a/chrome/common/gpu_info.h +++ b/chrome/common/gpu_info.h @@ -17,8 +17,7 @@ #include "build/build_config.h" #include "chrome/common/dx_diag_node.h" -class GPUInfo { - public: +struct GPUInfo { GPUInfo(); ~GPUInfo(); @@ -30,127 +29,72 @@ class GPUInfo { kComplete, }; - // Returns whether this GPUInfo has been partially or fully initialized with + // Whether this GPUInfo has been partially or fully initialized with // information. - Level level() const; + Level level; // The amount of time taken to get from the process starting to the message // loop being pumped. - base::TimeDelta initialization_time() const; + base::TimeDelta initialization_time; - // Return the DWORD (uint32) representing the graphics card vendor id. - uint32 vendor_id() const; + // The DWORD (uint32) representing the graphics card vendor id. + uint32 vendor_id; - // Return the DWORD (uint32) representing the graphics card device id. - // Device ids are unique to vendor, not to one another. - uint32 device_id() const; + // The DWORD (uint32) representing the graphics card device id. Device ids + // are unique to vendor, not to one another. + uint32 device_id; - // Return the vendor of the graphics driver currently installed. - std::string driver_vendor() const; + // The vendor of the graphics driver currently installed. + std::string driver_vendor; - // Return the version of the graphics driver currently installed. - std::string driver_version() const; + // The version of the graphics driver currently installed. + std::string driver_version; - // Return the date of the graphics driver currently installed. - std::string driver_date() const; + // The date of the graphics driver currently installed. + std::string driver_date; - // Return the version of the pixel/fragment shader used by the gpu. - // Major version in the second lowest 8 bits, minor in the lowest 8 bits, - // eg version 2.5 would be 0x00000205. - uint32 pixel_shader_version() const; + // The version of the pixel/fragment shader used by the gpu. Major version in + // the second lowest 8 bits, minor in the lowest 8 bits, eg version 2.5 would + // be 0x00000205. + uint32 pixel_shader_version; - // Return the version of the vertex shader used by the gpu. - // Major version in the second lowest 8 bits, minor in the lowest 8 bits, - // eg version 2.5 would be 0x00000205. - uint32 vertex_shader_version() const; + // The version of the vertex shader used by the gpu. Major version in the + // second lowest 8 bits, minor in the lowest 8 bits, eg version 2.5 would be + // 0x00000205. + uint32 vertex_shader_version; - // Return the version of OpenGL we are using. + // The version of OpenGL we are using. // Major version in the second lowest 8 bits, minor in the lowest 8 bits, // eg version 2.5 would be 0x00000205. // Returns 0 if we're not using OpenGL, say because we're going through // D3D instead. // TODO(zmo): should be able to tell if it's GL or GLES. - uint32 gl_version() const; + uint32 gl_version; - // Return the GL_VERSION string. - // Return "" if we are not using OpenGL. - std::string gl_version_string() const; + // The GL_VERSION string. "" if we are not using OpenGL. + std::string gl_version_string; - // Return the GL_VENDOR string. - // Return "" if we are not using OpenGL. - std::string gl_vendor() const; + // The GL_VENDOR string. "" if we are not using OpenGL. + std::string gl_vendor; - // Return the GL_RENDERER string. - // Return "" if we are not using OpenGL. - std::string gl_renderer() const; + // The GL_RENDERER string. "" if we are not using OpenGL. + std::string gl_renderer; - // Return the GL_EXTENSIONS string. - // Return "" if we are not using OpenGL. - std::string gl_extensions() const; + // The GL_EXTENSIONS string. "" if we are not using OpenGL. + std::string gl_extensions; - // Return the device semantics, i.e. whether the Vista and Windows 7 specific + // The device semantics, i.e. whether the Vista and Windows 7 specific // semantics are available. - bool can_lose_context() const; + bool can_lose_context; - // Return true if there was an error at any stage of collecting GPUInfo data. + // True if there was an error at any stage of collecting GPUInfo data. // If there was an error, then the GPUInfo fields may be incomplete or set // to default values such as 0 or empty string. - bool collection_error() const; - - void SetLevel(Level level); - - void SetInitializationTime(const base::TimeDelta& initialization_time); - - void SetVideoCardInfo(uint32 vendor_id, uint32 device_id); - - void SetDriverInfo(const std::string& driver_vendor, - const std::string& driver_version, - const std::string& driver_date); - - void SetShaderVersion(uint32 pixel_shader_version, - uint32 vertex_shader_version); - - void SetGLVersion(uint32 gl_version); - - void SetGLVersionString(const std::string& gl_vendor_string); - - void SetGLVendor(const std::string& gl_vendor); - - void SetGLRenderer(const std::string& gl_renderer); - - void SetGLExtensions(const std::string& gl_extensions); - - void SetCanLoseContext(bool can_lose_context); - - void SetCollectionError(bool collection_error); + bool collection_error; #if defined(OS_WIN) // The information returned by the DirectX Diagnostics Tool. - const DxDiagNode& dx_diagnostics() const; - - void SetDxDiagnostics(const DxDiagNode& dx_diagnostics); -#endif - - private: - Level level_; - base::TimeDelta initialization_time_; - uint32 vendor_id_; - uint32 device_id_; - std::string driver_vendor_; - std::string driver_version_; - std::string driver_date_; - uint32 pixel_shader_version_; - uint32 vertex_shader_version_; - uint32 gl_version_; - std::string gl_version_string_; - std::string gl_vendor_; - std::string gl_renderer_; - std::string gl_extensions_; - bool can_lose_context_; - bool collection_error_; - -#if defined(OS_WIN) - DxDiagNode dx_diagnostics_; + DxDiagNode dx_diagnostics; #endif }; diff --git a/chrome/common/gpu_info_unittest.cc b/chrome/common/gpu_info_unittest.cc index c1a5dce..15fe03c 100644 --- a/chrome/common/gpu_info_unittest.cc +++ b/chrome/common/gpu_info_unittest.cc @@ -8,19 +8,19 @@ // Test that an empty GPUInfo has valid members TEST(GPUInfoBasicTest, EmptyGPUInfo) { GPUInfo gpu_info; - EXPECT_EQ(gpu_info.level(), GPUInfo::kUninitialized); - EXPECT_EQ(gpu_info.initialization_time().ToInternalValue(), 0); - EXPECT_EQ(gpu_info.vendor_id(), 0u); - EXPECT_EQ(gpu_info.device_id(), 0u); - EXPECT_EQ(gpu_info.driver_vendor(), ""); - EXPECT_EQ(gpu_info.driver_version(), ""); - EXPECT_EQ(gpu_info.driver_date(), ""); - EXPECT_EQ(gpu_info.pixel_shader_version(), 0u); - EXPECT_EQ(gpu_info.vertex_shader_version(), 0u); - EXPECT_EQ(gpu_info.gl_version(), 0u); - EXPECT_EQ(gpu_info.gl_version_string(), ""); - EXPECT_EQ(gpu_info.gl_vendor(), ""); - EXPECT_EQ(gpu_info.gl_renderer(), ""); - EXPECT_EQ(gpu_info.gl_extensions(), ""); - EXPECT_EQ(gpu_info.can_lose_context(), false); + EXPECT_EQ(gpu_info.level, GPUInfo::kUninitialized); + EXPECT_EQ(gpu_info.initialization_time.ToInternalValue(), 0); + EXPECT_EQ(gpu_info.vendor_id, 0u); + EXPECT_EQ(gpu_info.device_id, 0u); + EXPECT_EQ(gpu_info.driver_vendor, ""); + EXPECT_EQ(gpu_info.driver_version, ""); + EXPECT_EQ(gpu_info.driver_date, ""); + EXPECT_EQ(gpu_info.pixel_shader_version, 0u); + EXPECT_EQ(gpu_info.vertex_shader_version, 0u); + EXPECT_EQ(gpu_info.gl_version, 0u); + EXPECT_EQ(gpu_info.gl_version_string, ""); + EXPECT_EQ(gpu_info.gl_vendor, ""); + EXPECT_EQ(gpu_info.gl_renderer, ""); + EXPECT_EQ(gpu_info.gl_extensions, ""); + EXPECT_EQ(gpu_info.can_lose_context, false); } diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index a5b1550..a54a029 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -128,98 +128,67 @@ void ParamTraits<GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params> ::Log( #endif // if defined(OS_MACOSX) void ParamTraits<GPUInfo> ::Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int32>(p.level())); - WriteParam(m, p.initialization_time()); - WriteParam(m, p.vendor_id()); - WriteParam(m, p.device_id()); - WriteParam(m, p.driver_vendor()); - WriteParam(m, p.driver_version()); - WriteParam(m, p.driver_date()); - WriteParam(m, p.pixel_shader_version()); - WriteParam(m, p.vertex_shader_version()); - WriteParam(m, p.gl_version()); - WriteParam(m, p.gl_version_string()); - WriteParam(m, p.gl_vendor()); - WriteParam(m, p.gl_renderer()); - WriteParam(m, p.gl_extensions()); - WriteParam(m, p.can_lose_context()); + WriteParam(m, static_cast<int32>(p.level)); + WriteParam(m, p.initialization_time); + WriteParam(m, p.vendor_id); + WriteParam(m, p.device_id); + WriteParam(m, p.driver_vendor); + WriteParam(m, p.driver_version); + WriteParam(m, p.driver_date); + WriteParam(m, p.pixel_shader_version); + WriteParam(m, p.vertex_shader_version); + WriteParam(m, p.gl_version); + WriteParam(m, p.gl_version_string); + WriteParam(m, p.gl_vendor); + WriteParam(m, p.gl_renderer); + WriteParam(m, p.gl_extensions); + WriteParam(m, p.can_lose_context); + WriteParam(m, p.collection_error); #if defined(OS_WIN) - ParamTraits<DxDiagNode> ::Write(m, p.dx_diagnostics()); + ParamTraits<DxDiagNode> ::Write(m, p.dx_diagnostics); #endif } bool ParamTraits<GPUInfo> ::Read(const Message* m, void** iter, param_type* p) { - int32 level; - base::TimeDelta initialization_time; - uint32 vendor_id; - uint32 device_id; - std::string driver_vendor; - std::string driver_version; - std::string driver_date; - uint32 pixel_shader_version; - uint32 vertex_shader_version; - uint32 gl_version; - std::string gl_version_string; - std::string gl_vendor; - std::string gl_renderer; - std::string gl_extensions; - bool can_lose_context; - bool ret = ReadParam(m, iter, &level); - ret = ret && ReadParam(m, iter, &initialization_time); - ret = ret && ReadParam(m, iter, &vendor_id); - ret = ret && ReadParam(m, iter, &device_id); - ret = ret && ReadParam(m, iter, &driver_vendor); - ret = ret && ReadParam(m, iter, &driver_version); - ret = ret && ReadParam(m, iter, &driver_date); - ret = ret && ReadParam(m, iter, &pixel_shader_version); - ret = ret && ReadParam(m, iter, &vertex_shader_version); - ret = ret && ReadParam(m, iter, &gl_version); - ret = ret && ReadParam(m, iter, &gl_version_string); - ret = ret && ReadParam(m, iter, &gl_vendor); - ret = ret && ReadParam(m, iter, &gl_renderer); - ret = ret && ReadParam(m, iter, &gl_extensions); - ret = ret && ReadParam(m, iter, &can_lose_context); - p->SetLevel(static_cast<GPUInfo::Level>(level)); - if (!ret) - return false; - - p->SetInitializationTime(initialization_time); - p->SetVideoCardInfo(vendor_id, device_id); - p->SetDriverInfo(driver_vendor, driver_version, driver_date); - p->SetShaderVersion(pixel_shader_version, vertex_shader_version); - p->SetGLVersion(gl_version); - p->SetGLVersionString(gl_version_string); - p->SetGLVendor(gl_vendor); - p->SetGLRenderer(gl_renderer); - p->SetGLExtensions(gl_extensions); - p->SetCanLoseContext(can_lose_context); - + return + ReadParam(m, iter, &p->level) && + ReadParam(m, iter, &p->initialization_time) && + ReadParam(m, iter, &p->vendor_id) && + ReadParam(m, iter, &p->device_id) && + ReadParam(m, iter, &p->driver_vendor) && + ReadParam(m, iter, &p->driver_version) && + ReadParam(m, iter, &p->driver_date) && + ReadParam(m, iter, &p->pixel_shader_version) && + ReadParam(m, iter, &p->vertex_shader_version) && + ReadParam(m, iter, &p->gl_version) && + ReadParam(m, iter, &p->gl_version_string) && + ReadParam(m, iter, &p->gl_vendor) && + ReadParam(m, iter, &p->gl_renderer) && + ReadParam(m, iter, &p->gl_extensions) && + ReadParam(m, iter, &p->can_lose_context) && + ReadParam(m, iter, &p->collection_error) && #if defined(OS_WIN) - DxDiagNode dx_diagnostics; - if (!ReadParam(m, iter, &dx_diagnostics)) - return false; - - p->SetDxDiagnostics(dx_diagnostics); + ReadParam(m, iter, &p->dx_diagnostics); +#else + true; #endif - - return true; } void ParamTraits<GPUInfo> ::Log(const param_type& p, std::string* l) { l->append(base::StringPrintf("<GPUInfo> %d %d %x %x %s %s %s %x %x %x %d", - p.level(), + p.level, static_cast<int32>( - p.initialization_time().InMilliseconds()), - p.vendor_id(), - p.device_id(), - p.driver_vendor().c_str(), - p.driver_version().c_str(), - p.driver_date().c_str(), - p.pixel_shader_version(), - p.vertex_shader_version(), - p.gl_version(), - p.can_lose_context())); + p.initialization_time.InMilliseconds()), + p.vendor_id, + p.device_id, + p.driver_vendor.c_str(), + p.driver_version.c_str(), + p.driver_date.c_str(), + p.pixel_shader_version, + p.vertex_shader_version, + p.gl_version, + p.can_lose_context)); } diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h index eecc12e..24b36e9 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/chrome/common/gpu_messages_internal.h @@ -21,7 +21,7 @@ struct ChannelHandle; } struct GPUCreateCommandBufferConfig; -class GPUInfo; +struct GPUInfo; //------------------------------------------------------------------------------ // GPU Messages diff --git a/chrome/common/gpu_messages_unittest.cc b/chrome/common/gpu_messages_unittest.cc index 052c144..0abe2d5 100644 --- a/chrome/common/gpu_messages_unittest.cc +++ b/chrome/common/gpu_messages_unittest.cc @@ -13,17 +13,21 @@ TEST(GPUIPCMessageTest, GPUInfo) { GPUInfo input; // Test variables taken from HP Z600 Workstation - input.SetLevel(GPUInfo::kPartial); - input.SetInitializationTime(base::TimeDelta::FromMilliseconds(100)); - input.SetVideoCardInfo(0x10de, 0x0658); - input.SetDriverInfo("NVIDIA", "195.36.24", "7-14-2009"); - input.SetShaderVersion(0x0162, 0x0162); - input.SetGLVersion(0x0302); - input.SetGLVersionString("3.2.0 NVIDIA 195.36.24"); - input.SetGLVendor("NVIDIA Corporation"); - input.SetGLRenderer("Quadro FX 380/PCI/SSE2"); - input.SetGLExtensions("GL_ARB_texture_rg GL_ARB_window_pos"); - input.SetCanLoseContext(false); + input.level = GPUInfo::kPartial; + input.initialization_time = base::TimeDelta::FromMilliseconds(100); + input.vendor_id = 0x10de; + input.device_id = 0x0658; + input.driver_vendor = "NVIDIA"; + input.driver_version = "195.36.24"; + input.driver_date = "7-14-2009"; + input.pixel_shader_version = 0x0162; + input.vertex_shader_version = 0x0162; + input.gl_version = 0x0302; + input.gl_version_string = "3.2.0 NVIDIA 195.36.24"; + input.gl_vendor = "NVIDIA Corporation"; + input.gl_renderer = "Quadro FX 380/PCI/SSE2"; + input.gl_extensions ="GL_ARB_texture_rg GL_ARB_window_pos"; + input.can_lose_context = false; IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); IPC::WriteParam(&msg, input); @@ -31,22 +35,22 @@ TEST(GPUIPCMessageTest, GPUInfo) { GPUInfo output; void* iter = NULL; EXPECT_TRUE(IPC::ReadParam(&msg, &iter, &output)); - EXPECT_EQ(input.level(), output.level()); - EXPECT_EQ(input.initialization_time().InMilliseconds(), - output.initialization_time().InMilliseconds()); - EXPECT_EQ(input.vendor_id(), output.vendor_id()); - EXPECT_EQ(input.device_id(), output.device_id()); - EXPECT_EQ(input.driver_vendor(), output.driver_vendor()); - EXPECT_EQ(input.driver_version(), output.driver_version()); - EXPECT_EQ(input.driver_date(), output.driver_date()); - EXPECT_EQ(input.pixel_shader_version(), output.pixel_shader_version()); - EXPECT_EQ(input.vertex_shader_version(), output.vertex_shader_version()); - EXPECT_EQ(input.gl_version(), output.gl_version()); - EXPECT_EQ(input.gl_version_string(), output.gl_version_string()); - EXPECT_EQ(input.gl_vendor(), output.gl_vendor()); - EXPECT_EQ(input.gl_renderer(), output.gl_renderer()); - EXPECT_EQ(input.gl_extensions(), output.gl_extensions()); - EXPECT_EQ(input.can_lose_context(), output.can_lose_context()); + EXPECT_EQ(input.level, output.level); + EXPECT_EQ(input.initialization_time.InMilliseconds(), + output.initialization_time.InMilliseconds()); + EXPECT_EQ(input.vendor_id, output.vendor_id); + EXPECT_EQ(input.device_id, output.device_id); + EXPECT_EQ(input.driver_vendor, output.driver_vendor); + EXPECT_EQ(input.driver_version, output.driver_version); + EXPECT_EQ(input.driver_date, output.driver_date); + EXPECT_EQ(input.pixel_shader_version, output.pixel_shader_version); + EXPECT_EQ(input.vertex_shader_version, output.vertex_shader_version); + EXPECT_EQ(input.gl_version, output.gl_version); + EXPECT_EQ(input.gl_version_string, output.gl_version_string); + EXPECT_EQ(input.gl_vendor, output.gl_vendor); + EXPECT_EQ(input.gl_renderer, output.gl_renderer); + EXPECT_EQ(input.gl_extensions, output.gl_extensions); + EXPECT_EQ(input.can_lose_context, output.can_lose_context); std::string log_message; IPC::LogParam(output, &log_message); diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index a1ffb54..c9287a9 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -47,10 +47,10 @@ typedef std::map<std::string, std::string> SubstitutionMap; class Value; -class GPUInfo; class SkBitmap; -struct ThumbnailScore; class WebCursor; +struct GPUInfo; +struct ThumbnailScore; namespace gfx { class Rect; diff --git a/chrome/gpu/gpu_info_collector.cc b/chrome/gpu/gpu_info_collector.cc index acaa6e5..92bcb89 100644 --- a/chrome/gpu/gpu_info_collector.cc +++ b/chrome/gpu/gpu_info_collector.cc @@ -86,10 +86,10 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { if (context == NULL) return false; - gpu_info->SetGLRenderer(GetGLString(GL_RENDERER)); - gpu_info->SetGLVendor(GetGLString(GL_VENDOR)); - gpu_info->SetGLVersionString(GetGLString(GL_VERSION)); - gpu_info->SetGLExtensions(GetGLString(GL_EXTENSIONS)); + gpu_info->gl_renderer = GetGLString(GL_RENDERER); + gpu_info->gl_vendor = GetGLString(GL_VENDOR); + gpu_info->gl_version_string =GetGLString(GL_VERSION); + gpu_info->gl_extensions =GetGLString(GL_EXTENSIONS); bool validGLVersionInfo = CollectGLVersionInfo(gpu_info); bool validVideoCardInfo = CollectVideoCardInfo(gpu_info); @@ -103,15 +103,16 @@ bool CollectGraphicsInfoGL(GPUInfo* gpu_info) { bool CollectGLVersionInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - std::string gl_version_string = gpu_info->gl_version_string(); + std::string gl_version_string = gpu_info->gl_version_string; std::string glsl_version_string = GetGLString(GL_SHADING_LANGUAGE_VERSION); uint32 gl_version = GetVersionNumberFromString(gl_version_string); - gpu_info->SetGLVersion(gl_version); + gpu_info->gl_version = gl_version; uint32 glsl_version = GetVersionNumberFromString(glsl_version_string); - gpu_info->SetShaderVersion(glsl_version, glsl_version); + gpu_info->pixel_shader_version = glsl_version; + gpu_info->vertex_shader_version = glsl_version; return true; } diff --git a/chrome/gpu/gpu_info_collector_linux.cc b/chrome/gpu/gpu_info_collector_linux.cc index bf1a722..9763e72 100644 --- a/chrome/gpu/gpu_info_collector_linux.cc +++ b/chrome/gpu/gpu_info_collector_linux.cc @@ -141,16 +141,16 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { // TODO(zmo): need to consider the case where we are running on top of // desktop GL and GL_ARB_robustness extension is available. - gpu_info->SetCanLoseContext( - gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); - gpu_info->SetLevel(GPUInfo::kComplete); + gpu_info->can_lose_context = + (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); + gpu_info->level = GPUInfo::kComplete; return CollectGraphicsInfoGL(gpu_info); } bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->SetLevel(GPUInfo::kPartial); + gpu_info->level = GPUInfo::kPartial; bool rt = true; if (!CollectVideoCardInfo(gpu_info)) @@ -198,8 +198,8 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { } else { // If more than one graphics card are identified, find the one that matches // gl VENDOR and RENDERER info. - std::string gl_vendor_string = gpu_info->gl_vendor(); - std::string gl_renderer_string = gpu_info->gl_renderer(); + std::string gl_vendor_string = gpu_info->gl_vendor; + std::string gl_renderer_string = gpu_info->gl_renderer; const int buffer_size = 255; scoped_array<char> buffer(new char[buffer_size]); std::vector<PciDevice*> candidates; @@ -244,8 +244,10 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { if (gpu_active == NULL && candidates.size() == 1) gpu_active = candidates[0]; } - if (gpu_active != NULL) - gpu_info->SetVideoCardInfo(gpu_active->vendor_id, gpu_active->device_id); + if (gpu_active != NULL) { + gpu_info->vendor_id = gpu_active->vendor_id; + gpu_info->device_id = gpu_active->device_id; + } (interface->pci_cleanup)(access); FinalizeLibPci(&interface); return (gpu_active != NULL); @@ -254,7 +256,7 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { bool CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); - std::string gl_version_string = gpu_info->gl_version_string(); + std::string gl_version_string = gpu_info->gl_version_string; std::vector<std::string> pieces; base::SplitStringAlongWhitespace(gl_version_string, &pieces); // In linux, the gl version string might be in the format of @@ -269,7 +271,9 @@ bool CollectDriverInfoGL(GPUInfo* gpu_info) { if (pos != std::string::npos) driver_version = driver_version.substr(0, pos); - gpu_info->SetDriverInfo(pieces[1], driver_version, ""); + gpu_info->driver_vendor = pieces[1]; + gpu_info->driver_version = driver_version; + gpu_info->driver_date = ""; return true; } diff --git a/chrome/gpu/gpu_info_collector_mac.mm b/chrome/gpu/gpu_info_collector_mac.mm index e4581bf..d376560 100644 --- a/chrome/gpu/gpu_info_collector_mac.mm +++ b/chrome/gpu/gpu_info_collector_mac.mm @@ -46,16 +46,16 @@ namespace gpu_info_collector { bool CollectGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->SetCanLoseContext( - gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); - gpu_info->SetLevel(GPUInfo::kComplete); + gpu_info->can_lose_context = + (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2); + gpu_info-> level = GPUInfo::kComplete; return CollectGraphicsInfoGL(gpu_info); } bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->SetLevel(GPUInfo::kPartial); + gpu_info->level = GPUInfo::kPartial; bool rt = true; if (!CollectVideoCardInfo(gpu_info)) @@ -80,7 +80,8 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { CFRelease(device_id_ref); } - gpu_info->SetVideoCardInfo(vendor_id, device_id); + gpu_info->vendor_id = vendor_id; + gpu_info->device_id = device_id; return true; } @@ -91,11 +92,13 @@ bool CollectDriverInfoGL(GPUInfo* gpu_info) { // Mac OpenGL drivers have the driver version // at the end of the gl version string preceded by a dash. // Use some jiggery-pokery to turn that utf8 string into a std::wstring. - std::string gl_version_string = gpu_info->gl_version_string(); + std::string gl_version_string = gpu_info->gl_version_string; size_t pos = gl_version_string.find_last_of('-'); if (pos == std::string::npos) return false; - gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1), ""); + gpu_info->driver_vendor = ""; + gpu_info->driver_version = gl_version_string.substr(pos + 1); + gpu_info->driver_date = ""; return true; } diff --git a/chrome/gpu/gpu_info_collector_unittest.cc b/chrome/gpu/gpu_info_collector_unittest.cc index 076690a..a78b46f 100644 --- a/chrome/gpu/gpu_info_collector_unittest.cc +++ b/chrome/gpu/gpu_info_collector_unittest.cc @@ -65,15 +65,19 @@ class GPUInfoCollectorTest : public testing::Test { "GL_OES_packed_depth_stencil GL_EXT_texture_format_BGRA8888 " "GL_EXT_read_format_bgra"; #endif - test_values_.SetVideoCardInfo(vendor_id, device_id); - test_values_.SetDriverInfo(driver_vendor, driver_version, ""); - test_values_.SetShaderVersion(shader_version, shader_version); - test_values_.SetGLVersion(gl_version); - test_values_.SetGLRenderer(gl_renderer); - test_values_.SetGLVendor(gl_vendor); - test_values_.SetGLVersionString(gl_version_string); - test_values_.SetGLExtensions(gl_extensions); - test_values_.SetCanLoseContext(false); + test_values_.vendor_id = vendor_id; + test_values_.device_id = device_id; + test_values_.driver_vendor = driver_vendor; + test_values_.driver_version =driver_version; + test_values_.driver_date = ""; + test_values_.pixel_shader_version = shader_version; + test_values_.vertex_shader_version = shader_version; + test_values_.gl_version = gl_version; + test_values_.gl_renderer = gl_renderer; + test_values_.gl_vendor = gl_vendor; + test_values_.gl_version_string = gl_version_string; + test_values_.gl_extensions = gl_extensions; + test_values_.can_lose_context = false; EXPECT_CALL(*gl_, GetString(GL_EXTENSIONS)) .WillRepeatedly(Return(reinterpret_cast<const GLubyte*>( @@ -109,8 +113,8 @@ class GPUInfoCollectorTest : public testing::Test { TEST_F(GPUInfoCollectorTest, DriverVendorGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string driver_vendor = gpu_info.driver_vendor(); - EXPECT_EQ(test_values_.driver_vendor(), driver_vendor); + std::string driver_vendor = gpu_info.driver_vendor; + EXPECT_EQ(test_values_.driver_vendor, driver_vendor); } // Skip Windows because the driver version is obtained from bot registry. @@ -118,58 +122,56 @@ TEST_F(GPUInfoCollectorTest, DriverVendorGL) { TEST_F(GPUInfoCollectorTest, DriverVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string driver_version = gpu_info.driver_version(); - EXPECT_EQ(test_values_.driver_version(), driver_version); + std::string driver_version = gpu_info.driver_version; + EXPECT_EQ(test_values_.driver_version, driver_version); } #endif TEST_F(GPUInfoCollectorTest, PixelShaderVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - uint32 ps_version = gpu_info.pixel_shader_version(); - EXPECT_EQ(test_values_.pixel_shader_version(), ps_version); + uint32 ps_version = gpu_info.pixel_shader_version; + EXPECT_EQ(test_values_.pixel_shader_version, ps_version); } TEST_F(GPUInfoCollectorTest, VertexShaderVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - uint32 vs_version = gpu_info.vertex_shader_version(); - EXPECT_EQ(test_values_.vertex_shader_version(), vs_version); + uint32 vs_version = gpu_info.vertex_shader_version; + EXPECT_EQ(test_values_.vertex_shader_version, vs_version); } TEST_F(GPUInfoCollectorTest, GLVersionGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - uint32 gl_version = gpu_info.gl_version(); - EXPECT_EQ(test_values_.gl_version(), gl_version); + uint32 gl_version = gpu_info.gl_version; + EXPECT_EQ(test_values_.gl_version, gl_version); } TEST_F(GPUInfoCollectorTest, GLVersionStringGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_version_string = gpu_info.gl_version_string(); - EXPECT_EQ(test_values_.gl_version_string(), gl_version_string); + std::string gl_version_string = gpu_info.gl_version_string; + EXPECT_EQ(test_values_.gl_version_string, gl_version_string); } TEST_F(GPUInfoCollectorTest, GLRendererGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_renderer = gpu_info.gl_renderer(); - EXPECT_EQ(test_values_.gl_renderer(), gl_renderer); + std::string gl_renderer = gpu_info.gl_renderer; + EXPECT_EQ(test_values_.gl_renderer, gl_renderer); } TEST_F(GPUInfoCollectorTest, GLVendorGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_vendor = gpu_info.gl_vendor(); - EXPECT_EQ(test_values_.gl_vendor(), gl_vendor); + std::string gl_vendor = gpu_info.gl_vendor; + EXPECT_EQ(test_values_.gl_vendor, gl_vendor); } TEST_F(GPUInfoCollectorTest, GLExtensionsGL) { GPUInfo gpu_info; gpu_info_collector::CollectGraphicsInfoGL(&gpu_info); - std::string gl_extensions = gpu_info.gl_extensions(); - EXPECT_EQ(test_values_.gl_extensions(), gl_extensions); + std::string gl_extensions = gpu_info.gl_extensions; + EXPECT_EQ(test_values_.gl_extensions, gl_extensions); } - - diff --git a/chrome/gpu/gpu_info_collector_win.cc b/chrome/gpu/gpu_info_collector_win.cc index 85be092..fc09eab 100644 --- a/chrome/gpu/gpu_info_collector_win.cc +++ b/chrome/gpu/gpu_info_collector_win.cc @@ -51,12 +51,12 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { - gpu_info->SetLevel(GPUInfo::kComplete); + gpu_info->level = GPUInfo::kComplete; return CollectGraphicsInfoGL(gpu_info); } // Set to partial now in case this function returns false below. - gpu_info->SetLevel(GPUInfo::kPartial); + gpu_info->level = GPUInfo::kPartial; // TODO(zmo): the following code only works if running on top of ANGLE. // Need to handle the case when running on top of real EGL/GLES2 drivers. @@ -91,7 +91,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { bool CollectPreliminaryGraphicsInfo(GPUInfo* gpu_info) { DCHECK(gpu_info); - gpu_info->SetLevel(GPUInfo::kPreliminary); + gpu_info->level = GPUInfo::kPreliminary; bool rt = true; if (!CollectVideoCardInfo(gpu_info)) @@ -111,8 +111,8 @@ bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { if (d3d->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &d3d_caps) == D3D_OK) { - gpu_info->SetShaderVersion(d3d_caps.PixelShaderVersion, - d3d_caps.VertexShaderVersion); + gpu_info->pixel_shader_version = d3d_caps.PixelShaderVersion; + gpu_info->vertex_shader_version = d3d_caps.VertexShaderVersion; } else { LOG(ERROR) << "d3d->GetDeviceCaps() failed"; succeed = false; @@ -127,7 +127,7 @@ bool CollectGraphicsInfoD3D(IDirect3D9* d3d, GPUInfo* gpu_info) { } else { can_lose_context = true; } - gpu_info->SetCanLoseContext(can_lose_context); + gpu_info->can_lose_context = can_lose_context; d3d->Release(); return true; @@ -154,7 +154,8 @@ bool CollectVideoCardInfo(GPUInfo* gpu_info) { std::wstring device_id_string = id.substr(17, 4); base::HexStringToInt(WideToASCII(vendor_id_string), &vendor_id); base::HexStringToInt(WideToASCII(device_id_string), &device_id); - gpu_info->SetVideoCardInfo(vendor_id, device_id); + gpu_info->vendor_id = vendor_id; + gpu_info->device_id = device_id; // TODO(zmo): we only need to call CollectDriverInfoD3D() if we use ANGLE. return CollectDriverInfoD3D(id, gpu_info); } @@ -231,7 +232,9 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, GPUInfo* gpu_info) { if (result == ERROR_SUCCESS) driver_date = WideToASCII(std::wstring(value)); - gpu_info->SetDriverInfo("", driver_version, driver_date); + gpu_info->driver_vendor = ""; + gpu_info->driver_version = driver_version; + gpu_info->driver_date = driver_date; found = true; RegCloseKey(key); break; @@ -246,14 +249,16 @@ bool CollectDriverInfoD3D(const std::wstring& device_id, GPUInfo* gpu_info) { bool CollectDriverInfoGL(GPUInfo* gpu_info) { DCHECK(gpu_info); - std::string gl_version_string = gpu_info->gl_version_string(); + std::string gl_version_string = gpu_info->gl_version_string; // TODO(zmo): We assume the driver version is in the end of GL_VERSION // string. Need to verify if it is true for majority drivers. size_t pos = gl_version_string.find_last_not_of("0123456789."); if (pos != std::string::npos && pos < gl_version_string.length() - 1) { - gpu_info->SetDriverInfo("", gl_version_string.substr(pos + 1), ""); + gpu_info->driver_vendor = ""; + gpu_info->driver_version = gl_version_string.substr(pos + 1); + gpu_info->driver_date = ""; return true; } return false; diff --git a/chrome/gpu/gpu_info_unittest_win.cc b/chrome/gpu/gpu_info_unittest_win.cc index aa8a1e2..9455f4d 100644 --- a/chrome/gpu/gpu_info_unittest_win.cc +++ b/chrome/gpu/gpu_info_unittest_win.cc @@ -47,13 +47,13 @@ class GPUInfoTest : public testing::Test { TEST_F(GPUInfoTest, PixelShaderVersionD3D) { GPUInfo gpu_info; ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - uint32 ps_version = gpu_info.pixel_shader_version(); + uint32 ps_version = gpu_info.pixel_shader_version; EXPECT_EQ(ps_version, D3DPS_VERSION(3, 0)); } TEST_F(GPUInfoTest, VertexShaderVersionD3D) { GPUInfo gpu_info; ASSERT_TRUE(gpu_info_collector::CollectGraphicsInfoD3D(&d3d_, &gpu_info)); - uint32 vs_version = gpu_info.vertex_shader_version(); + uint32 vs_version = gpu_info.vertex_shader_version; EXPECT_EQ(vs_version, D3DVS_VERSION(3, 0)); } diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc index 7415645..96722bf 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -131,7 +131,7 @@ void GpuThread::OnInitialize() { } bool gpu_info_result = gpu_info_collector::CollectGraphicsInfo(&gpu_info_); if (!gpu_info_result) { - gpu_info_.SetCollectionError(true); + gpu_info_.collection_error = true; LOG(ERROR) << "gpu_info_collector::CollectGraphicsInfo() failed"; } child_process_logging::SetGpuInfo(gpu_info_); @@ -139,7 +139,7 @@ void GpuThread::OnInitialize() { // Record initialization only after collecting the GPU info because that can // take a significant amount of time. - gpu_info_.SetInitializationTime(base::Time::Now() - process_start_time_); + gpu_info_.initialization_time = base::Time::Now() - process_start_time_; #if defined (OS_MACOSX) // Note that kNoSandbox will also disable the GPU sandbox. @@ -248,9 +248,9 @@ void GpuThread::OnSynchronize() { void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) { #if defined(OS_WIN) - if (level == GPUInfo::kComplete && gpu_info_.level() <= GPUInfo::kPartial) { + if (level == GPUInfo::kComplete && gpu_info_.level <= GPUInfo::kPartial) { // Prevent concurrent collection of DirectX diagnostics. - gpu_info_.SetLevel(GPUInfo::kCompleting); + gpu_info_.level = GPUInfo::kCompleting; // Asynchronously collect the DirectX diagnostics because this can take a // couple of seconds. @@ -261,7 +261,7 @@ void GpuThread::OnCollectGraphicsInfo(GPUInfo::Level level) { // Flag GPU info as complete if the DirectX diagnostics cannot be // collected. - gpu_info_.SetLevel(GPUInfo::kComplete); + gpu_info_.level = GPUInfo::kComplete; } else { // Do not send response if we are still completing the GPUInfo struct return; @@ -338,8 +338,8 @@ void GpuThread::CollectDxDiagnostics(GpuThread* thread) { // Runs on the GPU thread. void GpuThread::SetDxDiagnostics(GpuThread* thread, const DxDiagNode& node) { - thread->gpu_info_.SetDxDiagnostics(node); - thread->gpu_info_.SetLevel(GPUInfo::kComplete); + thread->gpu_info_.dx_diagnostics = node; + thread->gpu_info_.level = GPUInfo::kComplete; thread->Send(new GpuHostMsg_GraphicsInfoCollected(thread->gpu_info_)); } diff --git a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc index dfcfad9..34e9aa7 100644 --- a/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc +++ b/chrome/renderer/webgraphicscontext3d_command_buffer_impl.cc @@ -78,10 +78,10 @@ bool WebGraphicsContext3DCommandBufferImpl::initialize( GPUInfo gpu_info = host->gpu_info(); UMA_HISTOGRAM_ENUMERATION( "GPU.WebGraphicsContext3D_Init_CanLoseContext", - attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context(), + attributes.canRecoverFromContextLoss * 2 + gpu_info.can_lose_context, 4); if (attributes.canRecoverFromContextLoss == false) { - if (gpu_info.can_lose_context()) + if (gpu_info.can_lose_context) return false; } diff --git a/chrome/test/gpu/gpu_pixel_browsertest.cc b/chrome/test/gpu/gpu_pixel_browsertest.cc index 6dab90b..5a6cebf 100644 --- a/chrome/test/gpu/gpu_pixel_browsertest.cc +++ b/chrome/test/gpu/gpu_pixel_browsertest.cc @@ -122,7 +122,7 @@ bool CollectGPUInfo(GPUInfo* client_info) { if (!gpu_host_shim) return false; GPUInfo info = gpu_host_shim->gpu_info(); - if (info.level() == GPUInfo::kUninitialized) { + if (info.level == GPUInfo::kUninitialized) { GPUInfoCollectedObserver observer(gpu_host_shim); gpu_host_shim->CollectGpuInfoAsynchronously(GPUInfo::kPartial); ui_test_utils::RunMessageLoop(); @@ -224,7 +224,7 @@ class GpuPixelBrowserTest : public InProcessBrowserTest { return false; } img_name = base::StringPrintf("%s_%s_%04x-%04x.png", - img_name.c_str(), os_label, info.vendor_id(), info.device_id()); + img_name.c_str(), os_label, info.vendor_id, info.device_id); } else { img_name = base::StringPrintf("%s_%s_mesa.png", img_name.c_str(), os_label); diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc index 6e61400..ce54c28 100644 --- a/content/browser/gpu_blacklist.cc +++ b/content/browser/gpu_blacklist.cc @@ -500,12 +500,12 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains( DCHECK(os_type != kOsAny); if (os_info_.get() != NULL && !os_info_->Contains(os_type, os_version)) return false; - if (vendor_id_ != 0 && vendor_id_ != gpu_info.vendor_id()) + if (vendor_id_ != 0 && vendor_id_ != gpu_info.vendor_id) return false; if (device_id_list_.size() > 0) { bool found = false; for (size_t i = 0; i < device_id_list_.size(); ++i) { - if (device_id_list_[i] == gpu_info.device_id()) { + if (device_id_list_[i] == gpu_info.device_id) { found = true; break; } @@ -514,24 +514,23 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains( return false; } if (driver_vendor_info_.get() != NULL && - !driver_vendor_info_->Contains(gpu_info.driver_vendor())) + !driver_vendor_info_->Contains(gpu_info.driver_vendor)) return false; if (driver_version_info_.get() != NULL) { scoped_ptr<Version> driver_version( - Version::GetVersionFromString(gpu_info.driver_version())); + Version::GetVersionFromString(gpu_info.driver_version)); if (driver_version.get() == NULL || !driver_version_info_->Contains(*driver_version)) return false; } if (driver_date_info_.get() != NULL) { - scoped_ptr<Version> driver_date(GetDateFromString( - gpu_info.driver_date())); + scoped_ptr<Version> driver_date(GetDateFromString(gpu_info.driver_date)); if (driver_date.get() == NULL || !driver_date_info_->Contains(*driver_date)) return false; } if (gl_renderer_info_.get() != NULL && - !gl_renderer_info_->Contains(gpu_info.gl_renderer())) + !gl_renderer_info_->Contains(gpu_info.gl_renderer)) return false; for (size_t i = 0; i < exceptions_.size(); ++i) { if (exceptions_[i]->Contains(os_type, os_version, gpu_info)) @@ -634,7 +633,7 @@ GpuFeatureFlags GpuBlacklist::DetermineGpuFeatureFlags( active_entries_.clear(); GpuFeatureFlags flags; // No need to go through blacklist entries if GPUInfo isn't available. - if (gpu_info.level() == GPUInfo::kUninitialized) + if (gpu_info.level == GPUInfo::kUninitialized) return flags; if (os == kOsAny) diff --git a/content/browser/gpu_blacklist.h b/content/browser/gpu_blacklist.h index ecde21e..2b810b7 100644 --- a/content/browser/gpu_blacklist.h +++ b/content/browser/gpu_blacklist.h @@ -15,8 +15,8 @@ #include "chrome/common/gpu_feature_flags.h" class DictionaryValue; -class GPUInfo; class Version; +struct GPUInfo; class GpuBlacklist { public: diff --git a/content/browser/gpu_blacklist_unittest.cc b/content/browser/gpu_blacklist_unittest.cc index a568256..6008b62 100644 --- a/content/browser/gpu_blacklist_unittest.cc +++ b/content/browser/gpu_blacklist_unittest.cc @@ -26,12 +26,12 @@ class GpuBlacklistTest : public testing::Test { protected: void SetUp() { - gpu_info_.SetVideoCardInfo(0x10de, // Vendor ID - 0x0640); // Device ID - gpu_info_.SetDriverInfo("NVIDIA", // Driver vendor - "1.6.18", // Driver Version - "7-14-2009"); // Driver date - gpu_info_.SetLevel(GPUInfo::kComplete); + gpu_info_.vendor_id = 0x10de; + gpu_info_.device_id = 0x0640; + gpu_info_.driver_vendor = "NVIDIA"; + gpu_info_.driver_version = "1.6.18"; + gpu_info_.driver_date = "7-14-2009"; + gpu_info_.level = GPUInfo::kComplete; } void TearDown() { diff --git a/content/browser/gpu_process_host.cc b/content/browser/gpu_process_host.cc index 61936f6..e89a46e 100644 --- a/content/browser/gpu_process_host.cc +++ b/content/browser/gpu_process_host.cc @@ -17,7 +17,6 @@ #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/gpu_feature_flags.h" -#include "chrome/common/gpu_info.h" #include "chrome/common/gpu_messages.h" #include "chrome/common/render_messages.h" #include "chrome/gpu/gpu_thread.h" diff --git a/content/browser/renderer_host/gpu_message_filter.h b/content/browser/renderer_host/gpu_message_filter.h index 625afc6..7c0f398 100644 --- a/content/browser/renderer_host/gpu_message_filter.h +++ b/content/browser/renderer_host/gpu_message_filter.h @@ -8,10 +8,10 @@ #include "content/browser/browser_message_filter.h" -struct GPUCreateCommandBufferConfig; -class GPUInfo; class GpuProcessHost; class GpuProcessHostUIShim; +struct GPUCreateCommandBufferConfig; +struct GPUInfo; namespace IPC { struct ChannelHandle; |