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

Unified Diff: remoting/client/frame_consumer_proxy.cc

Issue 1236663002: Allow shaped-desktop hosts to send shape only when it changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Pepper 2D renderer build Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/frame_consumer_proxy.h ('k') | remoting/client/jni/chromoting_jni_instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « remoting/client/frame_consumer_proxy.h ('k') | remoting/client/jni/chromoting_jni_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698