Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ | |
| 6 #define BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "blimp/client/core/session/assignment_source.h" | |
| 11 #include "blimp/client/core/session/network_event_observer.h" | |
| 12 #include "blimp/net/blimp_connection.h" | |
| 13 #include "blimp/net/blimp_connection_statistics.h" | |
| 14 #include "blimp/net/browser_connection_handler.h" | |
| 15 #include "blimp/net/client_connection_manager.h" | |
| 16 | |
| 17 namespace blimp { | |
| 18 namespace client { | |
| 19 | |
| 20 // This class's functions and destruction must all be invoked on the IO thread | |
|
Kevin M
2016/07/29 18:56:03
Perhaps we should add some ThreadChecker checks, j
nyquist
2016/07/29 21:07:52
Done. I didn't pass it in though, so it's just wha
| |
| 21 // by the owner. | |
| 22 class ClientNetworkComponents : public ConnectionHandler, | |
| 23 public ConnectionErrorObserver { | |
| 24 public: | |
| 25 // Can be created on any thread. | |
| 26 ClientNetworkComponents( | |
| 27 std::unique_ptr<NetworkEventObserver> observer, | |
| 28 std::unique_ptr<BlimpConnectionStatistics> blimp_connection_statistics); | |
| 29 ~ClientNetworkComponents() override; | |
| 30 | |
| 31 // Sets up network components. | |
| 32 void Initialize(); | |
| 33 | |
| 34 // Starts the connection to the engine using the given |assignment|. | |
| 35 // It is required to first call Initialize. | |
| 36 void ConnectWithAssignment(const Assignment& assignment); | |
| 37 | |
| 38 BrowserConnectionHandler* GetBrowserConnectionHandler(); | |
| 39 | |
| 40 void DropCurrentConnection(); | |
|
Kevin M
2016/07/29 18:56:03
Remove this method and replace references to it wi
nyquist
2016/07/29 21:07:52
Done.
| |
| 41 | |
| 42 private: | |
| 43 // ConnectionHandler implementation. | |
| 44 void HandleConnection(std::unique_ptr<BlimpConnection> connection) override; | |
| 45 | |
| 46 // ConnectionErrorObserver implementation. | |
| 47 void OnConnectionError(int error) override; | |
| 48 | |
| 49 std::unique_ptr<BrowserConnectionHandler> connection_handler_; | |
|
Kevin M
2016/07/29 18:56:03
No need to make this a unique_ptr.
nyquist
2016/07/29 21:07:52
Done.
| |
| 50 std::unique_ptr<ClientConnectionManager> connection_manager_; | |
| 51 std::unique_ptr<NetworkEventObserver> network_observer_; | |
| 52 std::unique_ptr<BlimpConnectionStatistics> connection_statistics_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents); | |
| 55 }; | |
| 56 | |
| 57 } // namespace client | |
| 58 } // namespace blimp | |
| 59 | |
| 60 #endif // BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_ | |
| OLD | NEW |