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

Side by Side Diff: base/memory/ref_counted_memory.cc

Issue 1550963002: Remove RefCountedMallocedMemory, it's not used. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « base/memory/ref_counted_memory.h ('k') | base/memory/ref_counted_memory_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "base/memory/ref_counted_memory.h" 5 #include "base/memory/ref_counted_memory.h"
6 6
7 #include <stdlib.h>
8
9 #include "base/logging.h" 7 #include "base/logging.h"
10 8
11 namespace base { 9 namespace base {
12 10
13 bool RefCountedMemory::Equals( 11 bool RefCountedMemory::Equals(
14 const scoped_refptr<RefCountedMemory>& other) const { 12 const scoped_refptr<RefCountedMemory>& other) const {
15 return other.get() && 13 return other.get() &&
16 size() == other->size() && 14 size() == other->size() &&
17 (memcmp(front(), other->front(), size()) == 0); 15 (memcmp(front(), other->front(), size()) == 0);
18 } 16 }
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 70
73 const unsigned char* RefCountedString::front() const { 71 const unsigned char* RefCountedString::front() const {
74 return data_.empty() ? NULL : 72 return data_.empty() ? NULL :
75 reinterpret_cast<const unsigned char*>(data_.data()); 73 reinterpret_cast<const unsigned char*>(data_.data());
76 } 74 }
77 75
78 size_t RefCountedString::size() const { 76 size_t RefCountedString::size() const {
79 return data_.size(); 77 return data_.size();
80 } 78 }
81 79
82 RefCountedMallocedMemory::RefCountedMallocedMemory(
83 void* data, size_t length)
84 : data_(reinterpret_cast<unsigned char*>(data)), length_(length) {
85 DCHECK(data || length == 0);
86 }
87
88 const unsigned char* RefCountedMallocedMemory::front() const {
89 return length_ ? data_ : NULL;
90 }
91
92 size_t RefCountedMallocedMemory::size() const {
93 return length_;
94 }
95
96 RefCountedMallocedMemory::~RefCountedMallocedMemory() {
97 free(data_);
98 }
99
100 } // namespace base 80 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/ref_counted_memory.h ('k') | base/memory/ref_counted_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698