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

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

Issue 1510233002: clang/win: Fix -Wextra warnings in webrtc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: comments Created 5 years 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
« no previous file with comments | « webrtc/base/systeminfo.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 15 matching lines...) Expand all
26 26
27 namespace webrtc { 27 namespace webrtc {
28 28
29 // kMagnifierWindowClass has to be "Magnifier" according to the Magnification 29 // kMagnifierWindowClass has to be "Magnifier" according to the Magnification
30 // API. The other strings can be anything. 30 // API. The other strings can be anything.
31 static LPCTSTR kMagnifierHostClass = L"ScreenCapturerWinMagnifierHost"; 31 static LPCTSTR kMagnifierHostClass = L"ScreenCapturerWinMagnifierHost";
32 static LPCTSTR kHostWindowName = L"MagnifierHost"; 32 static LPCTSTR kHostWindowName = L"MagnifierHost";
33 static LPCTSTR kMagnifierWindowClass = L"Magnifier"; 33 static LPCTSTR kMagnifierWindowClass = L"Magnifier";
34 static LPCTSTR kMagnifierWindowName = L"MagnifierWindow"; 34 static LPCTSTR kMagnifierWindowName = L"MagnifierWindow";
35 35
36 Atomic32 ScreenCapturerWinMagnifier::tls_index_(TLS_OUT_OF_INDEXES); 36 int32_t kTlsIndexNotSet = 0; // Should not be a valid pointer.
Sergey Ulanov 2015/12/09 22:31:51 Not sure we can use 0 here. Can TlsAlloc() return
Nico 2015/12/10 15:05:46 Hm, you're right. Reverted this to patch set 1.
Sergey Ulanov 2015/12/10 17:29:55 Sorry for not being clear, what I was suggesting i
37 Atomic32 ScreenCapturerWinMagnifier::tls_index_(kTlsIndexNotSet);
37 38
38 ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier( 39 ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier(
39 rtc::scoped_ptr<ScreenCapturer> fallback_capturer) 40 rtc::scoped_ptr<ScreenCapturer> fallback_capturer)
40 : fallback_capturer_(fallback_capturer.Pass()), 41 : fallback_capturer_(fallback_capturer.Pass()),
41 fallback_capturer_started_(false), 42 fallback_capturer_started_(false),
42 callback_(NULL), 43 callback_(NULL),
43 current_screen_id_(kFullDesktopScreenId), 44 current_screen_id_(kFullDesktopScreenId),
44 excluded_window_(NULL), 45 excluded_window_(NULL),
45 set_thread_execution_state_failed_(false), 46 set_thread_execution_state_failed_(false),
46 desktop_dc_(NULL), 47 desktop_dc_(NULL),
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 230
230 BOOL ScreenCapturerWinMagnifier::OnMagImageScalingCallback( 231 BOOL ScreenCapturerWinMagnifier::OnMagImageScalingCallback(
231 HWND hwnd, 232 HWND hwnd,
232 void* srcdata, 233 void* srcdata,
233 MAGIMAGEHEADER srcheader, 234 MAGIMAGEHEADER srcheader,
234 void* destdata, 235 void* destdata,
235 MAGIMAGEHEADER destheader, 236 MAGIMAGEHEADER destheader,
236 RECT unclipped, 237 RECT unclipped,
237 RECT clipped, 238 RECT clipped,
238 HRGN dirty) { 239 HRGN dirty) {
239 assert(tls_index_.Value() != TLS_OUT_OF_INDEXES); 240 assert(tls_index_.Value() != kTlsIndexNotSet);
240 241
241 ScreenCapturerWinMagnifier* owner = 242 ScreenCapturerWinMagnifier* owner =
242 reinterpret_cast<ScreenCapturerWinMagnifier*>( 243 reinterpret_cast<ScreenCapturerWinMagnifier*>(
243 TlsGetValue(tls_index_.Value())); 244 TlsGetValue(tls_index_.Value()));
244 245
245 owner->OnCaptured(srcdata, srcheader); 246 owner->OnCaptured(srcdata, srcheader);
246 247
247 return TRUE; 248 return TRUE;
248 } 249 }
249 250
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 magnifier_window_, MW_FILTERMODE_EXCLUDE, 1, &excluded_window_); 363 magnifier_window_, MW_FILTERMODE_EXCLUDE, 1, &excluded_window_);
363 if (!result) { 364 if (!result) {
364 mag_uninitialize_func_(); 365 mag_uninitialize_func_();
365 LOG_F(LS_WARNING) << "Failed to initialize ScreenCapturerWinMagnifier: " 366 LOG_F(LS_WARNING) << "Failed to initialize ScreenCapturerWinMagnifier: "
366 << "error from MagSetWindowFilterList " 367 << "error from MagSetWindowFilterList "
367 << GetLastError(); 368 << GetLastError();
368 return false; 369 return false;
369 } 370 }
370 } 371 }
371 372
372 if (tls_index_.Value() == TLS_OUT_OF_INDEXES) { 373 if (tls_index_.Value() == kTlsIndexNotSet) {
373 // More than one threads may get here at the same time, but only one will 374 // More than one threads may get here at the same time, but only one will
374 // write to tls_index_ using CompareExchange. 375 // write to tls_index_ using CompareExchange.
375 DWORD new_tls_index = TlsAlloc(); 376 DWORD new_tls_index = TlsAlloc();
376 if (!tls_index_.CompareExchange(new_tls_index, TLS_OUT_OF_INDEXES)) 377 if (!tls_index_.CompareExchange(new_tls_index, kTlsIndexNotSet))
377 TlsFree(new_tls_index); 378 TlsFree(new_tls_index);
378 } 379 }
379 380
380 assert(tls_index_.Value() != TLS_OUT_OF_INDEXES); 381 assert(tls_index_.Value() != kTlsIndexNotSet);
381 TlsSetValue(tls_index_.Value(), this); 382 TlsSetValue(tls_index_.Value(), this);
382 383
383 magnifier_initialized_ = true; 384 magnifier_initialized_ = true;
384 return true; 385 return true;
385 } 386 }
386 387
387 void ScreenCapturerWinMagnifier::OnCaptured(void* data, 388 void ScreenCapturerWinMagnifier::OnCaptured(void* data,
388 const MAGIMAGEHEADER& header) { 389 const MAGIMAGEHEADER& header) {
389 DesktopFrame* current_frame = queue_.current_frame(); 390 DesktopFrame* current_frame = queue_.current_frame();
390 391
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 assert(fallback_capturer_); 441 assert(fallback_capturer_);
441 if (!fallback_capturer_started_) { 442 if (!fallback_capturer_started_) {
442 fallback_capturer_started_ = true; 443 fallback_capturer_started_ = true;
443 444
444 fallback_capturer_->Start(callback_); 445 fallback_capturer_->Start(callback_);
445 fallback_capturer_->SelectScreen(current_screen_id_); 446 fallback_capturer_->SelectScreen(current_screen_id_);
446 } 447 }
447 } 448 }
448 449
449 } // namespace webrtc 450 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/base/systeminfo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698