OLD | NEW |
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/create_blimp_message.h" | 15 #include "blimp/common/create_blimp_message.h" |
16 #include "blimp/common/proto/tab_control.pb.h" | 16 #include "blimp/common/proto/tab_control.pb.h" |
17 #include "blimp/engine/app/blimp_engine_config.h" | 17 #include "blimp/engine/app/blimp_engine_config.h" |
18 #include "blimp/engine/app/settings_manager.h" | 18 #include "blimp/engine/app/settings_manager.h" |
19 #include "blimp/engine/app/switches.h" | 19 #include "blimp/engine/app/switches.h" |
20 #include "blimp/engine/app/ui/blimp_layout_manager.h" | 20 #include "blimp/engine/app/ui/blimp_layout_manager.h" |
21 #include "blimp/engine/app/ui/blimp_screen.h" | 21 #include "blimp/engine/app/ui/blimp_screen.h" |
22 #include "blimp/engine/app/ui/blimp_window_tree_client.h" | 22 #include "blimp/engine/app/ui/blimp_window_tree_client.h" |
23 #include "blimp/engine/app/ui/blimp_window_tree_host.h" | 23 #include "blimp/engine/app/ui/blimp_window_tree_host.h" |
24 #include "blimp/engine/common/blimp_browser_context.h" | 24 #include "blimp/engine/common/blimp_browser_context.h" |
25 #include "blimp/engine/common/blimp_user_agent.h" | 25 #include "blimp/engine/common/blimp_user_agent.h" |
26 #include "blimp/net/blimp_connection.h" | 26 #include "blimp/net/blimp_connection.h" |
| 27 #include "blimp/net/blimp_connection_statistics.h" |
27 #include "blimp/net/blimp_message_multiplexer.h" | 28 #include "blimp/net/blimp_message_multiplexer.h" |
28 #include "blimp/net/blimp_message_thread_pipe.h" | 29 #include "blimp/net/blimp_message_thread_pipe.h" |
29 #include "blimp/net/browser_connection_handler.h" | 30 #include "blimp/net/browser_connection_handler.h" |
30 #include "blimp/net/common.h" | 31 #include "blimp/net/common.h" |
31 #include "blimp/net/engine_authentication_handler.h" | 32 #include "blimp/net/engine_authentication_handler.h" |
32 #include "blimp/net/engine_connection_manager.h" | 33 #include "blimp/net/engine_connection_manager.h" |
33 #include "blimp/net/null_blimp_message_processor.h" | 34 #include "blimp/net/null_blimp_message_processor.h" |
34 #include "blimp/net/tcp_engine_transport.h" | 35 #include "blimp/net/tcp_engine_transport.h" |
35 #include "blimp/net/thread_pipe_manager.h" | 36 #include "blimp/net/thread_pipe_manager.h" |
36 #include "content/public/browser/browser_context.h" | 37 #include "content/public/browser/browser_context.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // terminated. | 143 // terminated. |
143 void OnConnectionError(int error) override; | 144 void OnConnectionError(int error) override; |
144 | 145 |
145 net::NetLog* net_log_; | 146 net::NetLog* net_log_; |
146 base::Closure quit_closure_; | 147 base::Closure quit_closure_; |
147 uint16_t port_ = 0; | 148 uint16_t port_ = 0; |
148 | 149 |
149 std::unique_ptr<BrowserConnectionHandler> connection_handler_; | 150 std::unique_ptr<BrowserConnectionHandler> connection_handler_; |
150 std::unique_ptr<EngineAuthenticationHandler> authentication_handler_; | 151 std::unique_ptr<EngineAuthenticationHandler> authentication_handler_; |
151 std::unique_ptr<EngineConnectionManager> connection_manager_; | 152 std::unique_ptr<EngineConnectionManager> connection_manager_; |
| 153 BlimpConnectionStatistics blimp_connection_statistics_; |
152 | 154 |
153 DISALLOW_COPY_AND_ASSIGN(EngineNetworkComponents); | 155 DISALLOW_COPY_AND_ASSIGN(EngineNetworkComponents); |
154 }; | 156 }; |
155 | 157 |
156 EngineNetworkComponents::EngineNetworkComponents( | 158 EngineNetworkComponents::EngineNetworkComponents( |
157 net::NetLog* net_log, | 159 net::NetLog* net_log, |
158 const base::Closure& quit_closure) | 160 const base::Closure& quit_closure) |
159 : net_log_(net_log), | 161 : net_log_(net_log), |
160 quit_closure_(quit_closure), | 162 quit_closure_(quit_closure), |
161 connection_handler_(new BrowserConnectionHandler) {} | 163 connection_handler_(new BrowserConnectionHandler) {} |
(...skipping 10 matching lines...) Expand all Loading... |
172 // to |this| (which will then pass it to |connection_handler_|. | 174 // to |this| (which will then pass it to |connection_handler_|. |
173 authentication_handler_ = | 175 authentication_handler_ = |
174 base::WrapUnique(new EngineAuthenticationHandler(this, client_token)); | 176 base::WrapUnique(new EngineAuthenticationHandler(this, client_token)); |
175 | 177 |
176 // Plumb unauthenticated connections to |authentication_handler_|. | 178 // Plumb unauthenticated connections to |authentication_handler_|. |
177 connection_manager_ = base::WrapUnique( | 179 connection_manager_ = base::WrapUnique( |
178 new EngineConnectionManager(authentication_handler_.get())); | 180 new EngineConnectionManager(authentication_handler_.get())); |
179 | 181 |
180 // Adds BlimpTransports to connection_manager_. | 182 // Adds BlimpTransports to connection_manager_. |
181 net::IPEndPoint address(GetIPv4AnyAddress(), GetListeningPort()); | 183 net::IPEndPoint address(GetIPv4AnyAddress(), GetListeningPort()); |
182 TCPEngineTransport* transport = new TCPEngineTransport(address, net_log_); | 184 TCPEngineTransport* transport = |
| 185 new TCPEngineTransport(address, &blimp_connection_statistics_, net_log_); |
183 connection_manager_->AddTransport(base::WrapUnique(transport)); | 186 connection_manager_->AddTransport(base::WrapUnique(transport)); |
184 | 187 |
185 transport->GetLocalAddress(&address); | 188 transport->GetLocalAddress(&address); |
186 port_ = address.port(); | 189 port_ = address.port(); |
187 } | 190 } |
188 | 191 |
189 void EngineNetworkComponents::HandleConnection( | 192 void EngineNetworkComponents::HandleConnection( |
190 std::unique_ptr<BlimpConnection> connection) { | 193 std::unique_ptr<BlimpConnection> connection) { |
191 // Observe |connection| for disconnection events. | 194 // Observe |connection| for disconnection events. |
192 connection->AddConnectionErrorObserver(this); | 195 connection->AddConnectionErrorObserver(this); |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 page_load_tracker_.reset(new PageLoadTracker(web_contents_.get(), this)); | 661 page_load_tracker_.reset(new PageLoadTracker(web_contents_.get(), this)); |
659 aura::Window* parent = window_tree_host_->window(); | 662 aura::Window* parent = window_tree_host_->window(); |
660 aura::Window* content = web_contents_->GetNativeView(); | 663 aura::Window* content = web_contents_->GetNativeView(); |
661 if (!parent->Contains(content)) | 664 if (!parent->Contains(content)) |
662 parent->AddChild(content); | 665 parent->AddChild(content); |
663 content->Show(); | 666 content->Show(); |
664 } | 667 } |
665 | 668 |
666 } // namespace engine | 669 } // namespace engine |
667 } // namespace blimp | 670 } // namespace blimp |
OLD | NEW |