mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-16 23:30:48 +01:00

This is in preparation for deleting the include in rtc_base/refcount.h,
but that change has to wait for some downstream applications to
not rely in the indirect include.
Partial reland of "Make rtc_base/refcount.h self contained, not including refcountedobject.h."
This is a reland of b7239a9dc8
Original change's description:
> Make rtc_base/refcount.h self contained, not including refcountedobject.h.
>
> The refcount.h file doesn't depend on anything from
> refcountedobject.h. The motivation of this change to make it possible
> to add additional declarations to refcount.h, and include it from
> refcountedobject.h.
>
> Bug: webrtc:8270
> Change-Id: I24f6131f471e675570968d00065ff9b1f55e3373
> Reviewed-on: https://webrtc-review.googlesource.com/5760
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Commit-Queue: Niels Moller <nisse@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#20106}
Bug: webrtc:8270
Change-Id: I63a42712f6c1ec83823c629d1a954fd1a04d4a6c
Reviewed-on: https://webrtc-review.googlesource.com/7281
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20185}
63 lines
2 KiB
C++
63 lines
2 KiB
C++
/*
|
|
* Copyright (c) 2013 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 MODULES_DESKTOP_CAPTURE_SHARED_DESKTOP_FRAME_H_
|
|
#define MODULES_DESKTOP_CAPTURE_SHARED_DESKTOP_FRAME_H_
|
|
|
|
#include "modules/desktop_capture/desktop_frame.h"
|
|
#include "rtc_base/constructormagic.h"
|
|
#include "rtc_base/refcount.h"
|
|
#include "rtc_base/refcountedobject.h"
|
|
#include "rtc_base/scoped_ref_ptr.h"
|
|
|
|
namespace webrtc {
|
|
|
|
// SharedDesktopFrame is a DesktopFrame that may have multiple instances all
|
|
// sharing the same buffer.
|
|
class SharedDesktopFrame : public DesktopFrame {
|
|
public:
|
|
~SharedDesktopFrame() override;
|
|
|
|
static std::unique_ptr<SharedDesktopFrame> Wrap(
|
|
std::unique_ptr<DesktopFrame> desktop_frame);
|
|
|
|
// Deprecated.
|
|
// TODO(sergeyu): remove this method.
|
|
static SharedDesktopFrame* Wrap(DesktopFrame* desktop_frame);
|
|
|
|
// Deprecated. Clients do not need to know the underlying DesktopFrame
|
|
// instance.
|
|
// TODO(zijiehe): Remove this method.
|
|
// Returns the underlying instance of DesktopFrame.
|
|
DesktopFrame* GetUnderlyingFrame();
|
|
|
|
// Returns whether |this| and |other| share the underlying DesktopFrame.
|
|
bool ShareFrameWith(const SharedDesktopFrame& other) const;
|
|
|
|
// Creates a clone of this object.
|
|
std::unique_ptr<SharedDesktopFrame> Share();
|
|
|
|
// Checks if the frame is currently shared. If it returns false it's
|
|
// guaranteed that there are no clones of the object.
|
|
bool IsShared();
|
|
|
|
private:
|
|
typedef rtc::RefCountedObject<std::unique_ptr<DesktopFrame>> Core;
|
|
|
|
SharedDesktopFrame(rtc::scoped_refptr<Core> core);
|
|
|
|
const rtc::scoped_refptr<Core> core_;
|
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(SharedDesktopFrame);
|
|
};
|
|
|
|
} // namespace webrtc
|
|
|
|
#endif // MODULES_DESKTOP_CAPTURE_SHARED_DESKTOP_FRAME_H_
|