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

Side by Side Diff: blimp/client/session/blimp_client_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: Decoupled BlobChannelSenderHost from mojom::BlobChannel Created 4 years, 7 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/client/session/blimp_client_session.h" 5 #include "blimp/client/session/blimp_client_session.h"
6 6
7 #include <vector> 7 #include <vector>
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/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/threading/sequenced_task_runner_handle.h" 14 #include "base/threading/sequenced_task_runner_handle.h"
15 #include "blimp/client/app/blimp_client_switches.h" 15 #include "blimp/client/app/blimp_client_switches.h"
16 #include "blimp/client/feature/compositor/client_image_serialization_processor.h "
Wez 2016/05/21 01:08:04 Non-wrapped line exceeds 80 chars? ESTYLEGEDDON
Kevin M 2016/05/27 22:35:30 Linter thinks it's cool; I don't think that rule a
Wez 2016/06/07 01:18:31 Yup, i think not.
16 #include "blimp/client/feature/ime_feature.h" 17 #include "blimp/client/feature/ime_feature.h"
17 #include "blimp/client/feature/navigation_feature.h" 18 #include "blimp/client/feature/navigation_feature.h"
18 #include "blimp/client/feature/render_widget_feature.h" 19 #include "blimp/client/feature/render_widget_feature.h"
19 #include "blimp/client/feature/settings_feature.h" 20 #include "blimp/client/feature/settings_feature.h"
20 #include "blimp/client/feature/tab_control_feature.h" 21 #include "blimp/client/feature/tab_control_feature.h"
22 #include "blimp/common/blob_cache/in_memory_blob_cache.h"
21 #include "blimp/net/blimp_connection.h" 23 #include "blimp/net/blimp_connection.h"
22 #include "blimp/net/blimp_message_processor.h" 24 #include "blimp/net/blimp_message_processor.h"
23 #include "blimp/net/blimp_message_thread_pipe.h" 25 #include "blimp/net/blimp_message_thread_pipe.h"
26 #include "blimp/net/blob_channel/blob_channel_receiver.h"
27 #include "blimp/net/blob_channel/helium_blob_receiver_delegate.h"
24 #include "blimp/net/browser_connection_handler.h" 28 #include "blimp/net/browser_connection_handler.h"
25 #include "blimp/net/client_connection_manager.h" 29 #include "blimp/net/client_connection_manager.h"
26 #include "blimp/net/common.h" 30 #include "blimp/net/common.h"
27 #include "blimp/net/connection_handler.h" 31 #include "blimp/net/connection_handler.h"
28 #include "blimp/net/null_blimp_message_processor.h" 32 #include "blimp/net/null_blimp_message_processor.h"
29 #include "blimp/net/ssl_client_transport.h" 33 #include "blimp/net/ssl_client_transport.h"
30 #include "blimp/net/tcp_client_transport.h" 34 #include "blimp/net/tcp_client_transport.h"
31 #include "blimp/net/thread_pipe_manager.h" 35 #include "blimp/net/thread_pipe_manager.h"
32 #include "net/base/address_list.h" 36 #include "net/base/address_list.h"
33 #include "net/base/ip_address.h" 37 #include "net/base/ip_address.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 connection_handler_->HandleConnection(std::move(connection)); 157 connection_handler_->HandleConnection(std::move(connection));
154 } 158 }
155 159
156 void ClientNetworkComponents::OnConnectionError(int result) { 160 void ClientNetworkComponents::OnConnectionError(int result) {
157 VLOG(1) << "Connection error: " << net::ErrorToString(result); 161 VLOG(1) << "Connection error: " << net::ErrorToString(result);
158 network_observer_->OnDisconnected(result); 162 network_observer_->OnDisconnected(result);
159 } 163 }
160 164
161 BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint) 165 BlimpClientSession::BlimpClientSession(const GURL& assigner_endpoint)
162 : io_thread_("BlimpIOThread"), 166 : io_thread_("BlimpIOThread"),
167 blob_delegate_(new HeliumBlobReceiverDelegate),
168 blob_receiver_(
169 new BlobChannelReceiverImpl(base::WrapUnique(new InMemoryBlobCache),
170 base::WrapUnique(blob_delegate_))),
Wez 2016/05/21 01:08:04 Would be super duper awesome to avoid this gross p
Kevin M 2016/05/27 22:35:30 Done.
163 tab_control_feature_(new TabControlFeature), 171 tab_control_feature_(new TabControlFeature),
164 navigation_feature_(new NavigationFeature), 172 navigation_feature_(new NavigationFeature),
165 ime_feature_(new ImeFeature), 173 ime_feature_(new ImeFeature),
166 render_widget_feature_(new RenderWidgetFeature), 174 render_widget_feature_(new RenderWidgetFeature),
167 settings_feature_(new SettingsFeature), 175 settings_feature_(new SettingsFeature),
168 weak_factory_(this) { 176 weak_factory_(this) {
169 net_components_.reset(new ClientNetworkComponents( 177 net_components_.reset(new ClientNetworkComponents(
170 base::WrapUnique(new CrossThreadNetworkEventObserver( 178 base::WrapUnique(new CrossThreadNetworkEventObserver(
171 weak_factory_.GetWeakPtr(), 179 weak_factory_.GetWeakPtr(),
172 base::SequencedTaskRunnerHandle::Get())))); 180 base::SequencedTaskRunnerHandle::Get()))));
173 base::Thread::Options options; 181 base::Thread::Options options;
174 options.message_loop_type = base::MessageLoop::TYPE_IO; 182 options.message_loop_type = base::MessageLoop::TYPE_IO;
175 io_thread_.StartWithOptions(options); 183 io_thread_.StartWithOptions(options);
176 184
177 assignment_source_.reset(new AssignmentSource( 185 assignment_source_.reset(new AssignmentSource(
178 assigner_endpoint, io_thread_.task_runner(), io_thread_.task_runner())); 186 assigner_endpoint, io_thread_.task_runner(), io_thread_.task_runner()));
179 187
180 RegisterFeatures(); 188 RegisterFeatures();
181 189
190 ClientImageSerializationProcessor::GetInstance()->set_blob_receiver(
191 blob_receiver_.get());
192
182 // Initialize must only be posted after the RegisterFeature calls have 193 // Initialize must only be posted after the RegisterFeature calls have
183 // completed. 194 // completed.
184 io_thread_.task_runner()->PostTask( 195 io_thread_.task_runner()->PostTask(
185 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize, 196 FROM_HERE, base::Bind(&ClientNetworkComponents::Initialize,
186 base::Unretained(net_components_.get()))); 197 base::Unretained(net_components_.get())));
187 } 198 }
188 199
189 BlimpClientSession::~BlimpClientSession() { 200 BlimpClientSession::~BlimpClientSession() {
190 io_thread_.task_runner()->DeleteSoon(FROM_HERE, net_components_.release()); 201 io_thread_.task_runner()->DeleteSoon(FROM_HERE, net_components_.release());
191 } 202 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 navigation_feature_.get())); 240 navigation_feature_.get()));
230 render_widget_feature_->set_outgoing_input_message_processor( 241 render_widget_feature_->set_outgoing_input_message_processor(
231 thread_pipe_manager_->RegisterFeature(BlimpMessage::INPUT, 242 thread_pipe_manager_->RegisterFeature(BlimpMessage::INPUT,
232 render_widget_feature_.get())); 243 render_widget_feature_.get()));
233 render_widget_feature_->set_outgoing_compositor_message_processor( 244 render_widget_feature_->set_outgoing_compositor_message_processor(
234 thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR, 245 thread_pipe_manager_->RegisterFeature(BlimpMessage::COMPOSITOR,
235 render_widget_feature_.get())); 246 render_widget_feature_.get()));
236 settings_feature_->set_outgoing_message_processor( 247 settings_feature_->set_outgoing_message_processor(
237 thread_pipe_manager_->RegisterFeature(BlimpMessage::SETTINGS, 248 thread_pipe_manager_->RegisterFeature(BlimpMessage::SETTINGS,
238 settings_feature_.get())); 249 settings_feature_.get()));
250 thread_pipe_manager_->RegisterFeature(BlimpMessage::BLOB_CHANNEL,
251 blob_delegate_);
239 252
240 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 253 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
241 switches::kDownloadWholeDocument)) 254 switches::kDownloadWholeDocument))
242 settings_feature_->SetRecordWholeDocument(true); 255 settings_feature_->SetRecordWholeDocument(true);
243 256
244 // Client will not send send any RenderWidget messages, so don't save the 257 // Client will not send send any RenderWidget messages, so don't save the
245 // outgoing BlimpMessageProcessor in the RenderWidgetFeature. 258 // outgoing BlimpMessageProcessor in the RenderWidgetFeature.
246 thread_pipe_manager_->RegisterFeature(BlimpMessage::RENDER_WIDGET, 259 thread_pipe_manager_->RegisterFeature(BlimpMessage::RENDER_WIDGET,
247 render_widget_feature_.get()); 260 render_widget_feature_.get());
248 261
(...skipping 21 matching lines...) Expand all
270 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const { 283 RenderWidgetFeature* BlimpClientSession::GetRenderWidgetFeature() const {
271 return render_widget_feature_.get(); 284 return render_widget_feature_.get();
272 } 285 }
273 286
274 SettingsFeature* BlimpClientSession::GetSettingsFeature() const { 287 SettingsFeature* BlimpClientSession::GetSettingsFeature() const {
275 return settings_feature_.get(); 288 return settings_feature_.get();
276 } 289 }
277 290
278 } // namespace client 291 } // namespace client
279 } // namespace blimp 292 } // namespace blimp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698