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

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

Issue 2300493002: Move glue code of blob channel to blimp_client_context_impl. (Closed)
Patch Set: More polish on comments. Created 4 years, 3 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 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> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "blimp/client/core/compositor/blob_image_serialization_processor.h"
15 #include "blimp/client/core/session/client_network_components.h" 16 #include "blimp/client/core/session/client_network_components.h"
16 #include "blimp/client/core/session/identity_source.h" 17 #include "blimp/client/core/session/identity_source.h"
17 #include "blimp/client/core/session/network_event_observer.h" 18 #include "blimp/client/core/session/network_event_observer.h"
18 #include "blimp/client/public/blimp_client_context.h" 19 #include "blimp/client/public/blimp_client_context.h"
19 #include "blimp/client/public/contents/blimp_contents.h" 20 #include "blimp/client/public/contents/blimp_contents.h"
20 #include "blimp/client/public/session/assignment.h" 21 #include "blimp/client/public/session/assignment.h"
21 #include "blimp/net/thread_pipe_manager.h" 22 #include "blimp/net/thread_pipe_manager.h"
22 #include "url/gurl.h" 23 #include "url/gurl.h"
23 24
24 namespace blimp { 25 namespace blimp {
25 namespace client { 26 namespace client {
26 27
27 class BlimpCompositorDependencies; 28 class BlimpCompositorDependencies;
28 class BlimpContentsManager; 29 class BlimpContentsManager;
30 class BlobManager;
29 class CompositorDependencies; 31 class CompositorDependencies;
30 class ImeFeature; 32 class ImeFeature;
31 class NavigationFeature; 33 class NavigationFeature;
32 class RenderWidgetFeature; 34 class RenderWidgetFeature;
33 class SettingsFeature; 35 class SettingsFeature;
34 class TabControlFeature; 36 class TabControlFeature;
35 37
36 // BlimpClientContextImpl is the implementation of the main context-class for 38 // BlimpClientContextImpl is the implementation of the main context-class for
37 // the blimp client. 39 // the blimp client.
38 class BlimpClientContextImpl : public BlimpClientContext, 40 class BlimpClientContextImpl
39 public NetworkEventObserver { 41 : public BlimpClientContext,
42 public BlobImageSerializationProcessor::ErrorDelegate,
43 public NetworkEventObserver {
40 public: 44 public:
41 // The |io_thread_task_runner| must be the task runner to use for IO 45 // The |io_thread_task_runner| must be the task runner to use for IO
42 // operations. 46 // operations.
43 // The |file_thread_task_runner| must be the task runner to use for file 47 // The |file_thread_task_runner| must be the task runner to use for file
44 // operations. 48 // operations.
45 BlimpClientContextImpl( 49 BlimpClientContextImpl(
46 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, 50 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner,
47 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, 51 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner,
48 std::unique_ptr<CompositorDependencies> compositor_dependencies); 52 std::unique_ptr<CompositorDependencies> compositor_dependencies);
49 ~BlimpClientContextImpl() override; 53 ~BlimpClientContextImpl() override;
(...skipping 26 matching lines...) Expand all
76 virtual void ConnectWithAssignment(AssignmentRequestResult result, 80 virtual void ConnectWithAssignment(AssignmentRequestResult result,
77 const Assignment& assignment); 81 const Assignment& assignment);
78 82
79 void RegisterFeatures(); 83 void RegisterFeatures();
80 void InitializeSettings(); 84 void InitializeSettings();
81 85
82 // Create IdentitySource which provides user sign in states and OAuth2 token 86 // Create IdentitySource which provides user sign in states and OAuth2 token
83 // service. 87 // service.
84 void CreateIdentitySource(); 88 void CreateIdentitySource();
85 89
90 // BlobImageSerializationProcessor::ErrorDelegate implementation.
91 void OnImageDecodeError() override;
92
86 // Provides functionality from the embedder. 93 // Provides functionality from the embedder.
87 BlimpClientContextDelegate* delegate_ = nullptr; 94 BlimpClientContextDelegate* delegate_ = nullptr;
88 95
89 // The task runner to use for IO operations. 96 // The task runner to use for IO operations.
90 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; 97 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_;
91 98
92 // The task runner to use for file operations. 99 // The task runner to use for file operations.
93 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; 100 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_;
94 101
95 // The AssignmentSource is used when the user of BlimpClientContextImpl calls 102 // The AssignmentSource is used when the user of BlimpClientContextImpl calls
96 // Connect() to get a valid assignment and later connect to the engine. 103 // Connect() to get a valid assignment and later connect to the engine.
97 std::unique_ptr<AssignmentSource> assignment_source_; 104 std::unique_ptr<AssignmentSource> assignment_source_;
98 105
99 // A set of dependencies required by all BlimpCompositor instances. 106 // A set of dependencies required by all BlimpCompositor instances.
100 std::unique_ptr<BlimpCompositorDependencies> blimp_compositor_dependencies_; 107 std::unique_ptr<BlimpCompositorDependencies> blimp_compositor_dependencies_;
101 108
102 // Features to handle all incoming and outgoing protobuf messages. 109 // Features to handle all incoming and outgoing protobuf messages.
110 std::unique_ptr<BlobManager> blob_manager_;
103 std::unique_ptr<ImeFeature> ime_feature_; 111 std::unique_ptr<ImeFeature> ime_feature_;
104 std::unique_ptr<NavigationFeature> navigation_feature_; 112 std::unique_ptr<NavigationFeature> navigation_feature_;
105 std::unique_ptr<RenderWidgetFeature> render_widget_feature_; 113 std::unique_ptr<RenderWidgetFeature> render_widget_feature_;
106 std::unique_ptr<SettingsFeature> settings_feature_; 114 std::unique_ptr<SettingsFeature> settings_feature_;
107 std::unique_ptr<TabControlFeature> tab_control_feature_; 115 std::unique_ptr<TabControlFeature> tab_control_feature_;
108 116
109 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_; 117 std::unique_ptr<BlimpContentsManager> blimp_contents_manager_;
110 118
111 // Container struct for network components. 119 // Container struct for network components.
112 // Must be deleted on the IO thread. 120 // Must be deleted on the IO thread.
113 std::unique_ptr<ClientNetworkComponents> net_components_; 121 std::unique_ptr<ClientNetworkComponents> net_components_;
114 122
115 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_; 123 std::unique_ptr<ThreadPipeManager> thread_pipe_manager_;
116 124
117 // Provide OAuth2 token and propagate account sign in states change. 125 // Provide OAuth2 token and propagate account sign in states change.
118 std::unique_ptr<IdentitySource> identity_source_; 126 std::unique_ptr<IdentitySource> identity_source_;
119 127
120 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_; 128 base::WeakPtrFactory<BlimpClientContextImpl> weak_factory_;
121 129
122 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl); 130 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImpl);
123 }; 131 };
124 132
125 } // namespace client 133 } // namespace client
126 } // namespace blimp 134 } // namespace blimp
127 135
128 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_ 136 #endif // BLIMP_CLIENT_CORE_BLIMP_CLIENT_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698