| 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/client/plugin/chromoting_instance.h" | 8 #include "remoting/client/plugin/chromoting_instance.h" |
| 9 #include "remoting/client/plugin/pepper_util.h" | 9 #include "remoting/client/plugin/pepper_util.h" |
| 10 #include "third_party/ppapi/cpp/device_context_2d.h" | 10 #include "third_party/ppapi/cpp/device_context_2d.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 return; | 132 return; |
| 133 } | 133 } |
| 134 | 134 |
| 135 frame_width_ = width; | 135 frame_width_ = width; |
| 136 frame_height_ = height; | 136 frame_height_ = height; |
| 137 | 137 |
| 138 // Reset |frame_| - it will be recreated by the next update stream. | 138 // Reset |frame_| - it will be recreated by the next update stream. |
| 139 frame_ = NULL; | 139 frame_ = NULL; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void PepperView::HandleBeginUpdateStream(HostMessage* msg) { | 142 void PepperView::HandleBeginUpdateStream(ChromotingHostMessage* 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<HostMessage> deleter(msg); | 150 scoped_ptr<ChromotingHostMessage> deleter(msg); |
| 151 | 151 |
| 152 // Make sure the |frame_| is initialized. | 152 // Make sure the |frame_| is initialized. |
| 153 if (!frame_) { | 153 if (!frame_) { |
| 154 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, | 154 media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, |
| 155 frame_width_, frame_height_, | 155 frame_width_, frame_height_, |
| 156 base::TimeDelta(), base::TimeDelta(), | 156 base::TimeDelta(), base::TimeDelta(), |
| 157 &frame_); | 157 &frame_); |
| 158 CHECK(frame_); | 158 CHECK(frame_); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 void PepperView::HandleUpdateStreamPacket(HostMessage* msg) { | 162 void PepperView::HandleUpdateStreamPacket(ChromotingHostMessage* msg) { |
| 163 if (!instance_->CurrentlyOnPluginThread()) { | 163 if (!instance_->CurrentlyOnPluginThread()) { |
| 164 RunTaskOnPluginThread( | 164 RunTaskOnPluginThread( |
| 165 NewRunnableMethod(this, &PepperView::HandleUpdateStreamPacket, | 165 NewRunnableMethod(this, &PepperView::HandleUpdateStreamPacket, |
| 166 msg)); | 166 msg)); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Lazily initialize the decoder. | 170 // Lazily initialize the decoder. |
| 171 SetupDecoder(msg->update_stream_packet().begin_rect().encoding()); | 171 SetupDecoder(msg->update_stream_packet().begin_rect().encoding()); |
| 172 if (!decoder_->IsStarted()) { | 172 if (!decoder_->IsStarted()) { |
| 173 BeginDecoding(NewRunnableMethod(this, &PepperView::OnPartialDecodeDone), | 173 BeginDecoding(NewRunnableMethod(this, &PepperView::OnPartialDecodeDone), |
| 174 NewRunnableMethod(this, &PepperView::OnDecodeDone)); | 174 NewRunnableMethod(this, &PepperView::OnDecodeDone)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 Decode(msg); | 177 Decode(msg); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void PepperView::HandleEndUpdateStream(HostMessage* msg) { | 180 void PepperView::HandleEndUpdateStream(ChromotingHostMessage* msg) { |
| 181 if (!instance_->CurrentlyOnPluginThread()) { | 181 if (!instance_->CurrentlyOnPluginThread()) { |
| 182 RunTaskOnPluginThread( | 182 RunTaskOnPluginThread( |
| 183 NewRunnableMethod(this, &PepperView::HandleEndUpdateStream, | 183 NewRunnableMethod(this, &PepperView::HandleEndUpdateStream, |
| 184 msg)); | 184 msg)); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| 188 scoped_ptr<HostMessage> deleter(msg); | 188 scoped_ptr<ChromotingHostMessage> deleter(msg); |
| 189 EndDecoding(); | 189 EndDecoding(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 void PepperView::OnPaintDone() { | 192 void PepperView::OnPaintDone() { |
| 193 // TODO(ajwong):Probably should set some variable to allow repaints to | 193 // TODO(ajwong):Probably should set some variable to allow repaints to |
| 194 // actually paint. | 194 // actually paint. |
| 195 return; | 195 return; |
| 196 } | 196 } |
| 197 | 197 |
| 198 void PepperView::OnPartialDecodeDone() { | 198 void PepperView::OnPartialDecodeDone() { |
| 199 all_update_rects_.insert(all_update_rects_.begin() + | 199 all_update_rects_.insert(all_update_rects_.begin() + |
| 200 all_update_rects_.size(), | 200 all_update_rects_.size(), |
| 201 update_rects_.begin(), update_rects_.end()); | 201 update_rects_.begin(), update_rects_.end()); |
| 202 Paint(); | 202 Paint(); |
| 203 // TODO(ajwong): Need to block here to be synchronous. | 203 // TODO(ajwong): Need to block here to be synchronous. |
| 204 } | 204 } |
| 205 | 205 |
| 206 | 206 |
| 207 void PepperView::OnDecodeDone() { | 207 void PepperView::OnDecodeDone() { |
| 208 } | 208 } |
| 209 | 209 |
| 210 } // namespace remoting | 210 } // namespace remoting |
| OLD | NEW |