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

Side by Side Diff: blimp/client/core/blimp_client_context_impl.h

Issue 2190753002: Add network setup code to BlimpClientContextImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split-blimp-client-session
Patch Set: Created 4 years, 4 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
« no previous file with comments | « blimp/client/core/BUILD.gn ('k') | blimp/client/core/blimp_client_context_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 5 #ifndef BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
6 #define BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 6 #define BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
9 #include "base/supports_user_data.h" 12 #include "base/supports_user_data.h"
13 #include "base/threading/thread.h"
14 #include "blimp/client/core/session/client_network_components.h"
15 #include "blimp/client/core/session/network_event_observer.h"
10 #include "blimp/client/public/blimp_client_context.h" 16 #include "blimp/client/public/blimp_client_context.h"
11 #include "blimp/client/public/contents/blimp_contents.h" 17 #include "blimp/client/public/contents/blimp_contents.h"
18 #include "blimp/net/blimp_connection_statistics.h"
19 #include "blimp/net/thread_pipe_manager.h"
12 20
13 #if defined(OS_ANDROID) 21 #if defined(OS_ANDROID)
14 #include "base/android/jni_android.h" 22 #include "base/android/jni_android.h"
15 #endif // defined(OS_ANDROID) 23 #endif // defined(OS_ANDROID)
16 24
17 namespace blimp { 25 namespace blimp {
18 namespace client { 26 namespace client {
19 27
20 #if defined(OS_ANDROID) 28 #if defined(OS_ANDROID)
21 class BlimpClientContextImplAndroid; 29 class BlimpClientContextImplAndroid;
22 #endif // defined(OS_ANDROID) 30 #endif // defined(OS_ANDROID)
23 31
24 // BlimpClientContextImpl is the implementation of the main context-class for 32 // BlimpClientContextImpl is the implementation of the main context-class for
25 // the blimp client. 33 // the blimp client.
26 class BlimpClientContextImpl : public BlimpClientContext, 34 class BlimpClientContextImpl : public BlimpClientContext,
35 public NetworkEventObserver,
27 base::SupportsUserData { 36 base::SupportsUserData {
28 public: 37 public:
29 BlimpClientContextImpl(); 38 BlimpClientContextImpl();
30 ~BlimpClientContextImpl() override; 39 ~BlimpClientContextImpl() override;
31 40
32 #if defined(OS_ANDROID) 41 #if defined(OS_ANDROID)
33 BlimpClientContextImplAndroid* GetBlimpClientContextImplAndroid(); 42 BlimpClientContextImplAndroid* GetBlimpClientContextImplAndroid();
34 #endif // defined(OS_ANDROID) 43 #endif // defined(OS_ANDROID)
35 44
36 // BlimpClientContext implementation. 45 // BlimpClientContext implementation.
37 #if defined(OS_ANDROID) 46 #if defined(OS_ANDROID)
38 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override; 47 base::android::ScopedJavaLocalRef<jobject> GetJavaObject() override;
39 #endif // defined(OS_ANDROID) 48 #endif // defined(OS_ANDROID)
40 void SetDelegate(BlimpClientContextDelegate* delegate) override; 49 void SetDelegate(BlimpClientContextDelegate* delegate) override;
41 std::unique_ptr<BlimpContents> CreateBlimpContents() override; 50 std::unique_ptr<BlimpContents> CreateBlimpContents() override;
42 51
52 // NetworkEventObserver implementation.
53 void OnConnected() override;
54 void OnDisconnected(int result) override;
55
43 private: 56 private:
57 // Registers the Blimp features. Called during construction to set up
58 // pointers to the network code.
59 void RegisterFeatures();
60
44 BlimpClientContextDelegate* delegate_; 61 BlimpClientContextDelegate* delegate_;
45 62
63 base::Thread io_thread_;
nyquist 2016/07/27 22:48:46 Should the embedder provide a SequencedTaskRunner
Kevin M 2016/07/28 19:18:56 Or a SingleThreadTaskRunner?
nyquist 2016/07/28 22:08:31 Done.
64
65 // Collects details of network, such as number of commits and bytes
66 // transferred over network. Ownership is maintained on the IO thread.
67 BlimpConnectionStatistics* blimp_connection_statistics_;
68
69 // Container struct for network components.
70 // Must be deleted on the IO thread.
71 std::unique_ptr<ClientNetworkComponents> net_components_;
72
73 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
74
75 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_;
76
46 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); 77 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl);
47 }; 78 };
48 79
49 } // namespace client 80 } // namespace client
50 } // namespace blimp 81 } // namespace blimp
51 82
52 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 83 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « blimp/client/core/BUILD.gn ('k') | blimp/client/core/blimp_client_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698