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

Side by Side Diff: mojo/services/view_manager/ids.h

Issue 424533002: Cleans up usage of ViewManagerServiceImpl::roots_ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delete Created 6 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 unified diff | Download patch | Annotate | Revision Log
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 MOJO_SERVICES_VIEW_MANAGER_IDS_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_IDS_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_IDS_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_IDS_H_
7 7
8 #include "mojo/services/public/cpp/view_manager/types.h" 8 #include "mojo/services/public/cpp/view_manager/types.h"
9 #include "mojo/services/public/cpp/view_manager/util.h" 9 #include "mojo/services/public/cpp/view_manager/util.h"
10 #include "mojo/services/view_manager/view_manager_export.h" 10 #include "mojo/services/view_manager/view_manager_export.h"
11 11
12 namespace mojo { 12 namespace mojo {
13 namespace service { 13 namespace service {
14 14
15 // Connection id reserved for the root. 15 // Connection id used to indicate no connection. That is, no
Ben Goodger (Google) 2014/07/26 16:49:10 Connection id is used to
sky 2014/07/26 20:46:23 Done.
16 const ConnectionSpecificId kRootConnection = 0; 16 // ViewManagerServiceImpl ever gets this id.
17 const ConnectionSpecificId kInvalidConnectionId = 0;
17 18
18 // TODO(sky): remove this, temporary while window manager API is in existing 19 // TODO(sky): remove this, temporary while window manager API is in existing
19 // api. 20 // api.
20 const ConnectionSpecificId kWindowManagerConnection = 1; 21 const ConnectionSpecificId kWindowManagerConnection = 1;
21 22
22 // Adds a bit of type safety to node ids. 23 // Adds a bit of type safety to node ids.
23 struct MOJO_VIEW_MANAGER_EXPORT NodeId { 24 struct MOJO_VIEW_MANAGER_EXPORT NodeId {
24 NodeId(ConnectionSpecificId connection_id, ConnectionSpecificId node_id) 25 NodeId(ConnectionSpecificId connection_id, ConnectionSpecificId node_id)
25 : connection_id(connection_id), 26 : connection_id(connection_id),
26 node_id(node_id) {} 27 node_id(node_id) {}
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 71
71 inline ViewId ViewIdFromTransportId(Id id) { 72 inline ViewId ViewIdFromTransportId(Id id) {
72 return ViewId(HiWord(id), LoWord(id)); 73 return ViewId(HiWord(id), LoWord(id));
73 } 74 }
74 75
75 inline Id ViewIdToTransportId(const ViewId& id) { 76 inline Id ViewIdToTransportId(const ViewId& id) {
76 return (id.connection_id << 16) | id.view_id; 77 return (id.connection_id << 16) | id.view_id;
77 } 78 }
78 79
79 inline NodeId RootNodeId() { 80 inline NodeId RootNodeId() {
80 return NodeId(kRootConnection, 1); 81 return NodeId(kInvalidConnectionId, 1);
81 } 82 }
82 83
83 // Returns a NodeId that is reserved to indicate no node. That is, no node will 84 // Returns a NodeId that is reserved to indicate no node. That is, no node will
84 // ever be created with this id. 85 // ever be created with this id.
85 inline NodeId InvalidNodeId() { 86 inline NodeId InvalidNodeId() {
86 return NodeId(kRootConnection, 0); 87 return NodeId(kInvalidConnectionId, 0);
87 } 88 }
88 89
89 } // namespace service 90 } // namespace service
90 } // namespace mojo 91 } // namespace mojo
91 92
92 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_ 93 #endif // MOJO_SERVICES_VIEW_MANAGER_IDS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698