Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | |
|
mflodman
2015/11/30 08:45:10
s/2004/2015
perkj_webrtc
2015/11/30 12:54:19
Done.
| |
| 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 #ifndef WEBRTC_BASE_RELEASE_WHEN_DONE_CALLBACK_H_ | |
| 12 #define WEBRTC_BASE_RELEASE_WHEN_DONE_CALLBACK_H_ | |
| 13 | |
| 14 #include "webrtc/base/bind.h" | |
| 15 #include "webrtc/base/callback.h" | |
| 16 #include "webrtc/base/scoped_ref_ptr.h" | |
| 17 | |
| 18 namespace rtc { | |
| 19 | |
| 20 namespace impl { | |
| 21 template <class T> | |
| 22 void ReleaseRef(const scoped_refptr<T>& object) {} | |
|
magjed_webrtc
2015/11/30 09:22:17
Should this be a static function?
perkj_webrtc
2015/11/30 12:54:19
Done.
| |
| 23 } // namespace impl | |
| 24 | |
| 25 // ReleaseWhenDoneCallback keeps a reference to |object| until the returned | |
| 26 // callback goes out of scope. If the returned callback is copied, the | |
| 27 // reference will be released when the last callback goes out of scope. | |
| 28 template <class ObjectT> | |
| 29 Callback0<void> ReleaseWhenDoneCallback(ObjectT* object) { | |
|
tommi
2015/11/30 08:45:51
What's the difference between this implementation
magjed_webrtc
2015/11/30 09:22:17
The argument type should be const scoped_refptr<Ob
magjed_webrtc
2015/11/30 09:22:17
ditto: Should this be a static function?
perkj_webrtc
2015/11/30 12:54:19
Renamed.
The difference would be that the callbac
perkj_webrtc
2015/11/30 12:54:19
Done.
| |
| 30 return rtc::Bind(&impl::ReleaseRef<ObjectT>, scoped_refptr<ObjectT>(object)); | |
| 31 } | |
| 32 | |
| 33 } // namespace rtc | |
| 34 | |
| 35 | |
| 36 #endif // WEBRTC_BASE_RELEASE_WHEN_DONE_CALLBACK_H_ | |
| OLD | NEW |