<commit_before>---
layout: article
title: Chrome Source Analyse - RefCount / SmartPtr
category: chrome
---
#RefCounted
A base class for reference counted classes.

{% highlight c++ %}
template <class T>
class RefCounted;

class MyFoo : public base::RefCounted<MyFoo>
{};
{% endhighlight %}


##RefCountedThreadSafe
A thread-safe variant of RefCounted\<T>
\&

{% highlight c++ %}
template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> >
class RefCountedThreadSafe;

class MyFoo : public base::RefCountedThreadSafe<MyFoo>
{};
{% endhighlight %}


<commit_msg>test <T><commit_after>---
layout: article
title: Chrome Source Analyse - RefCount / SmartPtr
category: chrome
---
#RefCounted
A base class for reference counted classes.

{% highlight c++ %}
template <class T>
class RefCounted;

class MyFoo : public base::RefCounted<MyFoo>
{};
{% endhighlight %}


##RefCountedThreadSafe
A thread-safe variant of RefCounted&lt;T>


{% highlight c++ %}
template <class T, typename Traits = DefaultRefCountedThreadSafeTraits<T> >
class RefCountedThreadSafe;

class MyFoo : public base::RefCountedThreadSafe<MyFoo>
{};
{% endhighlight %}



{'fraction_non_alphanumeric': 0.12205754141238012, 'fraction_numerical': 0.0, 'mean_word_length': 5.377777777777778, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2636149', 'n_tokens_mistral': 398, 'n_tokens_neox': 352, 'n_words': 105}