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

Unified Diff: blimp/client/core/session/client_network_components.h

Issue 2187893002: Move more client network code to //blimp/client/core/session. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add more explanatory comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/client/core/session/BUILD.gn ('k') | blimp/client/core/session/client_network_components.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/client/core/session/client_network_components.h
diff --git a/blimp/client/core/session/client_network_components.h b/blimp/client/core/session/client_network_components.h
new file mode 100644
index 0000000000000000000000000000000000000000..bae00bcd2182af150094fd11fbf54485a3e4e1dd
--- /dev/null
+++ b/blimp/client/core/session/client_network_components.h
@@ -0,0 +1,63 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_
+#define BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_
+
+#include <memory>
+
+#include "base/threading/thread_checker.h"
+#include "blimp/client/core/session/assignment_source.h"
+#include "blimp/client/core/session/network_event_observer.h"
+#include "blimp/net/blimp_connection.h"
+#include "blimp/net/blimp_connection_statistics.h"
+#include "blimp/net/browser_connection_handler.h"
+#include "blimp/net/client_connection_manager.h"
+
+namespace blimp {
+namespace client {
+
+// This class's functions and destruction must all be invoked on the IO thread
+// by the owner. It is OK to construct the object on the main thread. The
+// ThreadChecker is initialized in the call to Initialize.
+class ClientNetworkComponents : public ConnectionHandler,
+ public ConnectionErrorObserver {
+ public:
+ // Can be created on any thread.
+ ClientNetworkComponents(
+ std::unique_ptr<NetworkEventObserver> observer,
+ std::unique_ptr<BlimpConnectionStatistics> blimp_connection_statistics);
+ ~ClientNetworkComponents() override;
+
+ // Sets up network components.
+ void Initialize();
+
+ // Starts the connection to the engine using the given |assignment|.
+ // It is required to first call Initialize.
+ void ConnectWithAssignment(const Assignment& assignment);
+
+ BrowserConnectionHandler* GetBrowserConnectionHandler();
+
+ private:
+ // ConnectionHandler implementation.
+ void HandleConnection(std::unique_ptr<BlimpConnection> connection) override;
+
+ // ConnectionErrorObserver implementation.
+ void OnConnectionError(int error) override;
+
+ // The ThreadChecker is reset during the call to Initialize.
+ base::ThreadChecker io_thread_checker_;
+
+ BrowserConnectionHandler connection_handler_;
+ std::unique_ptr<ClientConnectionManager> connection_manager_;
+ std::unique_ptr<NetworkEventObserver> network_observer_;
+ std::unique_ptr<BlimpConnectionStatistics> connection_statistics_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientNetworkComponents);
+};
+
+} // namespace client
+} // namespace blimp
+
+#endif // BLIMP_CLIENT_CORE_SESSION_CLIENT_NETWORK_COMPONENTS_H_
« no previous file with comments | « blimp/client/core/session/BUILD.gn ('k') | blimp/client/core/session/client_network_components.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698