From 3345a6884c488ff3a535c2c9acdd33d74b37e311 Mon Sep 17 00:00:00 2001 From: Iain Merrick Date: Tue, 19 Oct 2010 14:37:37 +0100 Subject: Merge Chromium at 7.0.540.0 : Initial merge by git Not including third_party/icu as it contains huge data files that break Gerrit, and aren't actually used. Change-Id: I428a386e70f3b58cacd28677b8cfda282e891e15 --- base/ref_counted_memory.h | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'base/ref_counted_memory.h') diff --git a/base/ref_counted_memory.h b/base/ref_counted_memory.h index eae7984..08400ec 100644 --- a/base/ref_counted_memory.h +++ b/base/ref_counted_memory.h @@ -1,9 +1,10 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef BASE_REF_COUNTED_MEMORY_H_ #define BASE_REF_COUNTED_MEMORY_H_ +#pragma once #include @@ -26,8 +27,8 @@ class RefCountedMemory : public base::RefCountedThreadSafe { protected: friend class base::RefCountedThreadSafe; - - virtual ~RefCountedMemory() {} + RefCountedMemory(); + virtual ~RefCountedMemory(); }; // An implementation of RefCountedMemory, where the ref counting does not @@ -39,8 +40,8 @@ class RefCountedStaticMemory : public RefCountedMemory { RefCountedStaticMemory(const unsigned char* data, size_t length) : data_(data), length_(length) {} - virtual const unsigned char* front() const { return data_; } - virtual size_t size() const { return length_; } + virtual const unsigned char* front() const; + virtual size_t size() const; private: const unsigned char* data_; @@ -56,27 +57,22 @@ class RefCountedBytes : public RefCountedMemory { // Constructs a RefCountedBytes object by performing a swap. (To non // destructively build a RefCountedBytes, use the constructor that takes a // vector.) - static RefCountedBytes* TakeVector(std::vector* to_destroy) { - RefCountedBytes* bytes = new RefCountedBytes; - bytes->data.swap(*to_destroy); - return bytes; - } + static RefCountedBytes* TakeVector(std::vector* to_destroy); - RefCountedBytes() {} + RefCountedBytes(); // Constructs a RefCountedBytes object by _copying_ from |initializer|. - RefCountedBytes(const std::vector& initializer) - : data(initializer) {} + RefCountedBytes(const std::vector& initializer); - virtual const unsigned char* front() const { - // STL will assert if we do front() on an empty vector, but calling code - // expects a NULL. - return size() ? &data.front() : NULL; - } - virtual size_t size() const { return data.size(); } + virtual const unsigned char* front() const; + virtual size_t size() const; std::vector data; + protected: + friend class base::RefCountedThreadSafe; + virtual ~RefCountedBytes(); + private: DISALLOW_COPY_AND_ASSIGN(RefCountedBytes); }; -- cgit v1.1