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 3 // found in the LICENSE file. 4 5 #ifndef MOJO_EDK_SYSTEM_PORTS_PORT_REF_H_ 6 #define MOJO_EDK_SYSTEM_PORTS_PORT_REF_H_ 7 8 #include "base/memory/ref_counted.h" 9 #include "mojo/edk/system/ports/name.h" 10 11 namespace mojo { 12 namespace edk { 13 namespace ports { 14 15 class Port; 16 class Node; 17 18 class PortRef { 19 public: 20 ~PortRef(); 21 PortRef(); 22 PortRef(const PortName& name, scoped_refptr<Port> port); 23 24 PortRef(const PortRef& other); 25 PortRef& operator=(const PortRef& other); 26 name()27 const PortName& name() const { return name_; } 28 29 private: 30 friend class Node; port()31 Port* port() const { return port_.get(); } 32 33 PortName name_; 34 scoped_refptr<Port> port_; 35 }; 36 37 } // namespace ports 38 } // namespace edk 39 } // namespace mojo 40 41 #endif // MOJO_EDK_SYSTEM_PORTS_PORT_REF_H_ 42