| Index: remoting/client/frame_consumer_proxy.cc
|
| diff --git a/remoting/client/frame_consumer_proxy.cc b/remoting/client/frame_consumer_proxy.cc
|
| index bf70da533b8354e4619243d49fba84aaec13ddd6..21d03bfc663d3948e0cd40487a5077c9d2ff35db 100644
|
| --- a/remoting/client/frame_consumer_proxy.cc
|
| +++ b/remoting/client/frame_consumer_proxy.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/bind.h"
|
| #include "base/location.h"
|
| #include "base/single_thread_task_runner.h"
|
| +#include "base/thread_task_runner_handle.h"
|
| #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
|
| #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
|
| #include "third_party/webrtc/modules/desktop_capture/desktop_region.h"
|
| @@ -14,51 +15,50 @@
|
| namespace remoting {
|
|
|
| FrameConsumerProxy::FrameConsumerProxy(
|
| - scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
| const base::WeakPtr<FrameConsumer>& frame_consumer)
|
| : frame_consumer_(frame_consumer),
|
| - task_runner_(task_runner) {
|
| + task_runner_(base::ThreadTaskRunnerHandle::Get()) {
|
| pixel_format_ = frame_consumer_->GetPixelFormat();
|
| }
|
|
|
| +static void DoApplyBuffer(base::WeakPtr<FrameConsumer> frame_consumer,
|
| + const webrtc::DesktopSize& view_size,
|
| + const webrtc::DesktopRect& clip_area,
|
| + webrtc::DesktopFrame* buffer,
|
| + const webrtc::DesktopRegion& region,
|
| + scoped_ptr<webrtc::DesktopRegion> shape) {
|
| + if (!frame_consumer)
|
| + return;
|
| +
|
| + frame_consumer->ApplyBuffer(view_size, clip_area, buffer, region,
|
| + shape.get());
|
| +}
|
| +
|
| void FrameConsumerProxy::ApplyBuffer(const webrtc::DesktopSize& view_size,
|
| const webrtc::DesktopRect& clip_area,
|
| webrtc::DesktopFrame* buffer,
|
| const webrtc::DesktopRegion& region,
|
| - const webrtc::DesktopRegion& shape) {
|
| - if (!task_runner_->BelongsToCurrentThread()) {
|
| - task_runner_->PostTask(FROM_HERE, base::Bind(
|
| - &FrameConsumerProxy::ApplyBuffer, this,
|
| - view_size, clip_area, buffer, region, shape));
|
| - return;
|
| - }
|
| -
|
| - if (frame_consumer_.get())
|
| - frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region, shape);
|
| + const webrtc::DesktopRegion* shape) {
|
| + scoped_ptr<webrtc::DesktopRegion> shape_ptr;
|
| + if (shape)
|
| + shape_ptr = make_scoped_ptr(new webrtc::DesktopRegion(*shape));
|
| + task_runner_->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(DoApplyBuffer, frame_consumer_, view_size, clip_area, buffer,
|
| + region, base::Passed(&shape_ptr)));
|
| }
|
|
|
| void FrameConsumerProxy::ReturnBuffer(webrtc::DesktopFrame* buffer) {
|
| - if (!task_runner_->BelongsToCurrentThread()) {
|
| - task_runner_->PostTask(FROM_HERE, base::Bind(
|
| - &FrameConsumerProxy::ReturnBuffer, this, buffer));
|
| - return;
|
| - }
|
| -
|
| - if (frame_consumer_.get())
|
| - frame_consumer_->ReturnBuffer(buffer);
|
| + task_runner_->PostTask(FROM_HERE, base::Bind(&FrameConsumer::ReturnBuffer,
|
| + frame_consumer_, buffer));
|
| }
|
|
|
| void FrameConsumerProxy::SetSourceSize(
|
| const webrtc::DesktopSize& source_size,
|
| const webrtc::DesktopVector& source_dpi) {
|
| - if (!task_runner_->BelongsToCurrentThread()) {
|
| - task_runner_->PostTask(FROM_HERE, base::Bind(
|
| - &FrameConsumerProxy::SetSourceSize, this, source_size, source_dpi));
|
| - return;
|
| - }
|
| -
|
| - if (frame_consumer_.get())
|
| - frame_consumer_->SetSourceSize(source_size, source_dpi);
|
| + task_runner_->PostTask(
|
| + FROM_HERE, base::Bind(&FrameConsumer::SetSourceSize, frame_consumer_,
|
| + source_size, source_dpi));
|
| }
|
|
|
| FrameConsumer::PixelFormat FrameConsumerProxy::GetPixelFormat() {
|
|
|