Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: chrome/common/ref_counted_util.h

Issue 288005: First fix to minimize copying of image data. (Closed)
Patch Set: Modify gyp Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_REF_COUNTED_UTIL_H__ 5 #ifndef CHROME_COMMON_REF_COUNTED_UTIL_H__
6 #define CHROME_COMMON_REF_COUNTED_UTIL_H__ 6 #define CHROME_COMMON_REF_COUNTED_UTIL_H__
7 7
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include <vector> 9 #include <vector>
10 10
11 // RefCountedVector is just a vector wrapped up with 11 // RefCountedVector is just a vector wrapped up with
12 // RefCountedThreadSafe. 12 // RefCountedThreadSafe.
13 template<class T> 13 template<class T>
14 class RefCountedVector : 14 class RefCountedVector :
15 public base::RefCountedThreadSafe<RefCountedVector<T> > { 15 public base::RefCountedThreadSafe<RefCountedVector<T> > {
16 public: 16 public:
17 RefCountedVector() {} 17 RefCountedVector() {}
18 RefCountedVector(const std::vector<T>& initializer) 18 RefCountedVector(const std::vector<T>& initializer)
19 : data(initializer) {} 19 : data(initializer) {}
20 20
21 std::vector<T> data; 21 std::vector<T> data;
22 22
23 DISALLOW_COPY_AND_ASSIGN(RefCountedVector<T>); 23 DISALLOW_COPY_AND_ASSIGN(RefCountedVector<T>);
24 }; 24 };
25 25
26 // RefCountedThreadSafeBytes represent a ref-counted blob of bytes.
27 // Useful for passing data between threads without copying.
28 typedef RefCountedVector<unsigned char> RefCountedBytes;
29
30 #endif // CHROME_COMMON_REF_COUNTED_UTIL_H__ 26 #endif // CHROME_COMMON_REF_COUNTED_UTIL_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698