Replace scoped_ptr with unique_ptr in webrtc/modules/desktop_capture/
BUG=webrtc:5520 Review URL: https://codereview.webrtc.org/1743203002 Cr-Commit-Position: refs/heads/master@{#12023}
This commit is contained in:
parent
672b78ff6a
commit
2bb3afa054
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/cropped_desktop_frame.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -18,7 +20,7 @@ class CroppedDesktopFrame : public DesktopFrame {
|
||||
CroppedDesktopFrame(DesktopFrame* frame, const DesktopRect& rect);
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<DesktopFrame> frame_;
|
||||
std::unique_ptr<DesktopFrame> frame_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(CroppedDesktopFrame);
|
||||
};
|
||||
|
||||
@ -75,7 +75,7 @@ bool CroppingWindowCapturer::BringSelectedWindowToFront() {
|
||||
}
|
||||
|
||||
void CroppingWindowCapturer::OnCaptureCompleted(DesktopFrame* frame) {
|
||||
rtc::scoped_ptr<DesktopFrame> screen_frame(frame);
|
||||
std::unique_ptr<DesktopFrame> screen_frame(frame);
|
||||
|
||||
if (!ShouldUseScreenCapturer()) {
|
||||
LOG(LS_INFO) << "Window no longer on top when ScreenCapturer finishes";
|
||||
@ -96,7 +96,7 @@ void CroppingWindowCapturer::OnCaptureCompleted(DesktopFrame* frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<DesktopFrame> window_frame(
|
||||
std::unique_ptr<DesktopFrame> window_frame(
|
||||
CreateCroppedDesktopFrame(screen_frame.release(), window_rect));
|
||||
callback_->OnCaptureCompleted(window_frame.release());
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_CROPPING_WINDOW_CAPTURER_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_CROPPING_WINDOW_CAPTURER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
@ -63,8 +65,8 @@ class CroppingWindowCapturer : public WindowCapturer,
|
||||
private:
|
||||
DesktopCaptureOptions options_;
|
||||
DesktopCapturer::Callback* callback_;
|
||||
rtc::scoped_ptr<WindowCapturer> window_capturer_;
|
||||
rtc::scoped_ptr<ScreenCapturer> screen_capturer_;
|
||||
std::unique_ptr<WindowCapturer> window_capturer_;
|
||||
std::unique_ptr<ScreenCapturer> screen_capturer_;
|
||||
WindowId selected_window_;
|
||||
WindowId excluded_window_;
|
||||
};
|
||||
|
||||
@ -62,10 +62,10 @@ class DesktopFrameWithCursor : public DesktopFrame {
|
||||
virtual ~DesktopFrameWithCursor();
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<DesktopFrame> original_frame_;
|
||||
std::unique_ptr<DesktopFrame> original_frame_;
|
||||
|
||||
DesktopVector restore_position_;
|
||||
rtc::scoped_ptr<DesktopFrame> restore_frame_;
|
||||
std::unique_ptr<DesktopFrame> restore_frame_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWithCursor);
|
||||
};
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_AND_CURSOR_COMPOSER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capturer.h"
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
@ -47,12 +49,12 @@ class DesktopAndCursorComposer : public DesktopCapturer,
|
||||
void OnMouseCursorPosition(MouseCursorMonitor::CursorState state,
|
||||
const DesktopVector& position) override;
|
||||
|
||||
rtc::scoped_ptr<DesktopCapturer> desktop_capturer_;
|
||||
rtc::scoped_ptr<MouseCursorMonitor> mouse_monitor_;
|
||||
std::unique_ptr<DesktopCapturer> desktop_capturer_;
|
||||
std::unique_ptr<MouseCursorMonitor> mouse_monitor_;
|
||||
|
||||
DesktopCapturer::Callback* callback_;
|
||||
|
||||
rtc::scoped_ptr<MouseCursor> cursor_;
|
||||
std::unique_ptr<MouseCursor> cursor_;
|
||||
MouseCursorMonitor::CursorState cursor_state_;
|
||||
DesktopVector cursor_position_;
|
||||
|
||||
|
||||
@ -8,10 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_and_cursor_composer.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor.h"
|
||||
@ -87,7 +88,7 @@ class FakeScreenCapturer : public DesktopCapturer {
|
||||
private:
|
||||
Callback* callback_;
|
||||
|
||||
rtc::scoped_ptr<DesktopFrame> next_frame_;
|
||||
std::unique_ptr<DesktopFrame> next_frame_;
|
||||
};
|
||||
|
||||
class FakeMouseMonitor : public MouseCursorMonitor {
|
||||
@ -109,7 +110,7 @@ class FakeMouseMonitor : public MouseCursorMonitor {
|
||||
|
||||
void Capture() override {
|
||||
if (changed_) {
|
||||
rtc::scoped_ptr<DesktopFrame> image(
|
||||
std::unique_ptr<DesktopFrame> image(
|
||||
new BasicDesktopFrame(DesktopSize(kCursorWidth, kCursorHeight)));
|
||||
uint32_t* data = reinterpret_cast<uint32_t*>(image->data());
|
||||
memset(data, 0, image->stride() * kCursorHeight);
|
||||
@ -176,7 +177,7 @@ class DesktopAndCursorComposerTest : public testing::Test,
|
||||
FakeMouseMonitor* fake_cursor_;
|
||||
|
||||
DesktopAndCursorComposer blender_;
|
||||
rtc::scoped_ptr<DesktopFrame> frame_;
|
||||
std::unique_ptr<DesktopFrame> frame_;
|
||||
};
|
||||
|
||||
// Verify DesktopAndCursorComposer can handle the case when the screen capturer
|
||||
@ -190,7 +191,7 @@ TEST_F(DesktopAndCursorComposerTest, Error) {
|
||||
|
||||
blender_.Capture(DesktopRegion());
|
||||
|
||||
EXPECT_EQ(frame_, static_cast<DesktopFrame*>(NULL));
|
||||
EXPECT_FALSE(frame_);
|
||||
}
|
||||
|
||||
TEST_F(DesktopAndCursorComposerTest, Blend) {
|
||||
@ -228,7 +229,7 @@ TEST_F(DesktopAndCursorComposerTest, Blend) {
|
||||
DesktopVector pos(tests[i].x, tests[i].y);
|
||||
fake_cursor_->SetState(state, pos);
|
||||
|
||||
rtc::scoped_ptr<SharedDesktopFrame> frame(
|
||||
std::unique_ptr<SharedDesktopFrame> frame(
|
||||
SharedDesktopFrame::Wrap(CreateTestFrame()));
|
||||
fake_screen_->SetNextFrame(frame->Share());
|
||||
|
||||
|
||||
@ -78,17 +78,18 @@ DesktopFrame* BasicDesktopFrame::CopyOf(const DesktopFrame& frame) {
|
||||
}
|
||||
|
||||
// static
|
||||
rtc::scoped_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create(
|
||||
std::unique_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create(
|
||||
DesktopSize size,
|
||||
SharedMemoryFactory* shared_memory_factory) {
|
||||
size_t buffer_size =
|
||||
size.width() * size.height() * DesktopFrame::kBytesPerPixel;
|
||||
rtc::scoped_ptr<SharedMemory> shared_memory;
|
||||
shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
|
||||
std::unique_ptr<SharedMemory> shared_memory;
|
||||
shared_memory = rtc::ScopedToUnique(
|
||||
shared_memory_factory->CreateSharedMemory(buffer_size));
|
||||
if (!shared_memory)
|
||||
return nullptr;
|
||||
|
||||
return rtc_make_scoped_ptr(new SharedMemoryDesktopFrame(
|
||||
return std::unique_ptr<DesktopFrame>(new SharedMemoryDesktopFrame(
|
||||
size, size.width() * DesktopFrame::kBytesPerPixel,
|
||||
std::move(shared_memory)));
|
||||
}
|
||||
@ -104,7 +105,7 @@ SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size,
|
||||
SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(
|
||||
DesktopSize size,
|
||||
int stride,
|
||||
rtc::scoped_ptr<SharedMemory> shared_memory)
|
||||
std::unique_ptr<SharedMemory> shared_memory)
|
||||
: DesktopFrame(size,
|
||||
stride,
|
||||
reinterpret_cast<uint8_t*>(shared_memory->data()),
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_H_
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_region.h"
|
||||
#include "webrtc/modules/desktop_capture/shared_memory.h"
|
||||
@ -88,7 +89,7 @@ class DesktopFrame {
|
||||
DesktopRegion updated_region_;
|
||||
DesktopVector dpi_;
|
||||
int64_t capture_time_ms_;
|
||||
rtc::scoped_ptr<DesktopRegion> shape_;
|
||||
std::unique_ptr<DesktopRegion> shape_;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrame);
|
||||
@ -110,7 +111,7 @@ class BasicDesktopFrame : public DesktopFrame {
|
||||
// A DesktopFrame that stores data in shared memory.
|
||||
class SharedMemoryDesktopFrame : public DesktopFrame {
|
||||
public:
|
||||
static rtc::scoped_ptr<DesktopFrame> Create(
|
||||
static std::unique_ptr<DesktopFrame> Create(
|
||||
DesktopSize size,
|
||||
SharedMemoryFactory* shared_memory_factory);
|
||||
|
||||
@ -121,7 +122,7 @@ class SharedMemoryDesktopFrame : public DesktopFrame {
|
||||
SharedMemory* shared_memory);
|
||||
SharedMemoryDesktopFrame(DesktopSize size,
|
||||
int stride,
|
||||
rtc::scoped_ptr<SharedMemory> shared_memory);
|
||||
std::unique_ptr<SharedMemory> shared_memory);
|
||||
~SharedMemoryDesktopFrame() override;
|
||||
|
||||
private:
|
||||
|
||||
@ -19,7 +19,7 @@ namespace webrtc {
|
||||
DesktopFrameWin::DesktopFrameWin(DesktopSize size,
|
||||
int stride,
|
||||
uint8_t* data,
|
||||
rtc::scoped_ptr<SharedMemory> shared_memory,
|
||||
std::unique_ptr<SharedMemory> shared_memory,
|
||||
HBITMAP bitmap)
|
||||
: DesktopFrame(size, stride, data, shared_memory.get()),
|
||||
bitmap_(bitmap),
|
||||
@ -46,10 +46,11 @@ DesktopFrameWin* DesktopFrameWin::Create(
|
||||
bmi.bmiHeader.biSize = sizeof(bmi.bmiHeader);
|
||||
bmi.bmiHeader.biSizeImage = bytes_per_row * size.height();
|
||||
|
||||
rtc::scoped_ptr<SharedMemory> shared_memory;
|
||||
std::unique_ptr<SharedMemory> shared_memory;
|
||||
HANDLE section_handle = nullptr;
|
||||
if (shared_memory_factory) {
|
||||
shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
|
||||
shared_memory = rtc::ScopedToUnique(
|
||||
shared_memory_factory->CreateSharedMemory(buffer_size));
|
||||
if (shared_memory)
|
||||
section_handle = shared_memory->handle();
|
||||
}
|
||||
|
||||
@ -11,9 +11,10 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DESKTOP_FRAME_WIN_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
@ -34,11 +35,11 @@ class DesktopFrameWin : public DesktopFrame {
|
||||
DesktopFrameWin(DesktopSize size,
|
||||
int stride,
|
||||
uint8_t* data,
|
||||
rtc::scoped_ptr<SharedMemory> shared_memory,
|
||||
std::unique_ptr<SharedMemory> shared_memory,
|
||||
HBITMAP bitmap);
|
||||
|
||||
HBITMAP bitmap_;
|
||||
rtc::scoped_ptr<SharedMemory> owned_shared_memory_;
|
||||
std::unique_ptr<SharedMemory> owned_shared_memory_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(DesktopFrameWin);
|
||||
};
|
||||
|
||||
@ -11,9 +11,9 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DIFFER_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_DIFFER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_region.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -74,7 +74,7 @@ class Differ {
|
||||
int bytes_per_row_;
|
||||
|
||||
// Diff information for each block in the image.
|
||||
rtc::scoped_ptr<bool[]> diff_info_;
|
||||
std::unique_ptr<bool[]> diff_info_;
|
||||
|
||||
// Dimensions and total size of diff info array.
|
||||
int diff_info_width_;
|
||||
|
||||
@ -8,8 +8,9 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/differ.h"
|
||||
#include "webrtc/modules/desktop_capture/differ_block.h"
|
||||
|
||||
@ -188,7 +189,7 @@ class DifferTest : public testing::Test {
|
||||
}
|
||||
|
||||
// The differ class we're testing.
|
||||
rtc::scoped_ptr<Differ> differ_;
|
||||
std::unique_ptr<Differ> differ_;
|
||||
|
||||
// Screen/buffer info.
|
||||
int width_;
|
||||
@ -200,8 +201,8 @@ class DifferTest : public testing::Test {
|
||||
int buffer_size_;
|
||||
|
||||
// Previous and current screen buffers.
|
||||
rtc::scoped_ptr<uint8_t[]> prev_;
|
||||
rtc::scoped_ptr<uint8_t[]> curr_;
|
||||
std::unique_ptr<uint8_t[]> prev_;
|
||||
std::unique_ptr<uint8_t[]> curr_;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(DifferTest);
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/mac/desktop_configuration.h"
|
||||
#include "webrtc/system_wrappers/include/atomic32.h"
|
||||
|
||||
@ -56,7 +56,7 @@ class DesktopConfigurationMonitor {
|
||||
Atomic32 ref_count_;
|
||||
std::set<CGDirectDisplayID> reconfiguring_displays_;
|
||||
MacDesktopConfiguration desktop_configuration_;
|
||||
rtc::scoped_ptr<EventWrapper> display_configuration_capture_event_;
|
||||
std::unique_ptr<EventWrapper> display_configuration_capture_event_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(DesktopConfigurationMonitor);
|
||||
};
|
||||
|
||||
@ -11,8 +11,9 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -37,7 +38,7 @@ class MouseCursor {
|
||||
const DesktopVector& hotspot() const { return hotspot_; }
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<DesktopFrame> image_;
|
||||
std::unique_ptr<DesktopFrame> image_;
|
||||
DesktopVector hotspot_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(MouseCursor);
|
||||
|
||||
@ -11,12 +11,14 @@
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#include "webrtc/base/macutils.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/scoped_ref_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
@ -52,7 +54,7 @@ class MouseCursorMonitorMac : public MouseCursorMonitor {
|
||||
ScreenId screen_id_;
|
||||
Callback* callback_;
|
||||
Mode mode_;
|
||||
rtc::scoped_ptr<MouseCursor> last_cursor_;
|
||||
std::unique_ptr<MouseCursor> last_cursor_;
|
||||
rtc::scoped_refptr<FullScreenChromeWindowDetector>
|
||||
full_screen_chrome_window_detector_;
|
||||
};
|
||||
@ -268,14 +270,14 @@ void MouseCursorMonitorMac::CaptureImage() {
|
||||
|
||||
// Create a MouseCursor that describes the cursor and pass it to
|
||||
// the client.
|
||||
rtc::scoped_ptr<DesktopFrame> image(
|
||||
std::unique_ptr<DesktopFrame> image(
|
||||
new BasicDesktopFrame(DesktopSize(size.width(), size.height())));
|
||||
memcpy(image->data(), src_data,
|
||||
size.width() * size.height() * DesktopFrame::kBytesPerPixel);
|
||||
|
||||
CFRelease(image_data_ref);
|
||||
|
||||
rtc::scoped_ptr<MouseCursor> cursor(
|
||||
std::unique_ptr<MouseCursor> cursor(
|
||||
new MouseCursor(image.release(), hotspot));
|
||||
last_cursor_.reset(MouseCursor::CopyOf(*cursor));
|
||||
|
||||
|
||||
@ -8,10 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor.h"
|
||||
@ -40,7 +41,7 @@ class MouseCursorMonitorTest : public testing::Test,
|
||||
}
|
||||
|
||||
protected:
|
||||
rtc::scoped_ptr<MouseCursor> cursor_image_;
|
||||
std::unique_ptr<MouseCursor> cursor_image_;
|
||||
MouseCursorMonitor::CursorState state_;
|
||||
DesktopVector position_;
|
||||
bool position_received_;
|
||||
@ -62,7 +63,7 @@ class MouseCursorMonitorTest : public testing::Test,
|
||||
#endif
|
||||
|
||||
TEST_F(MouseCursorMonitorTest, MAYBE(FromScreen)) {
|
||||
rtc::scoped_ptr<MouseCursorMonitor> capturer(
|
||||
std::unique_ptr<MouseCursorMonitor> capturer(
|
||||
MouseCursorMonitor::CreateForScreen(
|
||||
DesktopCaptureOptions::CreateDefault(),
|
||||
webrtc::kFullDesktopScreenId));
|
||||
@ -86,7 +87,7 @@ TEST_F(MouseCursorMonitorTest, MAYBE(FromWindow)) {
|
||||
DesktopCaptureOptions options = DesktopCaptureOptions::CreateDefault();
|
||||
|
||||
// First get list of windows.
|
||||
rtc::scoped_ptr<WindowCapturer> window_capturer(
|
||||
std::unique_ptr<WindowCapturer> window_capturer(
|
||||
WindowCapturer::Create(options));
|
||||
|
||||
// If window capturing is not supported then skip this test.
|
||||
@ -101,7 +102,7 @@ TEST_F(MouseCursorMonitorTest, MAYBE(FromWindow)) {
|
||||
cursor_image_.reset();
|
||||
position_received_ = false;
|
||||
|
||||
rtc::scoped_ptr<MouseCursorMonitor> capturer(
|
||||
std::unique_ptr<MouseCursorMonitor> capturer(
|
||||
MouseCursorMonitor::CreateForWindow(
|
||||
DesktopCaptureOptions::CreateDefault(), windows[i].id));
|
||||
assert(capturer.get());
|
||||
@ -116,7 +117,7 @@ TEST_F(MouseCursorMonitorTest, MAYBE(FromWindow)) {
|
||||
|
||||
// Make sure that OnMouseCursorPosition() is not called in the SHAPE_ONLY mode.
|
||||
TEST_F(MouseCursorMonitorTest, MAYBE(ShapeOnly)) {
|
||||
rtc::scoped_ptr<MouseCursorMonitor> capturer(
|
||||
std::unique_ptr<MouseCursorMonitor> capturer(
|
||||
MouseCursorMonitor::CreateForScreen(
|
||||
DesktopCaptureOptions::CreateDefault(),
|
||||
webrtc::kFullDesktopScreenId));
|
||||
|
||||
@ -12,6 +12,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor.h"
|
||||
#include "webrtc/modules/desktop_capture/win/cursor.h"
|
||||
@ -93,7 +95,7 @@ void MouseCursorMonitorWin::Capture() {
|
||||
if (last_cursor_ != cursor_info.hCursor) {
|
||||
last_cursor_ = cursor_info.hCursor;
|
||||
// Note that |cursor_info.hCursor| does not need to be freed.
|
||||
rtc::scoped_ptr<MouseCursor> cursor(
|
||||
std::unique_ptr<MouseCursor> cursor(
|
||||
CreateMouseCursorFromHCursor(desktop_dc_, cursor_info.hCursor));
|
||||
if (cursor.get())
|
||||
callback_->OnMouseCursor(cursor.release());
|
||||
|
||||
@ -8,13 +8,14 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor_monitor.h"
|
||||
|
||||
#include <X11/extensions/Xfixes.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor.h"
|
||||
@ -84,7 +85,7 @@ class MouseCursorMonitorX11 : public MouseCursorMonitor,
|
||||
int xfixes_event_base_;
|
||||
int xfixes_error_base_;
|
||||
|
||||
rtc::scoped_ptr<MouseCursor> cursor_shape_;
|
||||
std::unique_ptr<MouseCursor> cursor_shape_;
|
||||
};
|
||||
|
||||
MouseCursorMonitorX11::MouseCursorMonitorX11(
|
||||
@ -190,7 +191,7 @@ void MouseCursorMonitorX11::CaptureCursor() {
|
||||
return;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<DesktopFrame> image(
|
||||
std::unique_ptr<DesktopFrame> image(
|
||||
new BasicDesktopFrame(DesktopSize(img->width, img->height)));
|
||||
|
||||
// Xlib stores 32-bit data in longs, even if longs are 64-bits long.
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURE_FRAME_QUEUE_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURE_FRAME_QUEUE_H_
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
@ -64,7 +65,7 @@ class ScreenCaptureFrameQueue {
|
||||
int current_;
|
||||
|
||||
static const int kQueueLength = 2;
|
||||
rtc::scoped_ptr<SharedDesktopFrame> frames_[kQueueLength];
|
||||
std::unique_ptr<SharedDesktopFrame> frames_[kQueueLength];
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCaptureFrameQueue);
|
||||
};
|
||||
|
||||
@ -13,7 +13,6 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_types.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capturer.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_HELPER_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_SCREEN_CAPTURER_HELPER_H_
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_region.h"
|
||||
#include "webrtc/system_wrappers/include/rw_lock_wrapper.h"
|
||||
@ -70,7 +71,7 @@ class ScreenCapturerHelper {
|
||||
DesktopRegion invalid_region_;
|
||||
|
||||
// A lock protecting |invalid_region_| across threads.
|
||||
rtc::scoped_ptr<RWLockWrapper> invalid_region_lock_;
|
||||
std::unique_ptr<RWLockWrapper> invalid_region_lock_;
|
||||
|
||||
// The size of the most recently captured screen.
|
||||
DesktopSize size_most_recent_;
|
||||
|
||||
@ -11,7 +11,6 @@
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer_helper.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
@ -21,7 +23,6 @@
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
||||
#include "webrtc/base/macutils.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
@ -301,7 +302,7 @@ class InvertedDesktopFrame : public DesktopFrame {
|
||||
virtual ~InvertedDesktopFrame() {}
|
||||
|
||||
private:
|
||||
rtc::scoped_ptr<DesktopFrame> original_frame_;
|
||||
std::unique_ptr<DesktopFrame> original_frame_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(InvertedDesktopFrame);
|
||||
};
|
||||
@ -957,7 +958,7 @@ void ScreenCapturerMac::ScreenUpdateMoveCallback(
|
||||
}
|
||||
|
||||
DesktopFrame* ScreenCapturerMac::CreateFrame() {
|
||||
rtc::scoped_ptr<DesktopFrame> frame(
|
||||
std::unique_ptr<DesktopFrame> frame(
|
||||
new BasicDesktopFrame(screen_pixel_bounds_.size()));
|
||||
|
||||
frame->set_dpi(DesktopVector(kStandardDPI * dip_to_pixel_scale_,
|
||||
@ -972,7 +973,7 @@ ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) {
|
||||
if (!options.configuration_monitor())
|
||||
return NULL;
|
||||
|
||||
rtc::scoped_ptr<ScreenCapturerMac> capturer(
|
||||
std::unique_ptr<ScreenCapturerMac> capturer(
|
||||
new ScreenCapturerMac(options.configuration_monitor()));
|
||||
if (!capturer->Init())
|
||||
capturer.reset();
|
||||
|
||||
@ -12,10 +12,10 @@
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_region.h"
|
||||
@ -40,13 +40,13 @@ class ScreenCapturerMacTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override { capturer_.reset(ScreenCapturer::Create()); }
|
||||
|
||||
rtc::scoped_ptr<ScreenCapturer> capturer_;
|
||||
std::unique_ptr<ScreenCapturer> capturer_;
|
||||
MockScreenCapturerCallback callback_;
|
||||
};
|
||||
|
||||
void ScreenCapturerMacTest::CaptureDoneCallback1(
|
||||
DesktopFrame* frame) {
|
||||
rtc::scoped_ptr<DesktopFrame> owned_frame(frame);
|
||||
std::unique_ptr<DesktopFrame> owned_frame(frame);
|
||||
|
||||
MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
|
||||
MacDesktopConfiguration::BottomLeftOrigin);
|
||||
@ -58,7 +58,7 @@ void ScreenCapturerMacTest::CaptureDoneCallback1(
|
||||
|
||||
void ScreenCapturerMacTest::CaptureDoneCallback2(
|
||||
DesktopFrame* frame) {
|
||||
rtc::scoped_ptr<DesktopFrame> owned_frame(frame);
|
||||
std::unique_ptr<DesktopFrame> owned_frame(frame);
|
||||
|
||||
MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
|
||||
MacDesktopConfiguration::BottomLeftOrigin);
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
@ -34,7 +36,7 @@ class ScreenCapturerTest : public testing::Test {
|
||||
}
|
||||
|
||||
protected:
|
||||
rtc::scoped_ptr<ScreenCapturer> capturer_;
|
||||
std::unique_ptr<ScreenCapturer> capturer_;
|
||||
MockScreenCapturerCallback callback_;
|
||||
};
|
||||
|
||||
@ -58,7 +60,8 @@ class FakeSharedMemoryFactory : public SharedMemoryFactory {
|
||||
~FakeSharedMemoryFactory() override {}
|
||||
|
||||
rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override {
|
||||
return rtc_make_scoped_ptr(new FakeSharedMemory(new char[size], size));
|
||||
return rtc::scoped_ptr<SharedMemory>(
|
||||
new FakeSharedMemory(new char[size], size));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -114,7 +117,7 @@ TEST_F(ScreenCapturerTest, UseSharedBuffers) {
|
||||
|
||||
capturer_->Start(&callback_);
|
||||
capturer_->SetSharedMemoryFactory(
|
||||
rtc_make_scoped_ptr(new FakeSharedMemoryFactory()));
|
||||
rtc::scoped_ptr<SharedMemoryFactory>(new FakeSharedMemoryFactory()));
|
||||
capturer_->Capture(DesktopRegion());
|
||||
|
||||
ASSERT_TRUE(frame);
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
@ -20,7 +21,7 @@ namespace webrtc {
|
||||
|
||||
// static
|
||||
ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) {
|
||||
rtc::scoped_ptr<ScreenCapturer> gdi_capturer(
|
||||
std::unique_ptr<ScreenCapturer> gdi_capturer(
|
||||
new ScreenCapturerWinGdi(options));
|
||||
|
||||
if (options.allow_use_magnification_api())
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include <X11/extensions/Xdamage.h>
|
||||
@ -19,7 +21,6 @@
|
||||
#include <X11/Xutil.h>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/differ.h"
|
||||
@ -112,7 +113,7 @@ class ScreenCapturerLinux : public ScreenCapturer,
|
||||
DesktopRegion last_invalid_region_;
|
||||
|
||||
// |Differ| for use when polling for changes.
|
||||
rtc::scoped_ptr<Differ> differ_;
|
||||
std::unique_ptr<Differ> differ_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(ScreenCapturerLinux);
|
||||
};
|
||||
@ -253,7 +254,7 @@ void ScreenCapturerLinux::Capture(const DesktopRegion& region) {
|
||||
// Note that we can't reallocate other buffers at this point, since the caller
|
||||
// may still be reading from them.
|
||||
if (!queue_.current_frame()) {
|
||||
rtc::scoped_ptr<DesktopFrame> frame(
|
||||
std::unique_ptr<DesktopFrame> frame(
|
||||
new BasicDesktopFrame(x_server_pixel_buffer_.window_size()));
|
||||
queue_.ReplaceCurrentFrame(frame.release());
|
||||
}
|
||||
@ -435,7 +436,7 @@ ScreenCapturer* ScreenCapturer::Create(const DesktopCaptureOptions& options) {
|
||||
if (!options.x_display())
|
||||
return NULL;
|
||||
|
||||
rtc::scoped_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux());
|
||||
std::unique_ptr<ScreenCapturerLinux> capturer(new ScreenCapturerLinux());
|
||||
if (!capturer->Init(options))
|
||||
capturer.reset();
|
||||
return capturer.release();
|
||||
|
||||
@ -10,7 +10,8 @@
|
||||
|
||||
#include "webrtc/modules/desktop_capture/shared_desktop_frame.h"
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/system_wrappers/include/atomic32.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -39,7 +40,7 @@ class SharedDesktopFrame::Core {
|
||||
virtual ~Core() {}
|
||||
|
||||
Atomic32 ref_count_;
|
||||
rtc::scoped_ptr<DesktopFrame> frame_;
|
||||
std::unique_ptr<DesktopFrame> frame_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(Core);
|
||||
};
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -11,8 +11,8 @@
|
||||
#include "webrtc/modules/desktop_capture/win/cursor.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/win/scoped_gdi_object.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
@ -135,7 +135,7 @@ MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) {
|
||||
|
||||
int width = bitmap_info.bmWidth;
|
||||
int height = bitmap_info.bmHeight;
|
||||
rtc::scoped_ptr<uint32_t[]> mask_data(new uint32_t[width * height]);
|
||||
std::unique_ptr<uint32_t[]> mask_data(new uint32_t[width * height]);
|
||||
|
||||
// Get pixel data from |scoped_mask| converting it to 32bpp along the way.
|
||||
// GetDIBits() sets the alpha component of every pixel to 0.
|
||||
@ -162,7 +162,7 @@ MouseCursor* CreateMouseCursorFromHCursor(HDC dc, HCURSOR cursor) {
|
||||
}
|
||||
|
||||
uint32_t* mask_plane = mask_data.get();
|
||||
rtc::scoped_ptr<DesktopFrame> image(
|
||||
std::unique_ptr<DesktopFrame> image(
|
||||
new BasicDesktopFrame(DesktopSize(width, height)));
|
||||
bool has_alpha = false;
|
||||
|
||||
|
||||
@ -8,8 +8,9 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_geometry.h"
|
||||
#include "webrtc/modules/desktop_capture/mouse_cursor.h"
|
||||
@ -34,7 +35,7 @@ bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
|
||||
|
||||
// Convert |cursor| to |mouse_shape|.
|
||||
HDC dc = GetDC(NULL);
|
||||
rtc::scoped_ptr<MouseCursor> mouse_shape(
|
||||
std::unique_ptr<MouseCursor> mouse_shape(
|
||||
CreateMouseCursorFromHCursor(dc, cursor));
|
||||
ReleaseDC(NULL, dc);
|
||||
|
||||
@ -62,7 +63,7 @@ bool ConvertToMouseShapeAndCompare(unsigned left, unsigned right) {
|
||||
|
||||
// Get the pixels from |scoped_color|.
|
||||
int size = width * height;
|
||||
rtc::scoped_ptr<uint32_t[]> data(new uint32_t[size]);
|
||||
std::unique_ptr<uint32_t[]> data(new uint32_t[size]);
|
||||
EXPECT_TRUE(GetBitmapBits(scoped_color, size * sizeof(uint32_t), data.get()));
|
||||
|
||||
// Compare the 32bpp image in |mouse_shape| with the one loaded from |right|.
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ void ScopedThreadDesktop::Revert() {
|
||||
bool ScopedThreadDesktop::SetThreadDesktop(Desktop* desktop) {
|
||||
Revert();
|
||||
|
||||
rtc::scoped_ptr<Desktop> scoped_desktop(desktop);
|
||||
std::unique_ptr<Desktop> scoped_desktop(desktop);
|
||||
|
||||
if (initial_->IsSame(*desktop))
|
||||
return true;
|
||||
|
||||
@ -11,10 +11,11 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCOPED_THREAD_DESKTOP_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCOPED_THREAD_DESKTOP_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -40,10 +41,10 @@ class ScopedThreadDesktop {
|
||||
|
||||
private:
|
||||
// The desktop handle assigned to the calling thread by Set
|
||||
rtc::scoped_ptr<Desktop> assigned_;
|
||||
std::unique_ptr<Desktop> assigned_;
|
||||
|
||||
// The desktop handle assigned to the calling thread at creation.
|
||||
rtc::scoped_ptr<Desktop> initial_;
|
||||
std::unique_ptr<Desktop> initial_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(ScopedThreadDesktop);
|
||||
};
|
||||
|
||||
@ -45,7 +45,7 @@ class CallbackSharedMemoryFactory : public SharedMemoryFactory {
|
||||
~CallbackSharedMemoryFactory() override {}
|
||||
|
||||
rtc::scoped_ptr<SharedMemory> CreateSharedMemory(size_t size) override {
|
||||
return rtc_make_scoped_ptr(callback_->CreateSharedMemory(size));
|
||||
return rtc::scoped_ptr<SharedMemory>(callback_->CreateSharedMemory(size));
|
||||
}
|
||||
|
||||
private:
|
||||
@ -90,7 +90,8 @@ ScreenCapturerWinGdi::~ScreenCapturerWinGdi() {
|
||||
|
||||
void ScreenCapturerWinGdi::SetSharedMemoryFactory(
|
||||
rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {
|
||||
shared_memory_factory_ = std::move(shared_memory_factory);
|
||||
shared_memory_factory_ =
|
||||
rtc::ScopedToUnique(std::move(shared_memory_factory));
|
||||
}
|
||||
|
||||
void ScreenCapturerWinGdi::Capture(const DesktopRegion& region) {
|
||||
@ -184,7 +185,7 @@ void ScreenCapturerWinGdi::Start(Callback* callback) {
|
||||
void ScreenCapturerWinGdi::PrepareCaptureResources() {
|
||||
// Switch to the desktop receiving user input if different from the current
|
||||
// one.
|
||||
rtc::scoped_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
|
||||
std::unique_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
|
||||
if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) {
|
||||
// Release GDI resources otherwise SetThreadDesktop will fail.
|
||||
if (desktop_dc_) {
|
||||
@ -262,7 +263,7 @@ bool ScreenCapturerWinGdi::CaptureImage() {
|
||||
assert(desktop_dc_ != NULL);
|
||||
assert(memory_dc_ != NULL);
|
||||
|
||||
rtc::scoped_ptr<DesktopFrame> buffer(DesktopFrameWin::Create(
|
||||
std::unique_ptr<DesktopFrame> buffer(DesktopFrameWin::Create(
|
||||
size, shared_memory_factory_.get(), desktop_dc_));
|
||||
if (!buffer.get())
|
||||
return false;
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_GDI_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/screen_capturer.h"
|
||||
|
||||
#include <windows.h>
|
||||
@ -54,7 +56,7 @@ class ScreenCapturerWinGdi : public ScreenCapturer {
|
||||
void CaptureCursor();
|
||||
|
||||
Callback* callback_;
|
||||
rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory_;
|
||||
std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
|
||||
ScreenId current_screen_id_;
|
||||
std::wstring current_device_key_;
|
||||
|
||||
@ -76,7 +78,7 @@ class ScreenCapturerWinGdi : public ScreenCapturer {
|
||||
DesktopRect desktop_dc_rect_;
|
||||
|
||||
// Class to calculate the difference between two screen bitmaps.
|
||||
rtc::scoped_ptr<Differ> differ_;
|
||||
std::unique_ptr<Differ> differ_;
|
||||
|
||||
HMODULE dwmapi_library_;
|
||||
DwmEnableCompositionFunc composition_func_;
|
||||
|
||||
@ -38,7 +38,7 @@ static LPCTSTR kMagnifierWindowName = L"MagnifierWindow";
|
||||
Atomic32 ScreenCapturerWinMagnifier::tls_index_(TLS_OUT_OF_INDEXES);
|
||||
|
||||
ScreenCapturerWinMagnifier::ScreenCapturerWinMagnifier(
|
||||
rtc::scoped_ptr<ScreenCapturer> fallback_capturer)
|
||||
std::unique_ptr<ScreenCapturer> fallback_capturer)
|
||||
: fallback_capturer_(std::move(fallback_capturer)),
|
||||
fallback_capturer_started_(false),
|
||||
callback_(NULL),
|
||||
@ -83,7 +83,8 @@ void ScreenCapturerWinMagnifier::Start(Callback* callback) {
|
||||
|
||||
void ScreenCapturerWinMagnifier::SetSharedMemoryFactory(
|
||||
rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory) {
|
||||
shared_memory_factory_ = std::move(shared_memory_factory);
|
||||
shared_memory_factory_ =
|
||||
rtc::ScopedToUnique(std::move(shared_memory_factory));
|
||||
}
|
||||
|
||||
void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) {
|
||||
@ -101,7 +102,7 @@ void ScreenCapturerWinMagnifier::Capture(const DesktopRegion& region) {
|
||||
}
|
||||
// Switch to the desktop receiving user input if different from the current
|
||||
// one.
|
||||
rtc::scoped_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
|
||||
std::unique_ptr<Desktop> input_desktop(Desktop::GetInputDesktop());
|
||||
if (input_desktop.get() != NULL && !desktop_.IsSame(*input_desktop)) {
|
||||
// Release GDI resources otherwise SetThreadDesktop will fail.
|
||||
if (desktop_dc_) {
|
||||
@ -427,11 +428,11 @@ void ScreenCapturerWinMagnifier::CreateCurrentFrameIfNecessary(
|
||||
// Note that we can't reallocate other buffers at this point, since the caller
|
||||
// may still be reading from them.
|
||||
if (!queue_.current_frame() || !queue_.current_frame()->size().equals(size)) {
|
||||
rtc::scoped_ptr<DesktopFrame> frame =
|
||||
std::unique_ptr<DesktopFrame> frame =
|
||||
shared_memory_factory_
|
||||
? SharedMemoryDesktopFrame::Create(size,
|
||||
shared_memory_factory_.get())
|
||||
: rtc::scoped_ptr<DesktopFrame>(new BasicDesktopFrame(size));
|
||||
: std::unique_ptr<DesktopFrame>(new BasicDesktopFrame(size));
|
||||
queue_.ReplaceCurrentFrame(frame.release());
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
#ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_
|
||||
#define WEBRTC_MODULES_DESKTOP_CAPTURE_WIN_SCREEN_CAPTURER_WIN_MAGNIFIER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <windows.h>
|
||||
#include <magnification.h>
|
||||
#include <wincodec.h>
|
||||
@ -39,7 +41,7 @@ class ScreenCapturerWinMagnifier : public ScreenCapturer {
|
||||
// screen is being captured, or the OS does not support Magnification API, or
|
||||
// the magnifier capturer fails (e.g. in Windows8 Metro mode).
|
||||
explicit ScreenCapturerWinMagnifier(
|
||||
rtc::scoped_ptr<ScreenCapturer> fallback_capturer);
|
||||
std::unique_ptr<ScreenCapturer> fallback_capturer);
|
||||
virtual ~ScreenCapturerWinMagnifier();
|
||||
|
||||
// Overridden from ScreenCapturer:
|
||||
@ -103,10 +105,10 @@ class ScreenCapturerWinMagnifier : public ScreenCapturer {
|
||||
|
||||
static Atomic32 tls_index_;
|
||||
|
||||
rtc::scoped_ptr<ScreenCapturer> fallback_capturer_;
|
||||
std::unique_ptr<ScreenCapturer> fallback_capturer_;
|
||||
bool fallback_capturer_started_;
|
||||
Callback* callback_;
|
||||
rtc::scoped_ptr<SharedMemoryFactory> shared_memory_factory_;
|
||||
std::unique_ptr<SharedMemoryFactory> shared_memory_factory_;
|
||||
ScreenId current_screen_id_;
|
||||
std::wstring current_device_key_;
|
||||
HWND excluded_window_;
|
||||
@ -119,7 +121,7 @@ class ScreenCapturerWinMagnifier : public ScreenCapturer {
|
||||
ScreenCaptureFrameQueue queue_;
|
||||
|
||||
// Class to calculate the difference between two screen bitmaps.
|
||||
rtc::scoped_ptr<Differ> differ_;
|
||||
std::unique_ptr<Differ> differ_;
|
||||
|
||||
// Used to suppress duplicate logging of SetThreadExecutionState errors.
|
||||
bool set_thread_execution_state_failed_;
|
||||
|
||||
@ -8,10 +8,11 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/modules/desktop_capture/window_capturer.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_region.h"
|
||||
@ -33,8 +34,8 @@ class WindowCapturerTest : public testing::Test,
|
||||
void OnCaptureCompleted(DesktopFrame* frame) override { frame_.reset(frame); }
|
||||
|
||||
protected:
|
||||
rtc::scoped_ptr<WindowCapturer> capturer_;
|
||||
rtc::scoped_ptr<DesktopFrame> frame_;
|
||||
std::unique_ptr<WindowCapturer> capturer_;
|
||||
std::unique_ptr<DesktopFrame> frame_;
|
||||
};
|
||||
|
||||
// Verify that we can enumerate windows.
|
||||
|
||||
@ -12,7 +12,8 @@
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include <memory>
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/win32.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame_win.h"
|
||||
@ -204,7 +205,7 @@ void WindowCapturerWin::Capture(const DesktopRegion& region) {
|
||||
return;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<DesktopFrameWin> frame(
|
||||
std::unique_ptr<DesktopFrameWin> frame(
|
||||
DesktopFrameWin::Create(cropped_rect.size(), NULL, window_dc));
|
||||
if (!frame.get()) {
|
||||
ReleaseDC(window_, window_dc);
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/scoped_ref_ptr.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_capture_options.h"
|
||||
#include "webrtc/modules/desktop_capture/desktop_frame.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user