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

Unified Diff: remoting/host/host_attributes.cc

Issue 2941623003: [Chromoting] Use latest API to check whether DX capturer is supported (Closed)
Patch Set: Remove DirectX-Capturer attribute, use Windows version instead Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_attributes.cc
diff --git a/remoting/host/host_attributes.cc b/remoting/host/host_attributes.cc
index 307d04e289fd66c4df9a4ed1219155dcf2904287..9b4cd76aa9d0dc045a5ed380787871659f043d7b 100644
--- a/remoting/host/host_attributes.cc
+++ b/remoting/host/host_attributes.cc
@@ -13,6 +13,9 @@
#include "base/atomicops.h"
#include "base/logging.h"
#include "base/macros.h"
+#include "base/strings/string_piece.h"
+#include "base/strings/string_util.h"
+#include "base/win/windows_version.h"
#include "build/build_config.h"
#if defined(OS_WIN)
@@ -23,6 +26,7 @@
namespace remoting {
namespace {
+
static constexpr char kSeparator[] = ",";
struct Attribute {
@@ -64,32 +68,6 @@ inline constexpr bool IsNonOfficialBuild() {
return !IsOfficialBuild();
}
-#if defined(OS_WIN)
-inline bool MinD3DFeatureLevelGreatThan10() {
- webrtc::DxgiDuplicatorController::D3dInfo info;
- if (webrtc::DxgiDuplicatorController::Instance()->RetrieveD3dInfo(&info)) {
- return info.min_feature_level >= D3D_FEATURE_LEVEL_10_0;
- }
- return false;
-}
-
-inline bool MinD3DFeatureLevelGreatThan11() {
- webrtc::DxgiDuplicatorController::D3dInfo info;
- if (webrtc::DxgiDuplicatorController::Instance()->RetrieveD3dInfo(&info)) {
- return info.min_feature_level >= D3D_FEATURE_LEVEL_11_0;
- }
- return false;
-}
-
-inline bool MinD3DFeatureLevelGreatThan12() {
- webrtc::DxgiDuplicatorController::D3dInfo info;
- if (webrtc::DxgiDuplicatorController::Instance()->RetrieveD3dInfo(&info)) {
- return info.min_feature_level >= D3D_FEATURE_LEVEL_12_0;
- }
- return false;
-}
-#endif
-
// By using arraysize() macro in base/macros.h, it's illegal to have empty
// arrays.
//
@@ -106,12 +84,6 @@ static constexpr Attribute kAttributes[] = {
{ "ChromiumBrand", &IsChromiumBranded },
{ "OfficialBuild", &IsOfficialBuild },
{ "NonOfficialBuild", &IsNonOfficialBuild },
-#if defined(OS_WIN)
- { "DirectX-Capturer", &webrtc::ScreenCapturerWinDirectx::IsSupported },
- { "MinD3DGT10", &MinD3DFeatureLevelGreatThan10 },
- { "MinD3DGT11", &MinD3DFeatureLevelGreatThan11 },
- { "MinD3DGT12", &MinD3DFeatureLevelGreatThan12 },
-#endif
};
} // namespace
@@ -119,7 +91,7 @@ static constexpr Attribute kAttributes[] = {
static_assert(std::is_pod<Attribute>::value, "Attribute should be POD.");
std::string GetHostAttributes() {
- std::string result;
+ std::vector<base::StringPiece> result;
// By using ranged for-loop, MSVC throws error C3316:
// 'const remoting::StaticAttribute [0]':
// an array of unknown size cannot be used in a range-based for statement.
@@ -127,14 +99,37 @@ std::string GetHostAttributes() {
const auto& attribute = kAttributes[i];
DCHECK_EQ(std::string(attribute.name).find(kSeparator), std::string::npos);
if (attribute.get_value_func()) {
- if (!result.empty()) {
- result.append(kSeparator);
- }
- result.append(attribute.name);
+ result.push_back(attribute.name);
}
}
+#if defined(OS_WIN)
+ {
+ webrtc::DxgiDuplicatorController::D3dInfo info;
+ webrtc::ScreenCapturerWinDirectx::RetrieveD3dInfo(&info);
+ if (info.min_feature_level >= D3D_FEATURE_LEVEL_10_0) {
+ result.push_back("MinD3DGT10");
+ }
+ if (info.min_feature_level >= D3D_FEATURE_LEVEL_11_0) {
+ result.push_back("MinD3DGT11");
+ }
+ if (info.min_feature_level >= D3D_FEATURE_LEVEL_12_0) {
+ result.push_back("MinD3DGT12");
+ }
+
+ auto version = base::win::GetVersion();
+ if (version >= base::win::VERSION_WIN8) {
+ result.push_back("Win8+");
+ }
+ if (version >= base::win::VERSION_WIN8_1) {
+ result.push_back("Win81+");
+ }
+ if (version >= base::win::VERSION_WIN10) {
+ result.push_back("Win10+");
+ }
+ }
+#endif
- return result;
+ return base::JoinString(result, kSeparator);
}
} // namespace remoting
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698