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

Side by Side Diff: webrtc/modules/desktop_capture/desktop_frame.cc

Issue 1743203002: Replace scoped_ptr with unique_ptr in webrtc/modules/desktop_capture/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: More Windows reverts Created 4 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 frame.data() + y * frame.stride(), 71 frame.data() + y * frame.stride(),
72 frame.size().width() * kBytesPerPixel); 72 frame.size().width() * kBytesPerPixel);
73 } 73 }
74 result->set_dpi(frame.dpi()); 74 result->set_dpi(frame.dpi());
75 result->set_capture_time_ms(frame.capture_time_ms()); 75 result->set_capture_time_ms(frame.capture_time_ms());
76 *result->mutable_updated_region() = frame.updated_region(); 76 *result->mutable_updated_region() = frame.updated_region();
77 return result; 77 return result;
78 } 78 }
79 79
80 // static 80 // static
81 rtc::scoped_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create( 81 std::unique_ptr<DesktopFrame> SharedMemoryDesktopFrame::Create(
82 DesktopSize size, 82 DesktopSize size,
83 SharedMemoryFactory* shared_memory_factory) { 83 SharedMemoryFactory* shared_memory_factory) {
84 size_t buffer_size = 84 size_t buffer_size =
85 size.width() * size.height() * DesktopFrame::kBytesPerPixel; 85 size.width() * size.height() * DesktopFrame::kBytesPerPixel;
86 rtc::scoped_ptr<SharedMemory> shared_memory; 86 std::unique_ptr<SharedMemory> shared_memory;
87 shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size); 87 shared_memory = rtc::ScopedToUnique(
88 shared_memory_factory->CreateSharedMemory(buffer_size));
88 if (!shared_memory) 89 if (!shared_memory)
89 return nullptr; 90 return nullptr;
90 91
91 return rtc_make_scoped_ptr(new SharedMemoryDesktopFrame( 92 return std::unique_ptr<DesktopFrame>(new SharedMemoryDesktopFrame(
92 size, size.width() * DesktopFrame::kBytesPerPixel, 93 size, size.width() * DesktopFrame::kBytesPerPixel,
93 std::move(shared_memory))); 94 std::move(shared_memory)));
94 } 95 }
95 96
96 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size, 97 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size,
97 int stride, 98 int stride,
98 SharedMemory* shared_memory) 99 SharedMemory* shared_memory)
99 : DesktopFrame(size, 100 : DesktopFrame(size,
100 stride, 101 stride,
101 reinterpret_cast<uint8_t*>(shared_memory->data()), 102 reinterpret_cast<uint8_t*>(shared_memory->data()),
102 shared_memory) {} 103 shared_memory) {}
103 104
104 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame( 105 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(
105 DesktopSize size, 106 DesktopSize size,
106 int stride, 107 int stride,
107 rtc::scoped_ptr<SharedMemory> shared_memory) 108 std::unique_ptr<SharedMemory> shared_memory)
108 : DesktopFrame(size, 109 : DesktopFrame(size,
109 stride, 110 stride,
110 reinterpret_cast<uint8_t*>(shared_memory->data()), 111 reinterpret_cast<uint8_t*>(shared_memory->data()),
111 shared_memory.release()) {} 112 shared_memory.release()) {}
112 113
113 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { 114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() {
114 delete shared_memory_; 115 delete shared_memory_;
115 } 116 }
116 117
117 } // namespace webrtc 118 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698