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

Side by Side Diff: remoting/client/plugin/chromoting_instance.cc

Issue 9331003: Improving the decoder pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Integer ScaleRect Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/client/frame_producer.h ('k') | remoting/client/plugin/pepper_view.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/plugin/chromoting_instance.h" 5 #include "remoting/client/plugin/chromoting_instance.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 LOG(ERROR) << "Media library not initialized."; 190 LOG(ERROR) << "Media library not initialized.";
191 return false; 191 return false;
192 } 192 }
193 193
194 // Start all the threads. 194 // Start all the threads.
195 context_.Start(); 195 context_.Start();
196 196
197 // Create the chromoting objects that don't depend on the network connection. 197 // Create the chromoting objects that don't depend on the network connection.
198 // Because we decode on a separate thread we need a FrameConsumerProxy to 198 // Because we decode on a separate thread we need a FrameConsumerProxy to
199 // bounce calls from the RectangleUpdateDecoder back to the plugin thread. 199 // bounce calls from the RectangleUpdateDecoder back to the plugin thread.
200 view_.reset(new PepperView(this, &context_)); 200 consumer_proxy_ = new FrameConsumerProxy(plugin_message_loop_);
201 consumer_proxy_ = new FrameConsumerProxy(view_.get(), plugin_message_loop_);
202 rectangle_decoder_ = new RectangleUpdateDecoder( 201 rectangle_decoder_ = new RectangleUpdateDecoder(
203 context_.decode_message_loop(), consumer_proxy_.get()); 202 context_.decode_message_loop(), consumer_proxy_.get());
204 203 view_.reset(new PepperView(this, &context_, rectangle_decoder_.get()));
205 // Default to a medium grey. 204 consumer_proxy_->Attach(view_.get());
206 view_->SetSolidFill(0xFFCDCDCD);
207 205
208 return true; 206 return true;
209 } 207 }
210 208
211 void ChromotingInstance::HandleMessage(const pp::Var& message) { 209 void ChromotingInstance::HandleMessage(const pp::Var& message) {
212 if (!message.is_string()) { 210 if (!message.is_string()) {
213 LOG(ERROR) << "Received a message that is not a string."; 211 LOG(ERROR) << "Received a message that is not a string.";
214 return; 212 return;
215 } 213 }
216 214
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } else if (method == "releaseAllKeys") { 252 } else if (method == "releaseAllKeys") {
255 ReleaseAllKeys(); 253 ReleaseAllKeys();
256 } 254 }
257 } 255 }
258 256
259 void ChromotingInstance::DidChangeView(const pp::Rect& position, 257 void ChromotingInstance::DidChangeView(const pp::Rect& position,
260 const pp::Rect& clip) { 258 const pp::Rect& clip) {
261 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 259 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
262 260
263 SkISize new_size = SkISize::Make(position.width(), position.height()); 261 SkISize new_size = SkISize::Make(position.width(), position.height());
264 if (view_->SetViewSize(new_size)) { 262 SkIRect new_clip =
265 if (mouse_input_filter_.get()) { 263 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height());
266 mouse_input_filter_->set_input_size(new_size); 264
267 } 265 view_->SetView(new_size, new_clip);
268 rectangle_decoder_->SetOutputSize(new_size); 266
267 if (mouse_input_filter_.get()) {
268 mouse_input_filter_->set_input_size(view_->get_view_size());
269 } 269 }
270
271 rectangle_decoder_->UpdateClipRect(
272 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()));
273 } 270 }
274 271
275 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { 272 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
276 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 273 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
277 274
278 if (!input_handler_.get()) 275 if (!input_handler_.get())
279 return false; 276 return false;
280 277
281 // TODO(wez): When we have a good hook into Host dimensions changes, move 278 // TODO(wez): When we have a good hook into Host dimensions changes, move
282 // this there. 279 // this there.
283 // If |input_handler_| is valid, then |mouse_input_filter_| must also be 280 // If |input_handler_| is valid, then |mouse_input_filter_| must also be
284 // since they are constructed together as part of the input pipeline 281 // since they are constructed together as part of the input pipeline
285 mouse_input_filter_->set_output_size(view_->get_host_size()); 282 mouse_input_filter_->set_output_size(view_->get_screen_size());
286 283
287 return input_handler_->HandleInputEvent(event); 284 return input_handler_->HandleInputEvent(event);
288 } 285 }
289 286
290 pp::Var ChromotingInstance::GetInstanceObject() { 287 pp::Var ChromotingInstance::GetInstanceObject() {
291 if (instance_object_.is_undefined()) { 288 if (instance_object_.is_undefined()) {
292 ChromotingScriptableObject* object = 289 ChromotingScriptableObject* object =
293 new ChromotingScriptableObject(this, plugin_message_loop_); 290 new ChromotingScriptableObject(this, plugin_message_loop_);
294 object->Init(); 291 object->Init();
295 292
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); 539 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue());
543 data->SetString("message", message); 540 data->SetString("message", message);
544 PostChromotingMessage("logDebugMessage", data.Pass()); 541 PostChromotingMessage("logDebugMessage", data.Pass());
545 542
546 scriptable_object->LogDebugInfo(message); 543 scriptable_object->LogDebugInfo(message);
547 } 544 }
548 g_logging_to_plugin = false; 545 g_logging_to_plugin = false;
549 } 546 }
550 547
551 } // namespace remoting 548 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/client/frame_producer.h ('k') | remoting/client/plugin/pepper_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698