Sami Kalliomäki | 61db3fd | 2018-04-09 17:51:19 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license |
| 5 | * that can be found in the LICENSE file in the root of the source |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | package org.webrtc; |
| 12 | |
| 13 | /** |
| 14 | * Interface for ref counted objects in WebRTC. These objects have significant resources that need |
| 15 | * to be freed when they are no longer in use. Each objects starts with ref count of one when |
| 16 | * created. If a reference is passed as a parameter to a method, the caller has ownesrship of the |
| 17 | * object by default - calling release is not necessary unless retain is called. |
| 18 | */ |
| 19 | public interface RefCounted { |
| 20 | /** Increases ref count by one. */ |
| 21 | void retain(); |
| 22 | |
| 23 | /** |
| 24 | * Decreases ref count by one. When the ref count reaches zero, resources related to the object |
| 25 | * will be freed. |
| 26 | */ |
| 27 | void release(); |
| 28 | } |