Chromium Code Reviews| Index: webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h |
| diff --git a/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..353f1515cb88c9eec5c5affb99bb510f16ca74e7 |
| --- /dev/null |
| +++ b/webrtc/modules/desktop_capture/screen_capturer_differ_wrapper.h |
| @@ -0,0 +1,56 @@ |
| +/* |
| + * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ |
| +#define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ |
| + |
| +#include <memory> |
| + |
| +#include "webrtc/modules/desktop_capture/screen_capturer.h" |
| +#include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
| + |
| +namespace webrtc { |
| + |
| +class Differ; |
| + |
| +// A ScreenCapturer implementation to forward capture requests to the underlying |
| +// implementation, and help to calculate the dirty region. |
| +// This class expects the input ScreenCapturer uses SharedDesktopFrame to return |
| +// captured DesktopFrames. |
| +class ScreenCapturerDifferWrapper |
|
Jamie
2016/08/03 23:52:26
This class is not currently being used. Will there
Hzj_jie
2016/08/04 02:28:07
Exactly. Bug 633802 is opened to track all the wor
|
| + : public ScreenCapturer, public DesktopCapturer::Callback { |
|
Sergey Ulanov
2016/08/03 23:19:11
Potentially the same mechanism could work for wind
Sergey Ulanov
2016/08/03 23:19:11
git cl format
btw, you can get clang-format integ
Hzj_jie
2016/08/04 02:28:07
Done.
Hzj_jie
2016/08/04 02:28:07
Sure. We can discuss it later.
Hzj_jie
2016/08/04 03:28:43
And I also found,
1. Nobody, both ScreenCapturer a
|
| + public: |
| + // Creates a ScreenCapturerDifferWrapper with a ScreenCapturer implementation, |
| + // and takes ownership. |
| + explicit ScreenCapturerDifferWrapper(std::unique_ptr<ScreenCapturer> impl); |
|
Sergey Ulanov
2016/08/03 23:19:12
|impl| is not the best name. maybe call it base_ca
Hzj_jie
2016/08/04 02:28:07
Done.
|
| + ~ScreenCapturerDifferWrapper() override; |
| + |
| + void Start(DesktopCapturer::Callback* callback) override; |
|
Sergey Ulanov
2016/08/03 23:19:11
// ScreenCapturer interface.
Hzj_jie
2016/08/04 02:28:07
Done.
|
| + void SetSharedMemoryFactory( |
| + std::unique_ptr<SharedMemoryFactory> shared_memory_factory) override; |
| + void Capture(const DesktopRegion& region) override; |
| + bool GetScreenList(ScreenList* screens) override; |
| + bool SelectScreen(ScreenId id) override; |
| + |
| + // Catches callback from underlying implementation, uses Differ to update |
|
Sergey Ulanov
2016/08/03 23:19:11
I don't think you really need this comment here. I
Hzj_jie
2016/08/04 02:28:07
Done.
|
| + // |frame|->updated_region(), and calls callback_. |
|
Sergey Ulanov
2016/08/03 23:19:12
Add
// DesktopCapturer::Callback interface.
mov
Hzj_jie
2016/08/04 02:28:07
Done.
|
| + void OnCaptureResult(Result result, |
| + std::unique_ptr<DesktopFrame> frame) override; |
| + |
| + private: |
| + std::unique_ptr<ScreenCapturer> impl_; |
|
Sergey Ulanov
2016/08/03 23:19:11
base_capturer_?
Hzj_jie
2016/08/04 02:28:07
Done.
|
| + DesktopCapturer::Callback* callback_; |
| + std::unique_ptr<SharedDesktopFrame> last_frame_; |
| + std::unique_ptr<Differ> differ_; |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_DIFFER_WRAPPER_H_ |