Chromium Code Reviews| Index: webrtc/modules/desktop_capture/shared_desktop_frame.cc |
| diff --git a/webrtc/modules/desktop_capture/shared_desktop_frame.cc b/webrtc/modules/desktop_capture/shared_desktop_frame.cc |
| index 309bac55add20cb268344508433b8f081016bd3b..de8c4b798f0d971a4833b18df9959b28e15830e8 100644 |
| --- a/webrtc/modules/desktop_capture/shared_desktop_frame.cc |
| +++ b/webrtc/modules/desktop_capture/shared_desktop_frame.cc |
| @@ -59,11 +59,7 @@ DesktopFrame* SharedDesktopFrame::GetUnderlyingFrame() { |
| } |
| SharedDesktopFrame* SharedDesktopFrame::Share() { |
| - SharedDesktopFrame* result = new SharedDesktopFrame(core_); |
| - result->set_dpi(dpi()); |
| - result->set_capture_time_ms(capture_time_ms()); |
| - *result->mutable_updated_region() = updated_region(); |
| - return result; |
| + return new SharedDesktopFrame(core_); |
| } |
| bool SharedDesktopFrame::IsShared() { |
| @@ -71,11 +67,70 @@ bool SharedDesktopFrame::IsShared() { |
| } |
| SharedDesktopFrame::SharedDesktopFrame(rtc::scoped_refptr<Core> core) |
| - : DesktopFrame(core->frame()->size(), |
| - core->frame()->stride(), |
| - core->frame()->data(), |
| - core->frame()->shared_memory()), |
| - core_(core) { |
| + : DesktopFrame(DesktopSize(), // Do not use |
| + 0, // Do not use |
| + nullptr, // Do not use |
| + nullptr), // Do not use |
| + core_(core) {} |
| + |
| +const DesktopSize& SharedDesktopFrame::size() const { |
| + return core_->frame()->size(); |
| +} |
| + |
| +int SharedDesktopFrame::stride() const { |
| + return core_->frame()->stride(); |
| +} |
| + |
| +uint8_t* SharedDesktopFrame::data() const { |
| + return core_->frame()->data(); |
| +} |
| + |
| +SharedMemory* SharedDesktopFrame::shared_memory() const { |
| + return core_->frame()->shared_memory(); |
| +} |
| + |
| +const DesktopRegion& SharedDesktopFrame::updated_region() const { |
| + return core_->frame()->updated_region(); |
|
Sergey Ulanov
2016/04/08 21:22:26
SharedDesktopFrame instances are supposed to share
|
| +} |
| + |
| +DesktopRegion* SharedDesktopFrame::mutable_updated_region() { |
| + return core_->frame()->mutable_updated_region(); |
| +} |
| + |
| +const DesktopVector& SharedDesktopFrame::dpi() const { |
| + return core_->frame()->dpi(); |
| +} |
| + |
| +void SharedDesktopFrame::set_dpi(const DesktopVector& dpi) { |
| + core_->frame()->set_dpi(dpi); |
| +} |
| + |
| +int64_t SharedDesktopFrame::capture_time_ms() const { |
| + return core_->frame()->capture_time_ms(); |
| +} |
| + |
| +void SharedDesktopFrame::set_capture_time_ms(int64_t time_ms) { |
| + core_->frame()->set_capture_time_ms(time_ms); |
| +} |
| + |
| +const DesktopRegion* SharedDesktopFrame::shape() const { |
| + return core_->frame()->shape(); |
| +} |
| + |
| +void SharedDesktopFrame::set_shape(DesktopRegion* shape) { |
| + core_->frame()->set_shape(shape); |
| +} |
| + |
| +void SharedDesktopFrame::CopyPixelsFrom(uint8_t* src_buffer, |
| + int src_stride, |
| + const DesktopRect& dest_rect) { |
| + core_->frame()->CopyPixelsFrom(src_buffer, src_stride, dest_rect); |
| +} |
| + |
| +void SharedDesktopFrame::CopyPixelsFrom(const DesktopFrame& src_frame, |
| + const DesktopVector& src_pos, |
| + const DesktopRect& dest_rect) { |
| + core_->frame()->CopyPixelsFrom(src_frame, src_pos, dest_rect); |
| } |
| } // namespace webrtc |