Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace base { | 9 namespace base { |
| 10 | 10 |
| 11 bool RefCountedMemory::Equals(const RefCountedMemory* other) const { | |
|
jar (doing other things)
2013/01/10 07:09:06
Why doesn't this take a const ref as an argument?
| |
| 12 return other && | |
| 13 size() == other->size() && | |
| 14 (memcmp(front(), other->front(), size()) == 0); | |
| 15 } | |
| 16 | |
| 11 RefCountedMemory::RefCountedMemory() {} | 17 RefCountedMemory::RefCountedMemory() {} |
| 12 | 18 |
| 13 RefCountedMemory::~RefCountedMemory() {} | 19 RefCountedMemory::~RefCountedMemory() {} |
| 14 | 20 |
| 15 const unsigned char* RefCountedStaticMemory::front() const { | 21 const unsigned char* RefCountedStaticMemory::front() const { |
| 16 return data_; | 22 return data_; |
| 17 } | 23 } |
| 18 | 24 |
| 19 size_t RefCountedStaticMemory::size() const { | 25 size_t RefCountedStaticMemory::size() const { |
| 20 return length_; | 26 return length_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 const unsigned char* RefCountedString::front() const { | 67 const unsigned char* RefCountedString::front() const { |
| 62 return data_.empty() ? NULL : | 68 return data_.empty() ? NULL : |
| 63 reinterpret_cast<const unsigned char*>(data_.data()); | 69 reinterpret_cast<const unsigned char*>(data_.data()); |
| 64 } | 70 } |
| 65 | 71 |
| 66 size_t RefCountedString::size() const { | 72 size_t RefCountedString::size() const { |
| 67 return data_.size(); | 73 return data_.size(); |
| 68 } | 74 } |
| 69 | 75 |
| 70 } // namespace base | 76 } // namespace base |
| OLD | NEW |