| OLD | NEW |
| 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 Atomic32 ref_count_; | 42 Atomic32 ref_count_; |
| 43 std::unique_ptr<DesktopFrame> frame_; | 43 std::unique_ptr<DesktopFrame> frame_; |
| 44 | 44 |
| 45 RTC_DISALLOW_COPY_AND_ASSIGN(Core); | 45 RTC_DISALLOW_COPY_AND_ASSIGN(Core); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 SharedDesktopFrame::~SharedDesktopFrame() {} | 48 SharedDesktopFrame::~SharedDesktopFrame() {} |
| 49 | 49 |
| 50 // static | 50 // static |
| 51 SharedDesktopFrame* SharedDesktopFrame::Wrap( | 51 SharedDesktopFrame* SharedDesktopFrame::Wrap(DesktopFrame* desktop_frame) { |
| 52 DesktopFrame* desktop_frame) { | |
| 53 rtc::scoped_refptr<Core> core(new Core(desktop_frame)); | 52 rtc::scoped_refptr<Core> core(new Core(desktop_frame)); |
| 54 return new SharedDesktopFrame(core); | 53 return new SharedDesktopFrame(core); |
| 55 } | 54 } |
| 56 | 55 |
| 57 DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { | 56 DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { |
| 58 return core_->frame(); | 57 return core_->frame(); |
| 59 } | 58 } |
| 60 | 59 |
| 61 SharedDesktopFrame* SharedDesktopFrame::Share() { | 60 SharedDesktopFrame* SharedDesktopFrame::Share() { |
| 62 SharedDesktopFrame* result = new SharedDesktopFrame(core_); | 61 SharedDesktopFrame* result = new SharedDesktopFrame(core_); |
| 63 result->set_dpi(dpi()); | 62 result->set_dpi(dpi()); |
| 64 result->set_capture_time_ms(capture_time_ms()); | 63 result->set_capture_time_ms(capture_time_ms()); |
| 65 *result->mutable_updated_region() = updated_region(); | 64 *result->mutable_updated_region() = updated_region(); |
| 66 return result; | 65 return result; |
| 67 } | 66 } |
| 68 | 67 |
| 69 bool SharedDesktopFrame::IsShared() { | 68 bool SharedDesktopFrame::IsShared() { |
| 70 return !core_->HasOneRef(); | 69 return !core_->HasOneRef(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) | 72 SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) |
| 74 : DesktopFrame(core->frame()->size(), | 73 : DesktopFrame(core->frame()->size(), |
| 75 core->frame()->stride(), | 74 core->frame()->stride(), |
| 76 core->frame()->data(), | 75 core->frame()->data(), |
| 77 core->frame()->shared_memory()), | 76 core->frame()->shared_memory()), |
| 78 core_(core) { | 77 core_(core) { |
| 79 } | 78 } |
| 80 | 79 |
| 81 } // namespace webrtc | 80 } // namespace webrtc |
| OLD | NEW |