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

Side by Side Diff: components/view_manager/connection_manager.h

Issue 1281663002: Mandoline: Allow submitting CompositorFrames directly to mojo::Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ 5 #ifndef COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_
6 #define COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ 6 #define COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/timer/timer.h" 13 #include "base/timer/timer.h"
14 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h"
14 #include "components/view_manager/animation_runner.h" 16 #include "components/view_manager/animation_runner.h"
15 #include "components/view_manager/event_dispatcher.h" 17 #include "components/view_manager/event_dispatcher.h"
16 #include "components/view_manager/focus_controller_delegate.h" 18 #include "components/view_manager/focus_controller_delegate.h"
17 #include "components/view_manager/ids.h" 19 #include "components/view_manager/ids.h"
18 #include "components/view_manager/public/interfaces/view_manager.mojom.h" 20 #include "components/view_manager/public/interfaces/view_manager.mojom.h"
19 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h" 21 #include "components/view_manager/public/interfaces/view_manager_root.mojom.h"
20 #include "components/view_manager/server_view_delegate.h" 22 #include "components/view_manager/server_view_delegate.h"
21 #include "components/view_manager/server_view_observer.h" 23 #include "components/view_manager/server_view_observer.h"
24 #include "components/view_manager/surfaces/surfaces_state.h"
22 #include "components/view_manager/view_manager_root_impl.h" 25 #include "components/view_manager/view_manager_root_impl.h"
23 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" 26 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
24 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h" 27 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
25 28
26 namespace view_manager { 29 namespace view_manager {
27 30
28 class ClientConnection; 31 class ClientConnection;
29 class ConnectionManagerDelegate; 32 class ConnectionManagerDelegate;
30 class FocusController; 33 class FocusController;
31 class ServerView; 34 class ServerView;
32 class ViewManagerRootConnection; 35 class ViewManagerRootConnection;
33 class ViewManagerServiceImpl; 36 class ViewManagerServiceImpl;
34 37
35 // ConnectionManager manages the set of connections to the ViewManager (all the 38 // ConnectionManager manages the set of connections to the ViewManager (all the
36 // ViewManagerServiceImpls) as well as providing the root of the hierarchy. 39 // ViewManagerServiceImpls) as well as providing the root of the hierarchy.
37 class ConnectionManager : public ServerViewDelegate, 40 class ConnectionManager : public ServerViewDelegate,
38 public ServerViewObserver, 41 public ServerViewObserver,
39 public FocusControllerDelegate { 42 public FocusControllerDelegate,
43 public cc::SurfaceFactoryClient {
40 public: 44 public:
41 // Create when a ViewManagerServiceImpl is about to make a change. Ensures 45 // Create when a ViewManagerServiceImpl is about to make a change. Ensures
42 // clients are notified correctly. 46 // clients are notified correctly.
43 class ScopedChange { 47 class ScopedChange {
44 public: 48 public:
45 ScopedChange(ViewManagerServiceImpl* connection, 49 ScopedChange(ViewManagerServiceImpl* connection,
46 ConnectionManager* connection_manager, 50 ConnectionManager* connection_manager,
47 bool is_delete_view); 51 bool is_delete_view);
48 ~ScopedChange(); 52 ~ScopedChange();
49 53
(...skipping 14 matching lines...) Expand all
64 ConnectionManager* connection_manager_; 68 ConnectionManager* connection_manager_;
65 const mojo::ConnectionSpecificId connection_id_; 69 const mojo::ConnectionSpecificId connection_id_;
66 const bool is_delete_view_; 70 const bool is_delete_view_;
67 71
68 // See description of MarkConnectionAsMessaged/DidMessageConnection. 72 // See description of MarkConnectionAsMessaged/DidMessageConnection.
69 std::set<mojo::ConnectionSpecificId> message_ids_; 73 std::set<mojo::ConnectionSpecificId> message_ids_;
70 74
71 DISALLOW_COPY_AND_ASSIGN(ScopedChange); 75 DISALLOW_COPY_AND_ASSIGN(ScopedChange);
72 }; 76 };
73 77
74 explicit ConnectionManager(ConnectionManagerDelegate* delegate); 78 ConnectionManager(
79 ConnectionManagerDelegate* delegate,
80 const scoped_refptr<surfaces::SurfacesState>& surfaces_state);
75 ~ConnectionManager() override; 81 ~ConnectionManager() override;
76 82
77 // Adds a ViewManagerRoot. 83 // Adds a ViewManagerRoot.
78 void AddRoot(ViewManagerRootConnection* root_connection); 84 void AddRoot(ViewManagerRootConnection* root_connection);
79 85
80 // Creates a new ServerView. The return value is owned by the caller, but must 86 // Creates a new ServerView. The return value is owned by the caller, but must
81 // be destroyed before ConnectionManager. 87 // be destroyed before ConnectionManager.
82 ServerView* CreateServerView(const ViewId& id); 88 ServerView* CreateServerView(const ViewId& id);
83 89
84 // Returns the id for the next ViewManagerServiceImpl. 90 // Returns the id for the next ViewManagerServiceImpl.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const ServerView* new_parent, 192 const ServerView* new_parent,
187 const ServerView* old_parent); 193 const ServerView* old_parent);
188 void ProcessViewHierarchyChanged(const ServerView* view, 194 void ProcessViewHierarchyChanged(const ServerView* view,
189 const ServerView* new_parent, 195 const ServerView* new_parent,
190 const ServerView* old_parent); 196 const ServerView* old_parent);
191 void ProcessViewReorder(const ServerView* view, 197 void ProcessViewReorder(const ServerView* view,
192 const ServerView* relative_view, 198 const ServerView* relative_view,
193 const mojo::OrderDirection direction); 199 const mojo::OrderDirection direction);
194 void ProcessViewDeleted(const ViewId& view); 200 void ProcessViewDeleted(const ViewId& view);
195 201
202 // SurfaceFactoryClient implementation.
rjkroege 2015/08/13 18:04:01 is this right?
Fady Samuel 2015/08/17 21:11:11 In what sense? It is an interface off SurfaceFacto
203 void ReturnResources(const cc::ReturnedResourceArray& resources) override;
204
196 private: 205 private:
197 using ConnectionMap = std::map<mojo::ConnectionSpecificId, ClientConnection*>; 206 using ConnectionMap = std::map<mojo::ConnectionSpecificId, ClientConnection*>;
198 using RootConnectionMap = 207 using RootConnectionMap =
199 std::map<ViewManagerRootImpl*, ViewManagerRootConnection*>; 208 std::map<ViewManagerRootImpl*, ViewManagerRootConnection*>;
200 209
201 // Invoked when a connection is about to make a change. Subsequently followed 210 // Invoked when a connection is about to make a change. Subsequently followed
202 // by FinishChange() once the change is done. 211 // by FinishChange() once the change is done.
203 // 212 //
204 // Changes should never nest, meaning each PrepareForChange() must be 213 // Changes should never nest, meaning each PrepareForChange() must be
205 // balanced with a call to FinishChange() with no PrepareForChange() 214 // balanced with a call to FinishChange() with no PrepareForChange()
(...skipping 11 matching lines...) Expand all
217 // Callback from animation timer. 226 // Callback from animation timer.
218 // TODO(sky): make this real (move to a different class). 227 // TODO(sky): make this real (move to a different class).
219 void DoAnimation(); 228 void DoAnimation();
220 229
221 // Adds |connection| to internal maps. 230 // Adds |connection| to internal maps.
222 void AddConnection(ClientConnection* connection); 231 void AddConnection(ClientConnection* connection);
223 232
224 ViewManagerRootImpl* GetViewManagerRootByView(const ServerView* view) const; 233 ViewManagerRootImpl* GetViewManagerRootByView(const ServerView* view) const;
225 234
226 // Overridden from ServerViewDelegate: 235 // Overridden from ServerViewDelegate:
236 void SubmitFrame(ServerView* view,
237 mojo::CompositorFramePtr frame,
238 const mojo::Closure& callback) override;
227 void PrepareToDestroyView(ServerView* view) override; 239 void PrepareToDestroyView(ServerView* view) override;
228 void PrepareToChangeViewHierarchy(ServerView* view, 240 void PrepareToChangeViewHierarchy(ServerView* view,
229 ServerView* new_parent, 241 ServerView* new_parent,
230 ServerView* old_parent) override; 242 ServerView* old_parent) override;
231 void PrepareToChangeViewVisibility(ServerView* view) override; 243 void PrepareToChangeViewVisibility(ServerView* view) override;
232 void OnScheduleViewPaint(const ServerView* view) override; 244 void OnScheduleViewPaint(const ServerView* view) override;
233 const ServerView* GetRootView(const ServerView* view) const override; 245 const ServerView* GetRootView(const ServerView* view) const override;
234 246
235 // Overridden from ServerViewObserver: 247 // Overridden from ServerViewObserver:
236 void OnViewDestroyed(ServerView* view) override; 248 void OnViewDestroyed(ServerView* view) override;
(...skipping 18 matching lines...) Expand all
255 const ui::TextInputState& state) override; 267 const ui::TextInputState& state) override;
256 268
257 void CloneAndAnimate(mojo::Id transport_view_id); 269 void CloneAndAnimate(mojo::Id transport_view_id);
258 270
259 // FocusControllerDelegate: 271 // FocusControllerDelegate:
260 void OnFocusChanged(ServerView* old_focused_view, 272 void OnFocusChanged(ServerView* old_focused_view,
261 ServerView* new_focused_view) override; 273 ServerView* new_focused_view) override;
262 274
263 ConnectionManagerDelegate* delegate_; 275 ConnectionManagerDelegate* delegate_;
264 276
277 scoped_refptr<surfaces::SurfacesState> surfaces_state_;
278
279 cc::SurfaceFactory surface_factory_;
280
265 // ID to use for next ViewManagerServiceImpl. 281 // ID to use for next ViewManagerServiceImpl.
266 mojo::ConnectionSpecificId next_connection_id_; 282 mojo::ConnectionSpecificId next_connection_id_;
267 283
268 // ID to use for next ViewManagerRootImpl. 284 // ID to use for next ViewManagerRootImpl.
269 uint16_t next_root_id_; 285 uint16_t next_root_id_;
270 286
271 EventDispatcher event_dispatcher_; 287 EventDispatcher event_dispatcher_;
272 288
273 // Set of ViewManagerServiceImpls. 289 // Set of ViewManagerServiceImpls.
274 ConnectionMap connection_map_; 290 ConnectionMap connection_map_;
(...skipping 13 matching lines...) Expand all
288 AnimationRunner animation_runner_; 304 AnimationRunner animation_runner_;
289 305
290 scoped_ptr<FocusController> focus_controller_; 306 scoped_ptr<FocusController> focus_controller_;
291 307
292 DISALLOW_COPY_AND_ASSIGN(ConnectionManager); 308 DISALLOW_COPY_AND_ASSIGN(ConnectionManager);
293 }; 309 };
294 310
295 } // namespace view_manager 311 } // namespace view_manager
296 312
297 #endif // COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_ 313 #endif // COMPONENTS_VIEW_MANAGER_CONNECTION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698