15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_COMMON_REF_COUNTED_UTIL_H__
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_COMMON_REF_COUNTED_UTIL_H__
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/ref_counted.h"
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector>
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// RefCountedVector is just a vector wrapped up with
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// RefCountedThreadSafe.
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)template<class T>
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class RefCountedVector
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)    : public base::RefCountedThreadSafe<RefCountedVector<T> > {
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  RefCountedVector() {}
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  explicit RefCountedVector(const std::vector<T>& initializer)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      : data(initializer) {}
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  std::vector<T> data;
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(RefCountedVector<T>);
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CHROME_COMMON_REF_COUNTED_UTIL_H__
27