tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

scoped_glib.cc (1579B)


      1 /*
      2 *  Copyright 2022 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 #include "modules/portal/scoped_glib.h"
     12 
     13 #include <gio/gio.h>
     14 
     15 #include "rtc_base/system/rtc_export.h"
     16 #include "rtc_base/system/rtc_export_template.h"
     17 
     18 namespace webrtc {
     19 
     20 template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT) Scoped<GError>;
     21 template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT) Scoped<char>;
     22 template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT) Scoped<GVariant>;
     23 template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT) Scoped<GVariantIter>;
     24 template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT) Scoped<GDBusMessage>;
     25 template class RTC_EXPORT_TEMPLATE_DEFINE(RTC_EXPORT) Scoped<GUnixFDList>;
     26 
     27 template <>
     28 Scoped<GError>::~Scoped() {
     29  if (ptr_) {
     30    g_error_free(ptr_);
     31  }
     32 }
     33 
     34 template <>
     35 Scoped<char>::~Scoped() {
     36  if (ptr_) {
     37    g_free(ptr_);
     38  }
     39 }
     40 
     41 template <>
     42 Scoped<GVariant>::~Scoped() {
     43  if (ptr_) {
     44    g_variant_unref(ptr_);
     45  }
     46 }
     47 
     48 template <>
     49 Scoped<GVariantIter>::~Scoped() {
     50  if (ptr_) {
     51    g_variant_iter_free(ptr_);
     52  }
     53 }
     54 
     55 template <>
     56 Scoped<GDBusMessage>::~Scoped() {
     57  if (ptr_) {
     58    g_object_unref(ptr_);
     59  }
     60 }
     61 
     62 template <>
     63 Scoped<GUnixFDList>::~Scoped() {
     64  if (ptr_) {
     65    g_object_unref(ptr_);
     66  }
     67 }
     68 
     69 }  // namespace webrtc