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

Side by Side Diff: components/mus/ids.h

Issue 1340983002: Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 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
« no previous file with comments | « components/mus/gles2/mojo_gpu_memory_buffer_manager.cc ('k') | components/mus/main.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 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_MUS_IDS_H_ 5 #ifndef COMPONENTS_MUS_IDS_H_
6 #define COMPONENTS_MUS_IDS_H_ 6 #define COMPONENTS_MUS_IDS_H_
7 7
8 #include "components/mus/public/cpp/types.h" 8 #include "components/mus/public/cpp/types.h"
9 #include "components/mus/public/cpp/util.h" 9 #include "components/mus/public/cpp/util.h"
10 10
11 namespace view_manager { 11 namespace mus {
12 12
13 // Connection id is used to indicate no connection. That is, no ViewTreeImpl 13 // Connection id is used to indicate no connection. That is, no ViewTreeImpl
14 // ever gets this id. 14 // ever gets this id.
15 const mojo::ConnectionSpecificId kInvalidConnectionId = 0; 15 const ConnectionSpecificId kInvalidConnectionId = 0;
16 16
17 // Adds a bit of type safety to view ids. 17 // Adds a bit of type safety to view ids.
18 struct ViewId { 18 struct ViewId {
19 ViewId(mojo::ConnectionSpecificId connection_id, 19 ViewId(ConnectionSpecificId connection_id, ConnectionSpecificId view_id)
20 mojo::ConnectionSpecificId view_id)
21 : connection_id(connection_id), view_id(view_id) {} 20 : connection_id(connection_id), view_id(view_id) {}
22 ViewId() : connection_id(0), view_id(0) {} 21 ViewId() : connection_id(0), view_id(0) {}
23 22
24 bool operator==(const ViewId& other) const { 23 bool operator==(const ViewId& other) const {
25 return other.connection_id == connection_id && other.view_id == view_id; 24 return other.connection_id == connection_id && other.view_id == view_id;
26 } 25 }
27 26
28 bool operator!=(const ViewId& other) const { return !(*this == other); } 27 bool operator!=(const ViewId& other) const { return !(*this == other); }
29 28
30 mojo::ConnectionSpecificId connection_id; 29 ConnectionSpecificId connection_id;
31 mojo::ConnectionSpecificId view_id; 30 ConnectionSpecificId view_id;
32 }; 31 };
33 32
34 inline ViewId ViewIdFromTransportId(mojo::Id id) { 33 inline ViewId ViewIdFromTransportId(Id id) {
35 return ViewId(mojo::HiWord(id), mojo::LoWord(id)); 34 return ViewId(HiWord(id), LoWord(id));
36 } 35 }
37 36
38 inline mojo::Id ViewIdToTransportId(const ViewId& id) { 37 inline Id ViewIdToTransportId(const ViewId& id) {
39 return (id.connection_id << 16) | id.view_id; 38 return (id.connection_id << 16) | id.view_id;
40 } 39 }
41 40
42 // Returns a ViewId that is reserved to indicate no view. That is, no view will 41 // Returns a ViewId that is reserved to indicate no view. That is, no view will
43 // ever be created with this id. 42 // ever be created with this id.
44 inline ViewId InvalidViewId() { 43 inline ViewId InvalidViewId() {
45 return ViewId(kInvalidConnectionId, 0); 44 return ViewId(kInvalidConnectionId, 0);
46 } 45 }
47 46
48 // Returns a root view id with a given index offset. 47 // Returns a root view id with a given index offset.
49 inline ViewId RootViewId(uint16_t index) { 48 inline ViewId RootViewId(uint16_t index) {
50 return ViewId(kInvalidConnectionId, 2 + index); 49 return ViewId(kInvalidConnectionId, 2 + index);
51 } 50 }
52 51
53 } // namespace view_manager 52 } // namespace mus
54 53
55 #endif // COMPONENTS_MUS_IDS_H_ 54 #endif // COMPONENTS_MUS_IDS_H_
OLDNEW
« no previous file with comments | « components/mus/gles2/mojo_gpu_memory_buffer_manager.cc ('k') | components/mus/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698