| 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/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "ppapi/cpp/image_data.h" | 9 #include "ppapi/cpp/image_data.h" |
| 10 | 10 |
| 11 namespace remoting { | 11 namespace remoting { |
| 12 | 12 |
| 13 FrameConsumerProxy::FrameConsumerProxy( | 13 FrameConsumerProxy::FrameConsumerProxy( |
| 14 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop) | 14 scoped_refptr<base::MessageLoopProxy> frame_consumer_message_loop) |
| 15 : frame_consumer_message_loop_(frame_consumer_message_loop) { | 15 : frame_consumer_message_loop_(frame_consumer_message_loop) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 FrameConsumerProxy::~FrameConsumerProxy() { | |
| 19 DCHECK(frame_consumer_message_loop_->BelongsToCurrentThread()); | |
| 20 } | |
| 21 | |
| 22 void FrameConsumerProxy::ApplyBuffer(const SkISize& view_size, | 18 void FrameConsumerProxy::ApplyBuffer(const SkISize& view_size, |
| 23 const SkIRect& clip_area, | 19 const SkIRect& clip_area, |
| 24 pp::ImageData* buffer, | 20 pp::ImageData* buffer, |
| 25 const SkRegion& region) { | 21 const SkRegion& region) { |
| 26 if (!frame_consumer_message_loop_->BelongsToCurrentThread()) { | 22 if (!frame_consumer_message_loop_->BelongsToCurrentThread()) { |
| 27 frame_consumer_message_loop_->PostTask(FROM_HERE, base::Bind( | 23 frame_consumer_message_loop_->PostTask(FROM_HERE, base::Bind( |
| 28 &FrameConsumerProxy::ApplyBuffer, this, | 24 &FrameConsumerProxy::ApplyBuffer, this, |
| 29 view_size, clip_area, buffer, region)); | 25 view_size, clip_area, buffer, region)); |
| 30 return; | 26 return; |
| 31 } | 27 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 frame_consumer_->SetSourceSize(source_size); | 52 frame_consumer_->SetSourceSize(source_size); |
| 57 } | 53 } |
| 58 | 54 |
| 59 void FrameConsumerProxy::Attach( | 55 void FrameConsumerProxy::Attach( |
| 60 const base::WeakPtr<FrameConsumer>& frame_consumer) { | 56 const base::WeakPtr<FrameConsumer>& frame_consumer) { |
| 61 DCHECK(frame_consumer_message_loop_->BelongsToCurrentThread()); | 57 DCHECK(frame_consumer_message_loop_->BelongsToCurrentThread()); |
| 62 DCHECK(frame_consumer_ == NULL); | 58 DCHECK(frame_consumer_ == NULL); |
| 63 frame_consumer_ = frame_consumer; | 59 frame_consumer_ = frame_consumer; |
| 64 } | 60 } |
| 65 | 61 |
| 62 FrameConsumerProxy::~FrameConsumerProxy() { |
| 63 DCHECK(frame_consumer_message_loop_->BelongsToCurrentThread()); |
| 64 } |
| 65 |
| 66 } // namespace remoting | 66 } // namespace remoting |
| OLD | NEW |