| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/plugin/pepper_view.h" | 5 #include "remoting/client/plugin/pepper_view.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "remoting/base/decoder_zlib.h" | 8 #include "remoting/base/decoder_zlib.h" |
| 9 #include "remoting/client/plugin/chromoting_instance.h" | 9 #include "remoting/client/plugin/chromoting_instance.h" |
| 10 #include "remoting/client/plugin/pepper_util.h" | 10 #include "remoting/client/plugin/pepper_util.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 RunTaskOnPluginThread(NewRunnableMethod(this, | 132 RunTaskOnPluginThread(NewRunnableMethod(this, |
| 133 &PepperView::SetHostScreenSize, | 133 &PepperView::SetHostScreenSize, |
| 134 width, height)); | 134 width, height)); |
| 135 return; | 135 return; |
| 136 } | 136 } |
| 137 | 137 |
| 138 backing_store_width_ = width; | 138 backing_store_width_ = width; |
| 139 backing_store_height_ = height; | 139 backing_store_height_ = height; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PepperView::HandleBeginUpdateStream(ChromotingHostMessage* msg) { | 142 void PepperView::HandleBeginUpdateStream(HostMessage* msg) { |
| 143 if (!instance_->CurrentlyOnPluginThread()) { | 143 if (!instance_->CurrentlyOnPluginThread()) { |
| 144 RunTaskOnPluginThread( | 144 RunTaskOnPluginThread( |
| 145 NewRunnableMethod(this, &PepperView::HandleBeginUpdateStream, | 145 NewRunnableMethod(this, &PepperView::HandleBeginUpdateStream, |
| 146 msg)); | 146 msg)); |
| 147 return; | 147 return; |
| 148 } | 148 } |
| 149 | 149 |
| 150 scoped_ptr<ChromotingHostMessage> deleter(msg); | 150 scoped_ptr<HostMessage> deleter(msg); |
| 151 | 151 |
| 152 // TODO(hclam): Use the information from the message to create the decoder. | 152 // TODO(hclam): Use the information from the message to create the decoder. |
| 153 // We lazily construct the decoder. | 153 // We lazily construct the decoder. |
| 154 if (!decoder_.get()) { | 154 if (!decoder_.get()) { |
| 155 decoder_.reset(new DecoderZlib()); | 155 decoder_.reset(new DecoderZlib()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 if (!frame_) { | 158 if (!frame_) { |
| 159 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, | 159 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, |
| 160 backing_store_width_, | 160 backing_store_width_, |
| 161 backing_store_height_, | 161 backing_store_height_, |
| 162 base::TimeDelta(), base::TimeDelta(), | 162 base::TimeDelta(), base::TimeDelta(), |
| 163 &frame_); | 163 &frame_); |
| 164 } | 164 } |
| 165 | 165 |
| 166 // Tell the decoder to do start decoding. | 166 // Tell the decoder to do start decoding. |
| 167 decoder_->BeginDecode(frame_, &update_rects_, | 167 decoder_->BeginDecode(frame_, &update_rects_, |
| 168 NewRunnableMethod(this, &PepperView::OnPartialDecodeDone), | 168 NewRunnableMethod(this, &PepperView::OnPartialDecodeDone), |
| 169 NewRunnableMethod(this, &PepperView::OnDecodeDone)); | 169 NewRunnableMethod(this, &PepperView::OnDecodeDone)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void PepperView::HandleUpdateStreamPacket(ChromotingHostMessage* msg) { | 172 void PepperView::HandleUpdateStreamPacket(HostMessage* msg) { |
| 173 if (!instance_->CurrentlyOnPluginThread()) { | 173 if (!instance_->CurrentlyOnPluginThread()) { |
| 174 RunTaskOnPluginThread( | 174 RunTaskOnPluginThread( |
| 175 NewRunnableMethod(this, &PepperView::HandleUpdateStreamPacket, | 175 NewRunnableMethod(this, &PepperView::HandleUpdateStreamPacket, |
| 176 msg)); | 176 msg)); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 | 179 |
| 180 decoder_->PartialDecode(msg); | 180 decoder_->PartialDecode(msg); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void PepperView::HandleEndUpdateStream(ChromotingHostMessage* msg) { | 183 void PepperView::HandleEndUpdateStream(HostMessage* msg) { |
| 184 if (!instance_->CurrentlyOnPluginThread()) { | 184 if (!instance_->CurrentlyOnPluginThread()) { |
| 185 RunTaskOnPluginThread( | 185 RunTaskOnPluginThread( |
| 186 NewRunnableMethod(this, &PepperView::HandleEndUpdateStream, | 186 NewRunnableMethod(this, &PepperView::HandleEndUpdateStream, |
| 187 msg)); | 187 msg)); |
| 188 return; | 188 return; |
| 189 } | 189 } |
| 190 | 190 |
| 191 scoped_ptr<ChromotingHostMessage> deleter(msg); | 191 scoped_ptr<HostMessage> deleter(msg); |
| 192 decoder_->EndDecode(); | 192 decoder_->EndDecode(); |
| 193 } | 193 } |
| 194 | 194 |
| 195 void PepperView::OnPaintDone() { | 195 void PepperView::OnPaintDone() { |
| 196 // TODO(ajwong):Probably should set some variable to allow repaints to | 196 // TODO(ajwong):Probably should set some variable to allow repaints to |
| 197 // actually paint. | 197 // actually paint. |
| 198 return; | 198 return; |
| 199 } | 199 } |
| 200 | 200 |
| 201 void PepperView::OnPartialDecodeDone() { | 201 void PepperView::OnPartialDecodeDone() { |
| 202 all_update_rects_.insert(all_update_rects_.begin() + | 202 all_update_rects_.insert(all_update_rects_.begin() + |
| 203 all_update_rects_.size(), | 203 all_update_rects_.size(), |
| 204 update_rects_.begin(), update_rects_.end()); | 204 update_rects_.begin(), update_rects_.end()); |
| 205 Paint(); | 205 Paint(); |
| 206 // TODO(ajwong): Need to block here to be synchronous. | 206 // TODO(ajwong): Need to block here to be synchronous. |
| 207 } | 207 } |
| 208 | 208 |
| 209 | 209 |
| 210 void PepperView::OnDecodeDone() { | 210 void PepperView::OnDecodeDone() { |
| 211 } | 211 } |
| 212 | 212 |
| 213 } // namespace remoting | 213 } // namespace remoting |
| OLD | NEW |