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

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

Issue 1914153002: Remove calls to ScopedToUnique and UniqueToScoped (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@base-fix
Patch Set: Created 4 years, 7 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return result; 77 return result;
78 } 78 }
79 79
80 // static 80 // static
81 std::unique_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 std::unique_ptr<SharedMemory> shared_memory; 86 std::unique_ptr<SharedMemory> shared_memory;
87 shared_memory = rtc::ScopedToUnique( 87 shared_memory = shared_memory_factory->CreateSharedMemory(buffer_size);
88 shared_memory_factory->CreateSharedMemory(buffer_size));
89 if (!shared_memory) 88 if (!shared_memory)
90 return nullptr; 89 return nullptr;
91 90
92 return std::unique_ptr<DesktopFrame>(new SharedMemoryDesktopFrame( 91 return std::unique_ptr<DesktopFrame>(new SharedMemoryDesktopFrame(
93 size, size.width() * DesktopFrame::kBytesPerPixel, 92 size, size.width() * DesktopFrame::kBytesPerPixel,
94 std::move(shared_memory))); 93 std::move(shared_memory)));
95 } 94 }
96 95
97 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size, 96 SharedMemoryDesktopFrame::SharedMemoryDesktopFrame(DesktopSize size,
98 int stride, 97 int stride,
(...skipping 10 matching lines...) Expand all
109 : DesktopFrame(size, 108 : DesktopFrame(size,
110 stride, 109 stride,
111 reinterpret_cast<uint8_t*>(shared_memory->data()), 110 reinterpret_cast<uint8_t*>(shared_memory->data()),
112 shared_memory.release()) {} 111 shared_memory.release()) {}
113 112
114 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() { 113 SharedMemoryDesktopFrame::~SharedMemoryDesktopFrame() {
115 delete shared_memory_; 114 delete shared_memory_;
116 } 115 }
117 116
118 } // namespace webrtc 117 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_device/test/func_test_manager.cc ('k') | webrtc/modules/desktop_capture/desktop_frame_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698