OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "remoting/host/host_attributes.h" | 5 #include "remoting/host/host_attributes.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <D3DCommon.h> | 8 #include <D3DCommon.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 #endif | 60 #endif |
61 } | 61 } |
62 | 62 |
63 inline constexpr bool IsNonOfficialBuild() { | 63 inline constexpr bool IsNonOfficialBuild() { |
64 return !IsOfficialBuild(); | 64 return !IsOfficialBuild(); |
65 } | 65 } |
66 | 66 |
67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
68 inline bool MinD3DFeatureLevelGreatThan10() { | 68 inline bool MinD3DFeatureLevelGreatThan10() { |
69 webrtc::DxgiDuplicatorController::D3dInfo info; | 69 webrtc::DxgiDuplicatorController::D3dInfo info; |
70 if (webrtc::DxgiDuplicatorController::Instance()->RetrieveD3dInfo(&info)) { | 70 if (webrtc::ScreenCapturerWinDirectx::RetrieveD3dInfo(&info)) { |
Sergey Ulanov
2017/06/26 23:55:23
Where is the change that made RetrieveD3dInfo() st
Hzj_jie
2017/06/27 04:37:28
No, it's always static (https://cs.chromium.org/ch
| |
71 return info.min_feature_level >= D3D_FEATURE_LEVEL_10_0; | 71 return info.min_feature_level >= D3D_FEATURE_LEVEL_10_0; |
72 } | 72 } |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 inline bool MinD3DFeatureLevelGreatThan11() { | 76 inline bool MinD3DFeatureLevelGreatThan11() { |
77 webrtc::DxgiDuplicatorController::D3dInfo info; | 77 webrtc::DxgiDuplicatorController::D3dInfo info; |
78 if (webrtc::DxgiDuplicatorController::Instance()->RetrieveD3dInfo(&info)) { | 78 if (webrtc::ScreenCapturerWinDirectx::RetrieveD3dInfo(&info)) { |
79 return info.min_feature_level >= D3D_FEATURE_LEVEL_11_0; | 79 return info.min_feature_level >= D3D_FEATURE_LEVEL_11_0; |
80 } | 80 } |
81 return false; | 81 return false; |
82 } | 82 } |
83 | 83 |
84 inline bool MinD3DFeatureLevelGreatThan12() { | 84 inline bool MinD3DFeatureLevelGreatThan12() { |
85 webrtc::DxgiDuplicatorController::D3dInfo info; | 85 webrtc::DxgiDuplicatorController::D3dInfo info; |
86 if (webrtc::DxgiDuplicatorController::Instance()->RetrieveD3dInfo(&info)) { | 86 if (webrtc::ScreenCapturerWinDirectx::RetrieveD3dInfo(&info)) { |
87 return info.min_feature_level >= D3D_FEATURE_LEVEL_12_0; | 87 return info.min_feature_level >= D3D_FEATURE_LEVEL_12_0; |
88 } | 88 } |
89 return false; | 89 return false; |
90 } | 90 } |
91 #endif | 91 #endif |
92 | 92 |
93 // By using arraysize() macro in base/macros.h, it's illegal to have empty | 93 // By using arraysize() macro in base/macros.h, it's illegal to have empty |
94 // arrays. | 94 // arrays. |
95 // | 95 // |
96 // error: no matching function for call to 'ArraySizeHelper' | 96 // error: no matching function for call to 'ArraySizeHelper' |
(...skipping 15 matching lines...) Expand all Loading... | |
112 { "MinD3DGT11", &MinD3DFeatureLevelGreatThan11 }, | 112 { "MinD3DGT11", &MinD3DFeatureLevelGreatThan11 }, |
113 { "MinD3DGT12", &MinD3DFeatureLevelGreatThan12 }, | 113 { "MinD3DGT12", &MinD3DFeatureLevelGreatThan12 }, |
114 #endif | 114 #endif |
115 }; | 115 }; |
116 | 116 |
117 } // namespace | 117 } // namespace |
118 | 118 |
119 static_assert(std::is_pod<Attribute>::value, "Attribute should be POD."); | 119 static_assert(std::is_pod<Attribute>::value, "Attribute should be POD."); |
120 | 120 |
121 std::string GetHostAttributes() { | 121 std::string GetHostAttributes() { |
122 #if defined(OS_WIN) | |
123 // Ensure the following ScreenCapturerWinDirectx contructions won't | |
124 // initialize and unload DxgiDuplicatorController. | |
Sergey Ulanov
2017/06/26 23:55:23
This doesn't look like the best solution. GetHostA
Hzj_jie
2017/06/27 04:37:28
Done.
| |
125 auto controller = webrtc::DxgiDuplicatorController::Instance(); | |
126 #endif | |
122 std::string result; | 127 std::string result; |
123 // By using ranged for-loop, MSVC throws error C3316: | 128 // By using ranged for-loop, MSVC throws error C3316: |
124 // 'const remoting::StaticAttribute [0]': | 129 // 'const remoting::StaticAttribute [0]': |
125 // an array of unknown size cannot be used in a range-based for statement. | 130 // an array of unknown size cannot be used in a range-based for statement. |
126 for (size_t i = 0; i < arraysize(kAttributes); i++) { | 131 for (size_t i = 0; i < arraysize(kAttributes); i++) { |
127 const auto& attribute = kAttributes[i]; | 132 const auto& attribute = kAttributes[i]; |
128 DCHECK_EQ(std::string(attribute.name).find(kSeparator), std::string::npos); | 133 DCHECK_EQ(std::string(attribute.name).find(kSeparator), std::string::npos); |
129 if (attribute.get_value_func()) { | 134 if (attribute.get_value_func()) { |
130 if (!result.empty()) { | 135 if (!result.empty()) { |
131 result.append(kSeparator); | 136 result.append(kSeparator); |
132 } | 137 } |
133 result.append(attribute.name); | 138 result.append(attribute.name); |
134 } | 139 } |
135 } | 140 } |
141 #if defined(OS_WIN) | |
142 // Avoid the warning of unused variable. | |
143 controller = nullptr; | |
144 #endif | |
136 | 145 |
137 return result; | 146 return result; |
138 } | 147 } |
139 | 148 |
140 } // namespace remoting | 149 } // namespace remoting |
OLD | NEW |