| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "remoting/client/frame_consumer_proxy.h" | 5 #include "remoting/client/frame_consumer_proxy.h" | 
| 6 | 6 | 
| 7 #include "base/bind.h" | 7 #include "base/bind.h" | 
| 8 #include "base/location.h" | 8 #include "base/location.h" | 
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" | 
| 10 #include "ppapi/cpp/image_data.h" | 10 #include "remoting/client/image_buffer.h" | 
| 11 | 11 | 
| 12 namespace remoting { | 12 namespace remoting { | 
| 13 | 13 | 
| 14 FrameConsumerProxy::FrameConsumerProxy( | 14 FrameConsumerProxy::FrameConsumerProxy( | 
| 15     scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 15     scoped_refptr<base::SingleThreadTaskRunner> task_runner) | 
| 16     : task_runner_(task_runner) { | 16     : task_runner_(task_runner) { | 
| 17 } | 17 } | 
| 18 | 18 | 
| 19 void FrameConsumerProxy::ApplyBuffer(const SkISize& view_size, | 19 void FrameConsumerProxy::ApplyBuffer(const SkISize& view_size, | 
| 20                                      const SkIRect& clip_area, | 20                                      const SkIRect& clip_area, | 
| 21                                      pp::ImageData* buffer, | 21                                      ImageBuffer* buffer, | 
| 22                                      const SkRegion& region) { | 22                                      const SkRegion& region) { | 
| 23   if (!task_runner_->BelongsToCurrentThread()) { | 23   if (!task_runner_->BelongsToCurrentThread()) { | 
| 24     task_runner_->PostTask(FROM_HERE, base::Bind( | 24     task_runner_->PostTask(FROM_HERE, base::Bind( | 
| 25         &FrameConsumerProxy::ApplyBuffer, this, | 25         &FrameConsumerProxy::ApplyBuffer, this, | 
| 26         view_size, clip_area, buffer, region)); | 26         view_size, clip_area, buffer, region)); | 
| 27     return; | 27     return; | 
| 28   } | 28   } | 
| 29 | 29 | 
| 30   if (frame_consumer_.get()) | 30   if (frame_consumer_.get()) | 
| 31     frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region); | 31     frame_consumer_->ApplyBuffer(view_size, clip_area, buffer, region); | 
| 32 } | 32 } | 
| 33 | 33 | 
| 34 void FrameConsumerProxy::ReturnBuffer(pp::ImageData* buffer) { | 34 void FrameConsumerProxy::ReturnBuffer(ImageBuffer* buffer) { | 
| 35   if (!task_runner_->BelongsToCurrentThread()) { | 35   if (!task_runner_->BelongsToCurrentThread()) { | 
| 36     task_runner_->PostTask(FROM_HERE, base::Bind( | 36     task_runner_->PostTask(FROM_HERE, base::Bind( | 
| 37         &FrameConsumerProxy::ReturnBuffer, this, buffer)); | 37         &FrameConsumerProxy::ReturnBuffer, this, buffer)); | 
| 38     return; | 38     return; | 
| 39   } | 39   } | 
| 40 | 40 | 
| 41   if (frame_consumer_.get()) | 41   if (frame_consumer_.get()) | 
| 42     frame_consumer_->ReturnBuffer(buffer); | 42     frame_consumer_->ReturnBuffer(buffer); | 
| 43 } | 43 } | 
| 44 | 44 | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
| 58     const base::WeakPtr<FrameConsumer>& frame_consumer) { | 58     const base::WeakPtr<FrameConsumer>& frame_consumer) { | 
| 59   DCHECK(task_runner_->BelongsToCurrentThread()); | 59   DCHECK(task_runner_->BelongsToCurrentThread()); | 
| 60   DCHECK(frame_consumer_.get() == NULL); | 60   DCHECK(frame_consumer_.get() == NULL); | 
| 61   frame_consumer_ = frame_consumer; | 61   frame_consumer_ = frame_consumer; | 
| 62 } | 62 } | 
| 63 | 63 | 
| 64 FrameConsumerProxy::~FrameConsumerProxy() { | 64 FrameConsumerProxy::~FrameConsumerProxy() { | 
| 65 } | 65 } | 
| 66 | 66 | 
| 67 }  // namespace remoting | 67 }  // namespace remoting | 
| OLD | NEW | 
|---|