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

Side by Side Diff: blimp/client/session/blimp_client_session.h

Issue 1985863002: Incorporate BlobChannel into Blimp image encode/decode pipeline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@blobchannel-helium
Patch Set: fix gn dependency warning & rebase 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 #ifndef BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ 5 #ifndef BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_
6 #define BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ 6 #define BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/threading/thread.h" 13 #include "base/threading/thread.h"
14 #include "blimp/client/feature/compositor/blob_image_serialization_processor.h"
14 #include "blimp/client/session/assignment_source.h" 15 #include "blimp/client/session/assignment_source.h"
15 #include "blimp/common/proto/blimp_message.pb.h" 16 #include "blimp/common/proto/blimp_message.pb.h"
16 #include "blimp/net/blimp_connection_statistics.h" 17 #include "blimp/net/blimp_connection_statistics.h"
17 #include "blimp/net/blimp_message_processor.h" 18 #include "blimp/net/blimp_message_processor.h"
18 19
19 namespace net { 20 namespace net {
20 class IPEndPoint; 21 class IPEndPoint;
21 } 22 }
22 23
23 namespace blimp { 24 namespace blimp {
24 25
25 class BlimpMessageProcessor; 26 class BlimpMessageProcessor;
26 class BlimpMessageThreadPipe; 27 class BlimpMessageThreadPipe;
28 class BlobChannelReceiver;
27 class BrowserConnectionHandler; 29 class BrowserConnectionHandler;
28 class ClientConnectionManager; 30 class ClientConnectionManager;
31 class HeliumBlobReceiverDelegate;
29 class ThreadPipeManager; 32 class ThreadPipeManager;
30 33
31 namespace client { 34 namespace client {
32 35
33 class ClientNetworkComponents; 36 class ClientNetworkComponents;
34 class NavigationFeature; 37 class NavigationFeature;
35 class ImeFeature; 38 class ImeFeature;
36 class RenderWidgetFeature; 39 class RenderWidgetFeature;
37 class SettingsFeature; 40 class SettingsFeature;
38 class TabControlFeature; 41 class TabControlFeature;
39 42
40 class NetworkEventObserver { 43 class NetworkEventObserver {
41 public: 44 public:
42 NetworkEventObserver() {} 45 NetworkEventObserver() {}
43 virtual ~NetworkEventObserver() {} 46 virtual ~NetworkEventObserver() {}
44 47
45 virtual void OnConnected() = 0; 48 virtual void OnConnected() = 0;
46 virtual void OnDisconnected(int result) = 0; 49 virtual void OnDisconnected(int result) = 0;
47 }; 50 };
48 51
49 // BlimpClientSession represents a single active session of Blimp on the client 52 // BlimpClientSession represents a single active session of Blimp on the client
50 // regardless of whether or not the client application is in the background or 53 // regardless of whether or not the client application is in the background or
51 // foreground. The only time this session is invalid is during initialization 54 // foreground. The only time this session is invalid is during initialization
52 // and shutdown of this particular client process (or Activity on Android). 55 // and shutdown of this particular client process (or Activity on Android).
53 // 56 //
54 // This session glues together the feature proxy components and the network 57 // This session glues together the feature proxy components and the network
55 // layer. The network components must be interacted with on the IO thread. The 58 // layer. The network components must be interacted with on the IO thread. The
56 // feature proxies must be interacted with on the UI thread. 59 // feature proxies must be interacted with on the UI thread.
57 class BlimpClientSession : public NetworkEventObserver { 60 class BlimpClientSession
61 : public NetworkEventObserver,
62 public BlobImageSerializationProcessor::ErrorDelegate {
58 public: 63 public:
59 explicit BlimpClientSession(const GURL& assigner_endpoint); 64 explicit BlimpClientSession(const GURL& assigner_endpoint);
60 65
61 // Uses the AssignmentSource to get an Assignment and then uses the assignment 66 // Uses the AssignmentSource to get an Assignment and then uses the assignment
62 // configuration to connect to the Blimplet. 67 // configuration to connect to the Blimplet.
63 // |client_auth_token| is the OAuth2 access token to use when querying 68 // |client_auth_token| is the OAuth2 access token to use when querying
64 // for an assignment. This token needs the OAuth2 scope of userinfo.email and 69 // for an assignment. This token needs the OAuth2 scope of userinfo.email and
65 // only needs to be an access token, not a refresh token. 70 // only needs to be an access token, not a refresh token.
66 void Connect(const std::string& client_auth_token); 71 void Connect(const std::string& client_auth_token);
67 72
(...skipping 18 matching lines...) Expand all
86 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result, 91 virtual void OnAssignmentConnectionAttempted(AssignmentSource::Result result,
87 const Assignment& assignment); 92 const Assignment& assignment);
88 93
89 private: 94 private:
90 void RegisterFeatures(); 95 void RegisterFeatures();
91 96
92 // NetworkEventObserver implementation. 97 // NetworkEventObserver implementation.
93 void OnConnected() override; 98 void OnConnected() override;
94 void OnDisconnected(int result) override; 99 void OnDisconnected(int result) override;
95 100
101 // BlobImageSerializationProcessor::ErrorDelegate implementation.
102 void OnImageDecodeError() override;
103
96 base::Thread io_thread_; 104 base::Thread io_thread_;
105
106 // Receives blob BlimpMessages and relays them to BlobChannelReceiver.
107 // Owned by BlobChannelReceiver, therefore stored as a raw pointer here.
108 HeliumBlobReceiverDelegate* blob_delegate_ = nullptr;
109
110 // Retrieves and decodes image data from |blob_receiver_|. Must outlive
111 // |blob_receiver_|.
112 BlobImageSerializationProcessor blob_image_processor_;
113
114 std::unique_ptr<BlobChannelReceiver> blob_receiver_;
97 std::unique_ptr<TabControlFeature> tab_control_feature_; 115 std::unique_ptr<TabControlFeature> tab_control_feature_;
98 std::unique_ptr<NavigationFeature> navigation_feature_; 116 std::unique_ptr<NavigationFeature> navigation_feature_;
99 std::unique_ptr<ImeFeature> ime_feature_; 117 std::unique_ptr<ImeFeature> ime_feature_;
100 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; 118 std::unique_ptr<RenderWidgetFeature> render_widget_feature_;
101 std::unique_ptr<SettingsFeature> settings_feature_; 119 std::unique_ptr<SettingsFeature> settings_feature_;
102 120
103 // The AssignmentSource is used when the user of BlimpClientSession calls 121 // The AssignmentSource is used when the user of BlimpClientSession calls
104 // Connect() to get a valid assignment and later connect to the engine. 122 // Connect() to get a valid assignment and later connect to the engine.
105 std::unique_ptr<AssignmentSource> assignment_source_; 123 std::unique_ptr<AssignmentSource> assignment_source_;
106 124
107 // Collects details of network, such as number of commits and bytes 125 // Collects details of network, such as number of commits and bytes
108 // transferred over network. Ownership is maintained on the IO thread. 126 // transferred over network. Ownership is maintained on the IO thread.
109 BlimpConnectionStatistics* blimp_connection_statistics_; 127 BlimpConnectionStatistics* blimp_connection_statistics_;
110 128
111 // Container struct for network components. 129 // Container struct for network components.
112 // Must be deleted on the IO thread. 130 // Must be deleted on the IO thread.
113 std::unique_ptr<ClientNetworkComponents> net_components_; 131 std::unique_ptr<ClientNetworkComponents> net_components_;
114 132
115 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 133 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
116 134
117 base::WeakPtrFactory<BlimpClientSession> weak_factory_; 135 base::WeakPtrFactory<BlimpClientSession> weak_factory_;
118 136
119 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession); 137 DISALLOW_COPY_AND_ASSIGN(BlimpClientSession);
120 }; 138 };
121 139
122 } // namespace client 140 } // namespace client
123 } // namespace blimp 141 } // namespace blimp
124 142
125 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_ 143 #endif // BLIMP_CLIENT_SESSION_BLIMP_CLIENT_SESSION_H_
OLDNEW
« no previous file with comments | « blimp/client/feature/compositor/decoding_image_generator.cc ('k') | blimp/client/session/blimp_client_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698