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

Side by Side Diff: webrtc/modules/desktop_capture/win/dxgi_adapter_duplicator.cc

Issue 2988153003: Replace CHECK(x && y) with two separate CHECK() calls (Closed)
Patch Set: fix mistakes Created 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 target)) { 127 target)) {
128 return false; 128 return false;
129 } 129 }
130 } 130 }
131 return true; 131 return true;
132 } 132 }
133 133
134 bool DxgiAdapterDuplicator::DuplicateMonitor(Context* context, 134 bool DxgiAdapterDuplicator::DuplicateMonitor(Context* context,
135 int monitor_id, 135 int monitor_id,
136 SharedDesktopFrame* target) { 136 SharedDesktopFrame* target) {
137 RTC_DCHECK(monitor_id >= 0 && 137 RTC_DCHECK_GE(monitor_id, 0);
138 monitor_id < static_cast<int>(duplicators_.size()) && 138 RTC_DCHECK_LT(monitor_id, duplicators_.size());
139 context->contexts.size() == duplicators_.size()); 139 RTC_DCHECK_EQ(context->contexts.size(), duplicators_.size());
140 return duplicators_[monitor_id].Duplicate(&context->contexts[monitor_id], 140 return duplicators_[monitor_id].Duplicate(&context->contexts[monitor_id],
141 DesktopVector(), target); 141 DesktopVector(), target);
142 } 142 }
143 143
144 DesktopRect DxgiAdapterDuplicator::ScreenRect(int id) const { 144 DesktopRect DxgiAdapterDuplicator::ScreenRect(int id) const {
145 RTC_DCHECK(id >= 0 && id < static_cast<int>(duplicators_.size())); 145 RTC_DCHECK_GE(id, 0);
146 RTC_DCHECK_LT(id, duplicators_.size());
146 return duplicators_[id].desktop_rect(); 147 return duplicators_[id].desktop_rect();
147 } 148 }
148 149
149 const std::string& DxgiAdapterDuplicator::GetDeviceName(int id) const { 150 const std::string& DxgiAdapterDuplicator::GetDeviceName(int id) const {
150 RTC_DCHECK(id >= 0 && id < static_cast<int>(duplicators_.size())); 151 RTC_DCHECK_GE(id, 0);
152 RTC_DCHECK_LT(id, duplicators_.size());
151 return duplicators_[id].device_name(); 153 return duplicators_[id].device_name();
152 } 154 }
153 155
154 int DxgiAdapterDuplicator::screen_count() const { 156 int DxgiAdapterDuplicator::screen_count() const {
155 return static_cast<int>(duplicators_.size()); 157 return static_cast<int>(duplicators_.size());
156 } 158 }
157 159
158 int64_t DxgiAdapterDuplicator::GetNumFramesCaptured() const { 160 int64_t DxgiAdapterDuplicator::GetNumFramesCaptured() const {
159 int64_t min = INT64_MAX; 161 int64_t min = INT64_MAX;
160 for (const auto& duplicator : duplicators_) { 162 for (const auto& duplicator : duplicators_) {
161 min = std::min(min, duplicator.num_frames_captured()); 163 min = std::min(min, duplicator.num_frames_captured());
162 } 164 }
163 165
164 return min; 166 return min;
165 } 167 }
166 168
167 void DxgiAdapterDuplicator::TranslateRect(const DesktopVector& position) { 169 void DxgiAdapterDuplicator::TranslateRect(const DesktopVector& position) {
168 desktop_rect_.Translate(position); 170 desktop_rect_.Translate(position);
169 RTC_DCHECK(desktop_rect_.left() >= 0 && desktop_rect_.top() >= 0); 171 RTC_DCHECK_GE(desktop_rect_.left(), 0);
172 RTC_DCHECK_GE(desktop_rect_.top(), 0);
170 for (auto& duplicator : duplicators_) { 173 for (auto& duplicator : duplicators_) {
171 duplicator.TranslateRect(position); 174 duplicator.TranslateRect(position);
172 } 175 }
173 } 176 }
174 177
175 } // namespace webrtc 178 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698