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

Side by Side Diff: blimp/engine/session/blimp_engine_session.cc

Issue 1985863002: Incorporate BlobChannel into Blimp image encode/decode pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-helium
Patch Set: moved the blob serialization processor to the compositor manager Created 4 years, 6 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/engine/session/blimp_engine_session.h" 5 #include "blimp/engine/session/blimp_engine_session.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "blimp/common/blob_cache/in_memory_blob_cache.h"
15 #include "blimp/common/create_blimp_message.h" 16 #include "blimp/common/create_blimp_message.h"
16 #include "blimp/common/proto/tab_control.pb.h" 17 #include "blimp/common/proto/tab_control.pb.h"
17 #include "blimp/engine/app/blimp_engine_config.h" 18 #include "blimp/engine/app/blimp_engine_config.h"
18 #include "blimp/engine/app/settings_manager.h" 19 #include "blimp/engine/app/settings_manager.h"
19 #include "blimp/engine/app/switches.h" 20 #include "blimp/engine/app/switches.h"
20 #include "blimp/engine/app/ui/blimp_layout_manager.h" 21 #include "blimp/engine/app/ui/blimp_layout_manager.h"
21 #include "blimp/engine/app/ui/blimp_screen.h" 22 #include "blimp/engine/app/ui/blimp_screen.h"
22 #include "blimp/engine/app/ui/blimp_window_tree_client.h" 23 #include "blimp/engine/app/ui/blimp_window_tree_client.h"
23 #include "blimp/engine/app/ui/blimp_window_tree_host.h" 24 #include "blimp/engine/app/ui/blimp_window_tree_host.h"
24 #include "blimp/engine/common/blimp_browser_context.h" 25 #include "blimp/engine/common/blimp_browser_context.h"
25 #include "blimp/engine/common/blimp_user_agent.h" 26 #include "blimp/engine/common/blimp_user_agent.h"
26 #include "blimp/net/blimp_connection.h" 27 #include "blimp/net/blimp_connection.h"
27 #include "blimp/net/blimp_connection_statistics.h" 28 #include "blimp/net/blimp_connection_statistics.h"
28 #include "blimp/net/blimp_message_multiplexer.h" 29 #include "blimp/net/blimp_message_multiplexer.h"
29 #include "blimp/net/blimp_message_thread_pipe.h" 30 #include "blimp/net/blimp_message_thread_pipe.h"
31 #include "blimp/net/blob_channel/blob_channel_sender_impl.h"
32 #include "blimp/net/blob_channel/helium_blob_sender_delegate.h"
30 #include "blimp/net/browser_connection_handler.h" 33 #include "blimp/net/browser_connection_handler.h"
31 #include "blimp/net/common.h" 34 #include "blimp/net/common.h"
32 #include "blimp/net/engine_authentication_handler.h" 35 #include "blimp/net/engine_authentication_handler.h"
33 #include "blimp/net/engine_connection_manager.h" 36 #include "blimp/net/engine_connection_manager.h"
34 #include "blimp/net/null_blimp_message_processor.h" 37 #include "blimp/net/null_blimp_message_processor.h"
35 #include "blimp/net/tcp_engine_transport.h" 38 #include "blimp/net/tcp_engine_transport.h"
36 #include "blimp/net/thread_pipe_manager.h" 39 #include "blimp/net/thread_pipe_manager.h"
37 #include "content/public/browser/browser_context.h" 40 #include "content/public/browser/browser_context.h"
38 #include "content/public/browser/browser_thread.h" 41 #include "content/public/browser/browser_thread.h"
39 #include "content/public/browser/navigation_controller.h" 42 #include "content/public/browser/navigation_controller.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 browser_context_(std::move(browser_context)), 218 browser_context_(std::move(browser_context)),
216 engine_config_(engine_config), 219 engine_config_(engine_config),
217 settings_manager_(settings_manager), 220 settings_manager_(settings_manager),
218 settings_feature_(settings_manager_), 221 settings_feature_(settings_manager_),
219 render_widget_feature_(settings_manager_), 222 render_widget_feature_(settings_manager_),
220 net_components_( 223 net_components_(
221 new EngineNetworkComponents(net_log, 224 new EngineNetworkComponents(net_log,
222 QuitCurrentMessageLoopClosure())) { 225 QuitCurrentMessageLoopClosure())) {
223 DCHECK(engine_config_); 226 DCHECK(engine_config_);
224 DCHECK(settings_manager_); 227 DCHECK(settings_manager_);
225 screen_->UpdateDisplayScaleAndSize(kDefaultScaleFactor, 228
226 gfx::Size(kDefaultDisplayWidth, 229 screen_->UpdateDisplayScaleAndSize(
227 kDefaultDisplayHeight)); 230 kDefaultScaleFactor,
231 gfx::Size(kDefaultDisplayWidth, kDefaultDisplayHeight));
228 render_widget_feature_.SetDelegate(kDummyTabId, this); 232 render_widget_feature_.SetDelegate(kDummyTabId, this);
233
234 std::unique_ptr<HeliumBlobSenderDelegate> helium_blob_delegate(
235 new HeliumBlobSenderDelegate);
236 blob_delegate_ = helium_blob_delegate.get();
237 blob_channel_sender_ = base::WrapUnique(
238 new BlobChannelSenderImpl(base::WrapUnique(new InMemoryBlobCache),
239 std::move(helium_blob_delegate)));
229 } 240 }
230 241
231 BlimpEngineSession::~BlimpEngineSession() { 242 BlimpEngineSession::~BlimpEngineSession() {
232 render_widget_feature_.RemoveDelegate(kDummyTabId); 243 render_widget_feature_.RemoveDelegate(kDummyTabId);
233 244
234 window_tree_host_->GetInputMethod()->RemoveObserver(this); 245 window_tree_host_->GetInputMethod()->RemoveObserver(this);
235 246
236 page_load_tracker_.reset(); 247 page_load_tracker_.reset();
237 248
238 // Ensure that all WebContents are torn down first, since teardown will 249 // Ensure that all WebContents are torn down first, since teardown will
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 &render_widget_feature_)); 316 &render_widget_feature_));
306 render_widget_feature_.set_input_message_sender( 317 render_widget_feature_.set_input_message_sender(
307 thread_pipe_manager_->RegisterFeature(BlimpMessage::kInput, 318 thread_pipe_manager_->RegisterFeature(BlimpMessage::kInput,
308 &render_widget_feature_)); 319 &render_widget_feature_));
309 render_widget_feature_.set_compositor_message_sender( 320 render_widget_feature_.set_compositor_message_sender(
310 thread_pipe_manager_->RegisterFeature(BlimpMessage::kCompositor, 321 thread_pipe_manager_->RegisterFeature(BlimpMessage::kCompositor,
311 &render_widget_feature_)); 322 &render_widget_feature_));
312 render_widget_feature_.set_ime_message_sender( 323 render_widget_feature_.set_ime_message_sender(
313 thread_pipe_manager_->RegisterFeature(BlimpMessage::kIme, 324 thread_pipe_manager_->RegisterFeature(BlimpMessage::kIme,
314 &render_widget_feature_)); 325 &render_widget_feature_));
326 blob_delegate_->set_outgoing_message_processor(
327 thread_pipe_manager_->RegisterFeature(BlimpMessage::kBlobChannel,
328 blob_delegate_));
315 329
316 // The Settings feature does not need an outgoing message processor, since we 330 // The Settings feature does not need an outgoing message processor, since we
317 // don't send any messages to the client right now. 331 // don't send any messages to the client right now.
318 thread_pipe_manager_->RegisterFeature(BlimpMessage::kSettings, 332 thread_pipe_manager_->RegisterFeature(BlimpMessage::kSettings,
319 &settings_feature_); 333 &settings_feature_);
320 } 334 }
321 335
322 bool BlimpEngineSession::CreateWebContents(const int target_tab_id) { 336 bool BlimpEngineSession::CreateWebContents(const int target_tab_id) {
323 DVLOG(1) << "Create tab " << target_tab_id; 337 DVLOG(1) << "Create tab " << target_tab_id;
324 // TODO(haibinlu): Support more than one active WebContents (crbug/547231). 338 // TODO(haibinlu): Support more than one active WebContents (crbug/547231).
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 if (!url.is_valid()) { 382 if (!url.is_valid()) {
369 VLOG(1) << "Dropping invalid URL " << url; 383 VLOG(1) << "Dropping invalid URL " << url;
370 return; 384 return;
371 } 385 }
372 386
373 // TODO(dtrainor, haibinlu): Fix up the URL with url_fixer.h. If that doesn't 387 // TODO(dtrainor, haibinlu): Fix up the URL with url_fixer.h. If that doesn't
374 // produce a valid spec() then try to build a search query? 388 // produce a valid spec() then try to build a search query?
375 content::NavigationController::LoadURLParams params(url); 389 content::NavigationController::LoadURLParams params(url);
376 params.transition_type = ui::PageTransitionFromInt( 390 params.transition_type = ui::PageTransitionFromInt(
377 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); 391 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
378 params.override_user_agent = 392 params.override_user_agent = content::NavigationController::UA_OVERRIDE_TRUE;
379 content::NavigationController::UA_OVERRIDE_TRUE;
380 web_contents_->GetController().LoadURLWithParams(params); 393 web_contents_->GetController().LoadURLWithParams(params);
381 web_contents_->Focus(); 394 web_contents_->Focus();
382 } 395 }
383 396
384 void BlimpEngineSession::GoBack(const int target_tab_id) { 397 void BlimpEngineSession::GoBack(const int target_tab_id) {
385 DVLOG(1) << "Back in tab " << target_tab_id; 398 DVLOG(1) << "Back in tab " << target_tab_id;
386 web_contents_->GetController().GoBack(); 399 web_contents_->GetController().GoBack();
387 } 400 }
388 401
389 void BlimpEngineSession::GoForward(const int target_tab_id) { 402 void BlimpEngineSession::GoForward(const int target_tab_id) {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 content::NavigationController::LoadURLParams load_url_params(params.url); 548 content::NavigationController::LoadURLParams load_url_params(params.url);
536 load_url_params.source_site_instance = params.source_site_instance; 549 load_url_params.source_site_instance = params.source_site_instance;
537 load_url_params.referrer = params.referrer; 550 load_url_params.referrer = params.referrer;
538 load_url_params.frame_tree_node_id = params.frame_tree_node_id; 551 load_url_params.frame_tree_node_id = params.frame_tree_node_id;
539 load_url_params.transition_type = params.transition; 552 load_url_params.transition_type = params.transition;
540 load_url_params.extra_headers = params.extra_headers; 553 load_url_params.extra_headers = params.extra_headers;
541 load_url_params.should_replace_current_entry = 554 load_url_params.should_replace_current_entry =
542 params.should_replace_current_entry; 555 params.should_replace_current_entry;
543 load_url_params.is_renderer_initiated = params.is_renderer_initiated; 556 load_url_params.is_renderer_initiated = params.is_renderer_initiated;
544 load_url_params.override_user_agent = 557 load_url_params.override_user_agent =
545 content::NavigationController::UA_OVERRIDE_TRUE; 558 content::NavigationController::UA_OVERRIDE_TRUE;
546 559
547 source->GetController().LoadURLWithParams(load_url_params); 560 source->GetController().LoadURLWithParams(load_url_params);
548 return source; 561 return source;
549 } 562 }
550 563
551 void BlimpEngineSession::RequestToLockMouse(content::WebContents* web_contents, 564 void BlimpEngineSession::RequestToLockMouse(content::WebContents* web_contents,
552 bool user_gesture, 565 bool user_gesture,
553 bool last_unlocked_by_target) { 566 bool last_unlocked_by_target) {
554 web_contents->GotResponseToLockMouseRequest(true); 567 web_contents->GotResponseToLockMouseRequest(true);
555 } 568 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 page_load_tracker_.reset(new PageLoadTracker(web_contents_.get(), this)); 672 page_load_tracker_.reset(new PageLoadTracker(web_contents_.get(), this));
660 aura::Window* parent = window_tree_host_->window(); 673 aura::Window* parent = window_tree_host_->window();
661 aura::Window* content = web_contents_->GetNativeView(); 674 aura::Window* content = web_contents_->GetNativeView();
662 if (!parent->Contains(content)) 675 if (!parent->Contains(content))
663 parent->AddChild(content); 676 parent->AddChild(content);
664 content->Show(); 677 content->Show();
665 } 678 }
666 679
667 } // namespace engine 680 } // namespace engine
668 } // namespace blimp 681 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698