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

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: More CR feedback. 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
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 LOG(ERROR) << "Media library not initialized."; 111 LOG(ERROR) << "Media library not initialized.";
112 return false; 112 return false;
113 } 113 }
114 114
115 // Start all the threads. 115 // Start all the threads.
116 context_.Start(); 116 context_.Start();
117 117
118 // Create the chromoting objects that don't depend on the network connection. 118 // Create the chromoting objects that don't depend on the network connection.
119 // Because we decode on a separate thread we need a FrameConsumerProxy to 119 // Because we decode on a separate thread we need a FrameConsumerProxy to
120 // bounce calls from the RectangleUpdateDecoder back to the plugin thread. 120 // bounce calls from the RectangleUpdateDecoder back to the plugin thread.
121 view_.reset(new PepperView(this, &context_)); 121 consumer_proxy_ = new FrameConsumerProxy(plugin_message_loop_);
122 consumer_proxy_ = new FrameConsumerProxy(view_.get(), plugin_message_loop_);
123 rectangle_decoder_ = new RectangleUpdateDecoder( 122 rectangle_decoder_ = new RectangleUpdateDecoder(
124 context_.decode_message_loop(), consumer_proxy_.get()); 123 context_.decode_message_loop(), consumer_proxy_.get());
125 124 view_.reset(new PepperView(this, &context_, rectangle_decoder_.get()));
126 // Default to a medium grey. 125 consumer_proxy_->Attach(view_.get());
127 view_->SetSolidFill(0xFFCDCDCD);
128 126
129 return true; 127 return true;
130 } 128 }
131 129
132 void ChromotingInstance::Connect(const ClientConfig& config) { 130 void ChromotingInstance::Connect(const ClientConfig& config) {
133 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 131 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
134 132
135 host_connection_.reset(new protocol::ConnectionToHost( 133 host_connection_.reset(new protocol::ConnectionToHost(
136 context_.network_message_loop(), this, true)); 134 context_.network_message_loop(), this, true));
137 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(), 135 client_.reset(new ChromotingClient(config, &context_, host_connection_.get(),
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 GetScriptableObject()->SetConnectionStatus( 186 GetScriptableObject()->SetConnectionStatus(
189 ChromotingScriptableObject::STATUS_CLOSED, 187 ChromotingScriptableObject::STATUS_CLOSED,
190 ChromotingScriptableObject::ERROR_NONE); 188 ChromotingScriptableObject::ERROR_NONE);
191 } 189 }
192 190
193 void ChromotingInstance::DidChangeView(const pp::Rect& position, 191 void ChromotingInstance::DidChangeView(const pp::Rect& position,
194 const pp::Rect& clip) { 192 const pp::Rect& clip) {
195 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 193 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
196 194
197 SkISize new_size = SkISize::Make(position.width(), position.height()); 195 SkISize new_size = SkISize::Make(position.width(), position.height());
198 if (view_->SetViewSize(new_size)) { 196 SkIRect new_clip =
199 if (mouse_input_filter_.get()) { 197 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height());
200 mouse_input_filter_->set_input_size(new_size); 198
201 } 199 view_->SetView(new_size, new_clip);
202 rectangle_decoder_->SetOutputSize(new_size); 200
201 if (mouse_input_filter_.get()) {
202 mouse_input_filter_->set_input_size(view_->get_view_size());
203 } 203 }
204
205 rectangle_decoder_->UpdateClipRect(
206 SkIRect::MakeXYWH(clip.x(), clip.y(), clip.width(), clip.height()));
207 } 204 }
208 205
209 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { 206 bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) {
210 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); 207 DCHECK(plugin_message_loop_->BelongsToCurrentThread());
211 208
212 if (!input_handler_.get()) 209 if (!input_handler_.get())
213 return false; 210 return false;
214 211
215 // TODO(wez): When we have a good hook into Host dimensions changes, move 212 // TODO(wez): When we have a good hook into Host dimensions changes, move
216 // this there. 213 // this there.
217 // If |input_handler_| is valid, then |mouse_input_filter_| must also be 214 // If |input_handler_| is valid, then |mouse_input_filter_| must also be
218 // since they are constructed together as part of the input pipeline 215 // since they are constructed together as part of the input pipeline
219 mouse_input_filter_->set_output_size(view_->get_host_size()); 216 mouse_input_filter_->set_output_size(view_->get_screen_size());
220 217
221 return input_handler_->HandleInputEvent(event); 218 return input_handler_->HandleInputEvent(event);
222 } 219 }
223 220
224 ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() { 221 ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() {
225 pp::VarPrivate object = GetInstanceObject(); 222 pp::VarPrivate object = GetInstanceObject();
226 if (!object.is_undefined()) { 223 if (!object.is_undefined()) {
227 pp::deprecated::ScriptableObject* so = object.AsScriptableObject(); 224 pp::deprecated::ScriptableObject* so = object.AsScriptableObject();
228 DCHECK(so != NULL); 225 DCHECK(so != NULL);
229 return static_cast<ChromotingScriptableObject*>(so); 226 return static_cast<ChromotingScriptableObject*>(so);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return client_->GetStats(); 343 return client_->GetStats();
347 } 344 }
348 345
349 void ChromotingInstance::ReleaseAllKeys() { 346 void ChromotingInstance::ReleaseAllKeys() {
350 if (key_event_tracker_.get()) { 347 if (key_event_tracker_.get()) {
351 key_event_tracker_->ReleaseAllKeys(); 348 key_event_tracker_->ReleaseAllKeys();
352 } 349 }
353 } 350 }
354 351
355 } // namespace remoting 352 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698