From cec4343fb42ddfea6063aa5b88968c4ff2bedcf8 Mon Sep 17 00:00:00 2001 From: Artem Titov Date: Wed, 28 Jul 2021 23:35:39 +0200 Subject: [PATCH] Use backticks not vertical bars to denote variables in comments for /modules/desktop_capture Bug: webrtc:12338 Change-Id: I300ba78fc4423db7030e555d7e51d2cb2246e9a4 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227162 Reviewed-by: Harald Alvestrand Commit-Queue: Artem Titov Cr-Commit-Position: refs/heads/master@{#34678} --- .../blank_detector_desktop_capturer_wrapper.h | 6 +- .../desktop_capture/cropped_desktop_frame.h | 10 +- .../cropped_desktop_frame_unittest.cc | 2 +- .../cropping_window_capturer.h | 2 +- .../cropping_window_capturer_win.cc | 16 +- .../desktop_and_cursor_composer.cc | 6 +- .../desktop_and_cursor_composer.h | 2 +- .../desktop_and_cursor_composer_unittest.cc | 6 +- .../desktop_capture/desktop_capture_options.h | 6 +- .../desktop_capture/desktop_capture_types.h | 2 +- modules/desktop_capture/desktop_capturer.h | 12 +- .../desktop_capturer_differ_wrapper.cc | 16 +- ...esktop_capturer_differ_wrapper_unittest.cc | 24 +- modules/desktop_capture/desktop_frame.h | 20 +- .../desktop_frame_generator.cc | 12 +- .../desktop_capture/desktop_frame_generator.h | 8 +- .../desktop_capture/desktop_frame_rotation.cc | 2 +- .../desktop_capture/desktop_frame_rotation.h | 22 +- modules/desktop_capture/desktop_geometry.h | 24 +- modules/desktop_capture/desktop_region.cc | 76 +- modules/desktop_capture/desktop_region.h | 26 +- modules/desktop_capture/differ_block.h | 2 +- .../desktop_capture/fake_desktop_capturer.cc | 4 +- .../desktop_capture/fake_desktop_capturer.h | 4 +- .../fallback_desktop_capturer_wrapper.cc | 6 +- .../linux/mouse_cursor_monitor_x11.cc | 14 +- .../linux/mouse_cursor_monitor_x11.h | 2 +- .../linux/screen_capturer_x11.cc | 8 +- .../linux/screen_capturer_x11.h | 6 +- .../desktop_capture/linux/shared_x_display.cc | 2 +- .../desktop_capture/linux/shared_x_display.h | 12 +- .../linux/window_capturer_x11.h | 2 +- .../linux/window_list_utils.cc | 4 +- .../desktop_capture/linux/window_list_utils.h | 20 +- .../linux/x_server_pixel_buffer.cc | 10 +- .../linux/x_server_pixel_buffer.h | 6 +- .../mac/desktop_configuration.h | 2 +- .../mac/desktop_configuration.mm | 6 +- .../mac/desktop_frame_cgimage.h | 2 +- .../mac/desktop_frame_iosurface.h | 2 +- .../mac/desktop_frame_provider.h | 2 +- .../mac/screen_capturer_mac.mm | 18 +- .../desktop_capture/mac/window_list_utils.cc | 8 +- .../desktop_capture/mac/window_list_utils.h | 38 +- modules/desktop_capture/mouse_cursor.h | 2 +- .../desktop_capture/mouse_cursor_monitor.h | 12 +- modules/desktop_capture/resolution_tracker.h | 4 +- modules/desktop_capture/rgba_color.h | 4 +- .../screen_capture_frame_queue.h | 2 +- .../desktop_capture/screen_capturer_helper.cc | 8 +- .../desktop_capture/screen_capturer_helper.h | 12 +- .../screen_capturer_integration_test.cc | 18 +- .../desktop_capture/screen_capturer_win.cc | 2 +- modules/desktop_capture/screen_drawer.h | 4 +- .../desktop_capture/screen_drawer_unittest.cc | 2 +- modules/desktop_capture/screen_drawer_win.cc | 6 +- .../desktop_capture/shared_desktop_frame.h | 2 +- modules/desktop_capture/test_utils.h | 4 +- modules/desktop_capture/win/cursor.cc | 6 +- modules/desktop_capture/win/cursor.h | 2 +- .../desktop_capture/win/cursor_unittest.cc | 18 +- modules/desktop_capture/win/desktop.h | 4 +- .../win/dxgi_adapter_duplicator.h | 12 +- modules/desktop_capture/win/dxgi_context.h | 2 +- .../win/dxgi_duplicator_controller.cc | 10 +- .../win/dxgi_duplicator_controller.h | 32 +- modules/desktop_capture/win/dxgi_frame.h | 2 +- .../win/dxgi_output_duplicator.cc | 10 +- .../win/dxgi_output_duplicator.h | 14 +- modules/desktop_capture/win/dxgi_texture.h | 2 +- .../win/dxgi_texture_mapping.h | 2 +- .../full_screen_win_application_handler.cc | 8 +- .../win/scoped_thread_desktop.h | 6 +- .../win/screen_capture_utils.cc | 4 +- .../win/screen_capture_utils.h | 20 +- .../win/screen_capturer_win_directx.h | 12 +- .../win/screen_capturer_win_magnifier.h | 4 +- .../win/wgc_capture_session.cc | 744 +++++++++--------- .../desktop_capture/win/wgc_capture_session.h | 220 +++--- .../desktop_capture/win/wgc_capture_source.cc | 2 +- .../desktop_capture/win/wgc_capture_source.h | 2 +- .../desktop_capture/win/wgc_capturer_win.cc | 436 +++++----- .../desktop_capture/win/wgc_capturer_win.h | 276 +++---- .../win/wgc_capturer_win_unittest.cc | 2 +- .../desktop_capture/win/wgc_desktop_frame.h | 2 +- .../win/window_capture_utils.cc | 6 +- .../win/window_capture_utils.h | 24 +- .../win/window_capture_utils_unittest.cc | 309 ++++---- .../win/window_capturer_win_gdi.cc | 14 +- .../win/window_capturer_win_gdi.h | 156 ++-- modules/desktop_capture/window_finder.h | 10 +- 91 files changed, 1468 insertions(+), 1467 deletions(-) diff --git a/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.h b/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.h index 46ba5257fe..f5c2ce201b 100644 --- a/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.h +++ b/modules/desktop_capture/blank_detector_desktop_capturer_wrapper.h @@ -31,8 +31,8 @@ class BlankDetectorDesktopCapturerWrapper final public DesktopCapturer::Callback { public: // Creates BlankDetectorDesktopCapturerWrapper. BlankDesktopCapturerWrapper - // takes ownership of |capturer|. The |blank_pixel| is the unmodified color - // returned by the |capturer|. + // takes ownership of `capturer`. The `blank_pixel` is the unmodified color + // returned by the `capturer`. BlankDetectorDesktopCapturerWrapper(std::unique_ptr capturer, RgbaColor blank_pixel); ~BlankDetectorDesktopCapturerWrapper() override; @@ -55,7 +55,7 @@ class BlankDetectorDesktopCapturerWrapper final bool IsBlankFrame(const DesktopFrame& frame) const; - // Detects whether pixel at (x, y) equals to |blank_pixel_|. + // Detects whether pixel at (x, y) equals to `blank_pixel_`. bool IsBlankPixel(const DesktopFrame& frame, int x, int y) const; const std::unique_ptr capturer_; diff --git a/modules/desktop_capture/cropped_desktop_frame.h b/modules/desktop_capture/cropped_desktop_frame.h index bbc3c86cad..5c672c7d32 100644 --- a/modules/desktop_capture/cropped_desktop_frame.h +++ b/modules/desktop_capture/cropped_desktop_frame.h @@ -19,11 +19,11 @@ namespace webrtc { -// Creates a DesktopFrame to contain only the area of |rect| in the original -// |frame|. -// |frame| should not be nullptr. |rect| is in |frame| coordinate, i.e. -// |frame|->top_left() does not impact the area of |rect|. -// Returns nullptr frame if |rect| is not contained by the bounds of |frame|. +// Creates a DesktopFrame to contain only the area of `rect` in the original +// `frame`. +// `frame` should not be nullptr. `rect` is in `frame` coordinate, i.e. +// `frame`->top_left() does not impact the area of `rect`. +// Returns nullptr frame if `rect` is not contained by the bounds of `frame`. std::unique_ptr RTC_EXPORT CreateCroppedDesktopFrame(std::unique_ptr frame, const DesktopRect& rect); diff --git a/modules/desktop_capture/cropped_desktop_frame_unittest.cc b/modules/desktop_capture/cropped_desktop_frame_unittest.cc index c4ccb87596..ff9b8ca456 100644 --- a/modules/desktop_capture/cropped_desktop_frame_unittest.cc +++ b/modules/desktop_capture/cropped_desktop_frame_unittest.cc @@ -25,7 +25,7 @@ std::unique_ptr CreateTestFrame() { TEST(CroppedDesktopFrameTest, DoNotCreateWrapperIfSizeIsNotChanged) { std::unique_ptr original = CreateTestFrame(); - // owned by |original| and CroppedDesktopFrame. + // owned by `original` and CroppedDesktopFrame. DesktopFrame* raw_original = original.get(); std::unique_ptr cropped = CreateCroppedDesktopFrame( std::move(original), DesktopRect::MakeWH(10, 20)); diff --git a/modules/desktop_capture/cropping_window_capturer.h b/modules/desktop_capture/cropping_window_capturer.h index 272a196972..56478030b1 100644 --- a/modules/desktop_capture/cropping_window_capturer.h +++ b/modules/desktop_capture/cropping_window_capturer.h @@ -45,7 +45,7 @@ class RTC_EXPORT CroppingWindowCapturer : public DesktopCapturer, bool FocusOnSelectedSource() override; bool IsOccluded(const DesktopVector& pos) override; - // DesktopCapturer::Callback implementation, passed to |screen_capturer_| to + // DesktopCapturer::Callback implementation, passed to `screen_capturer_` to // intercept the capture result. void OnCaptureResult(DesktopCapturer::Result result, std::unique_ptr frame) override; diff --git a/modules/desktop_capture/cropping_window_capturer_win.cc b/modules/desktop_capture/cropping_window_capturer_win.cc index 31ddbe1b33..a8eacde62e 100644 --- a/modules/desktop_capture/cropping_window_capturer_win.cc +++ b/modules/desktop_capture/cropping_window_capturer_win.cc @@ -247,7 +247,7 @@ bool CroppingWindowCapturerWin::ShouldUseScreenCapturer() { } if (region_type == SIMPLEREGION) { - // The |region_rect| returned from GetRgnBox() is always in window + // The `region_rect` returned from GetRgnBox() is always in window // coordinate. region_rect.Translate(window_region_rect_.left(), window_region_rect_.top()); @@ -255,10 +255,10 @@ bool CroppingWindowCapturerWin::ShouldUseScreenCapturer() { // system permits drawing. // https://msdn.microsoft.com/en-us/library/windows/desktop/dd144950(v=vs.85).aspx. // - // |region_rect| should always be inside of |window_region_rect_|. So after - // the intersection, |window_region_rect_| == |region_rect|. If so, what's + // `region_rect` should always be inside of `window_region_rect_`. So after + // the intersection, `window_region_rect_` == `region_rect`. If so, what's // the point of the intersecting operations? Why cannot we directly retrieve - // |window_region_rect_| from GetWindowRegionTypeWithBoundary() function? + // `window_region_rect_` from GetWindowRegionTypeWithBoundary() function? // TODO(zijiehe): Figure out the purpose of these intersections. window_region_rect_.IntersectWith(region_rect); content_rect.IntersectWith(region_rect); @@ -266,14 +266,14 @@ bool CroppingWindowCapturerWin::ShouldUseScreenCapturer() { // Check if the client area is out of the screen area. When the window is // maximized, only its client area is visible in the screen, the border will - // be hidden. So we are using |content_rect| here. + // be hidden. So we are using `content_rect` here. if (!GetFullscreenRect().ContainsRect(content_rect)) { return false; } // Check if the window is occluded by any other window, excluding the child - // windows, context menus, and |excluded_window_|. - // |content_rect| is preferred, see the comments on + // windows, context menus, and `excluded_window_`. + // `content_rect` is preferred, see the comments on // IsWindowIntersectWithSelectedWindow(). TopWindowVerifierContext context(selected, reinterpret_cast(excluded_window()), @@ -293,7 +293,7 @@ DesktopRect CroppingWindowCapturerWin::GetWindowRectInVirtualScreen() { } window_rect.IntersectWith(window_region_rect_); - // Convert |window_rect| to be relative to the top-left of the virtual screen. + // Convert `window_rect` to be relative to the top-left of the virtual screen. DesktopRect screen_rect(GetFullscreenRect()); window_rect.IntersectWith(screen_rect); window_rect.Translate(-screen_rect.left(), -screen_rect.top()); diff --git a/modules/desktop_capture/desktop_and_cursor_composer.cc b/modules/desktop_capture/desktop_and_cursor_composer.cc index 69b8b40c73..7be8982abe 100644 --- a/modules/desktop_capture/desktop_and_cursor_composer.cc +++ b/modules/desktop_capture/desktop_and_cursor_composer.cc @@ -64,7 +64,7 @@ void AlphaBlend(uint8_t* dest, // content before releasing the underlying frame. class DesktopFrameWithCursor : public DesktopFrame { public: - // Takes ownership of |frame|. + // Takes ownership of `frame`. DesktopFrameWithCursor(std::unique_ptr frame, const MouseCursor& cursor, const DesktopVector& position, @@ -113,7 +113,7 @@ DesktopFrameWithCursor::DesktopFrameWithCursor( if (cursor_rect_.is_empty()) return; - // Copy original screen content under cursor to |restore_frame_|. + // Copy original screen content under cursor to `restore_frame_`. restore_position_ = cursor_rect_.top_left(); restore_frame_.reset(new BasicDesktopFrame(cursor_rect_.size())); restore_frame_->CopyPixelsFrom(*this, cursor_rect_.top_left(), @@ -218,7 +218,7 @@ void DesktopAndCursorComposer::OnCaptureResult( // and location in logical(DIP) pixels on Retina monitor. This will cause // problem when the desktop is mixed with Retina and non-Retina monitors. // So we use DIP pixel for all location info and compensate with the scale - // factor of current frame to the |relative_position|. + // factor of current frame to the `relative_position`. const float scale = frame->scale_factor(); relative_position.set(relative_position.x() * scale, relative_position.y() * scale); diff --git a/modules/desktop_capture/desktop_and_cursor_composer.h b/modules/desktop_capture/desktop_and_cursor_composer.h index 8f95721ec2..a02705810c 100644 --- a/modules/desktop_capture/desktop_and_cursor_composer.h +++ b/modules/desktop_capture/desktop_and_cursor_composer.h @@ -35,7 +35,7 @@ class RTC_EXPORT DesktopAndCursorComposer public: // Creates a new composer that captures mouse cursor using // MouseCursorMonitor::Create(options) and renders it into the frames - // generated by |desktop_capturer|. + // generated by `desktop_capturer`. DesktopAndCursorComposer(std::unique_ptr desktop_capturer, const DesktopCaptureOptions& options); diff --git a/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc b/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc index 00253d38e2..5596576d9e 100644 --- a/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc +++ b/modules/desktop_capture/desktop_and_cursor_composer_unittest.cc @@ -201,7 +201,7 @@ class DesktopAndCursorComposerTest : public ::testing::Test, } protected: - // Owned by |blender_|. + // Owned by `blender_`. FakeScreenCapturer* fake_screen_; FakeMouseMonitor* fake_cursor_; @@ -280,7 +280,7 @@ TEST_F(DesktopAndCursorComposerTest, CursorShouldBeIgnoredIfFrameMayContainIt) { fake_cursor_->SetState(MouseCursorMonitor::INSIDE, abs_pos); blender_.CaptureFrame(); - // If the frame may already have contained the cursor, then |CaptureFrame()| + // If the frame may already have contained the cursor, then `CaptureFrame()` // should not have modified it, so it should be the same as the control. EXPECT_TRUE(frame_); const DesktopVector rel_pos(abs_pos.subtract(control_frame->top_left())); @@ -291,7 +291,7 @@ TEST_F(DesktopAndCursorComposerTest, CursorShouldBeIgnoredIfFrameMayContainIt) { control_frame->GetFrameDataAtPos(rel_pos))); } else { - // |CaptureFrame()| should have modified the frame to have the cursor. + // `CaptureFrame()` should have modified the frame to have the cursor. EXPECT_NE( *reinterpret_cast(frame_->GetFrameDataAtPos(rel_pos)), *reinterpret_cast( diff --git a/modules/desktop_capture/desktop_capture_options.h b/modules/desktop_capture/desktop_capture_options.h index a693803aa0..26eb0f535f 100644 --- a/modules/desktop_capture/desktop_capture_options.h +++ b/modules/desktop_capture/desktop_capture_options.h @@ -100,13 +100,13 @@ class RTC_EXPORT DesktopCaptureOptions { #if defined(WEBRTC_WIN) // Enumerating windows owned by the current process on Windows has some // complications due to |GetWindowText*()| APIs potentially causing a - // deadlock (see the comments in the |GetWindowListHandler()| function in + // deadlock (see the comments in the `GetWindowListHandler()` function in // window_capture_utils.cc for more details on the deadlock). // To avoid this issue, consumers can either ensure that the thread that runs - // their message loop never waits on |GetSourceList()|, or they can set this + // their message loop never waits on `GetSourceList()`, or they can set this // flag to false which will prevent windows running in the current process // from being enumerated and included in the results. Consumers can still - // provide the WindowId for their own windows to |SelectSource()| and capture + // provide the WindowId for their own windows to `SelectSource()` and capture // them. bool enumerate_current_process_windows() const { return enumerate_current_process_windows_; diff --git a/modules/desktop_capture/desktop_capture_types.h b/modules/desktop_capture/desktop_capture_types.h index 5f9966bb6d..4dcfc82708 100644 --- a/modules/desktop_capture/desktop_capture_types.h +++ b/modules/desktop_capture/desktop_capture_types.h @@ -39,7 +39,7 @@ const ScreenId kInvalidScreenId = -2; // Integers to attach to each DesktopFrame to differentiate the generator of // the frame. The entries in this namespace should remain in sync with the // SequentialDesktopCapturerId enum, which is logged via UMA. -// |kScreenCapturerWinGdi| and |kScreenCapturerWinDirectx| values are preserved +// `kScreenCapturerWinGdi` and `kScreenCapturerWinDirectx` values are preserved // to maintain compatibility namespace DesktopCapturerId { constexpr uint32_t CreateFourCC(char a, char b, char c, char d) { diff --git a/modules/desktop_capture/desktop_capturer.h b/modules/desktop_capture/desktop_capturer.h index 64339c0ca6..8a65e5759c 100644 --- a/modules/desktop_capture/desktop_capturer.h +++ b/modules/desktop_capture/desktop_capturer.h @@ -50,8 +50,8 @@ class RTC_EXPORT DesktopCapturer { // Interface that must be implemented by the DesktopCapturer consumers. class Callback { public: - // Called after a frame has been captured. |frame| is not nullptr if and - // only if |result| is SUCCESS. + // Called after a frame has been captured. `frame` is not nullptr if and + // only if `result` is SUCCESS. virtual void OnCaptureResult(Result result, std::unique_ptr frame) = 0; @@ -77,7 +77,7 @@ class RTC_EXPORT DesktopCapturer { virtual ~DesktopCapturer(); - // Called at the beginning of a capturing session. |callback| must remain + // Called at the beginning of a capturing session. `callback` must remain // valid until capturer is destroyed. virtual void Start(Callback* callback) = 0; @@ -120,11 +120,11 @@ class RTC_EXPORT DesktopCapturer { // implementation does not support this functionality. virtual bool FocusOnSelectedSource(); - // Returns true if the |pos| on the selected source is covered by other + // Returns true if the `pos` on the selected source is covered by other // elements on the display, and is not visible to the users. - // |pos| is in full desktop coordinates, i.e. the top-left monitor always + // `pos` is in full desktop coordinates, i.e. the top-left monitor always // starts from (0, 0). - // The return value if |pos| is out of the scope of the source is undefined. + // The return value if `pos` is out of the scope of the source is undefined. virtual bool IsOccluded(const DesktopVector& pos); // Creates a DesktopCapturer instance which targets to capture windows. diff --git a/modules/desktop_capture/desktop_capturer_differ_wrapper.cc b/modules/desktop_capture/desktop_capturer_differ_wrapper.cc index 4e80f30520..916d76f7ce 100644 --- a/modules/desktop_capture/desktop_capturer_differ_wrapper.cc +++ b/modules/desktop_capture/desktop_capturer_differ_wrapper.cc @@ -25,8 +25,8 @@ namespace webrtc { namespace { -// Returns true if (0, 0) - (|width|, |height|) vector in |old_buffer| and -// |new_buffer| are equal. |width| should be less than 32 +// Returns true if (0, 0) - (`width`, `height`) vector in `old_buffer` and +// `new_buffer` are equal. `width` should be less than 32 // (defined by kBlockSize), otherwise BlockDifference() should be used. bool PartialBlockDifference(const uint8_t* old_buffer, const uint8_t* new_buffer, @@ -45,9 +45,9 @@ bool PartialBlockDifference(const uint8_t* old_buffer, return false; } -// Compares columns in the range of [|left|, |right|), in a row in the -// range of [|top|, |top| + |height|), starts from |old_buffer| and -// |new_buffer|, and outputs updated regions into |output|. |stride| is the +// Compares columns in the range of [`left`, `right`), in a row in the +// range of [`top`, `top` + `height`), starts from `old_buffer` and +// `new_buffer`, and outputs updated regions into `output`. `stride` is the // DesktopFrame::stride(). void CompareRow(const uint8_t* old_buffer, const uint8_t* new_buffer, @@ -68,7 +68,7 @@ void CompareRow(const uint8_t* old_buffer, // The first block-column in a continuous dirty area in current block-row. int first_dirty_x_block = -1; - // We always need to add dirty area into |output| in the last block, so handle + // We always need to add dirty area into `output` in the last block, so handle // it separatedly. for (int x = 0; x < block_count; x++) { if (BlockDifference(old_buffer, new_buffer, height, stride)) { @@ -109,8 +109,8 @@ void CompareRow(const uint8_t* old_buffer, } } -// Compares |rect| area in |old_frame| and |new_frame|, and outputs dirty -// regions into |output|. +// Compares `rect` area in `old_frame` and `new_frame`, and outputs dirty +// regions into `output`. void CompareFrames(const DesktopFrame& old_frame, const DesktopFrame& new_frame, DesktopRect rect, diff --git a/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc b/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc index d16390dee4..9ccef3cc10 100644 --- a/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc +++ b/modules/desktop_capture/desktop_capturer_differ_wrapper_unittest.cc @@ -29,9 +29,9 @@ namespace webrtc { namespace { -// Compares and asserts |frame|.updated_region() equals to |rects|. This -// function does not care about the order of the |rects| and it does not expect -// DesktopRegion to return an exact area for each rectangle in |rects|. +// Compares and asserts `frame`.updated_region() equals to `rects`. This +// function does not care about the order of the `rects` and it does not expect +// DesktopRegion to return an exact area for each rectangle in `rects`. template