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

Unified Diff: base/memory/ref_counted_memory.cc

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/ref_counted_memory.cc
diff --git a/base/memory/ref_counted_memory.cc b/base/memory/ref_counted_memory.cc
deleted file mode 100644
index 477c941355c23660b77961d1b775fa4f8e45aa8f..0000000000000000000000000000000000000000
--- a/base/memory/ref_counted_memory.cc
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (c) 2012 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.
-
-#include "base/memory/ref_counted_memory.h"
-
-#include <stdlib.h>
-
-#include "base/logging.h"
-
-namespace base {
-
-bool RefCountedMemory::Equals(
- const scoped_refptr<RefCountedMemory>& other) const {
- return other.get() &&
- size() == other->size() &&
- (memcmp(front(), other->front(), size()) == 0);
-}
-
-RefCountedMemory::RefCountedMemory() {}
-
-RefCountedMemory::~RefCountedMemory() {}
-
-const unsigned char* RefCountedStaticMemory::front() const {
- return data_;
-}
-
-size_t RefCountedStaticMemory::size() const {
- return length_;
-}
-
-RefCountedStaticMemory::~RefCountedStaticMemory() {}
-
-RefCountedBytes::RefCountedBytes() {}
-
-RefCountedBytes::RefCountedBytes(const std::vector<unsigned char>& initializer)
- : data_(initializer) {
-}
-
-RefCountedBytes::RefCountedBytes(const unsigned char* p, size_t size)
- : data_(p, p + size) {}
-
-RefCountedBytes* RefCountedBytes::TakeVector(
- std::vector<unsigned char>* to_destroy) {
- RefCountedBytes* bytes = new RefCountedBytes;
- bytes->data_.swap(*to_destroy);
- return bytes;
-}
-
-const unsigned char* RefCountedBytes::front() const {
- // STL will assert if we do front() on an empty vector, but calling code
- // expects a NULL.
- return size() ? &data_.front() : NULL;
-}
-
-size_t RefCountedBytes::size() const {
- return data_.size();
-}
-
-RefCountedBytes::~RefCountedBytes() {}
-
-RefCountedString::RefCountedString() {}
-
-RefCountedString::~RefCountedString() {}
-
-// static
-RefCountedString* RefCountedString::TakeString(std::string* to_destroy) {
- RefCountedString* self = new RefCountedString;
- to_destroy->swap(self->data_);
- return self;
-}
-
-const unsigned char* RefCountedString::front() const {
- return data_.empty() ? NULL :
- reinterpret_cast<const unsigned char*>(data_.data());
-}
-
-size_t RefCountedString::size() const {
- return data_.size();
-}
-
-RefCountedMallocedMemory::RefCountedMallocedMemory(
- void* data, size_t length)
- : data_(reinterpret_cast<unsigned char*>(data)), length_(length) {
- DCHECK(data || length == 0);
-}
-
-const unsigned char* RefCountedMallocedMemory::front() const {
- return length_ ? data_ : NULL;
-}
-
-size_t RefCountedMallocedMemory::size() const {
- return length_;
-}
-
-RefCountedMallocedMemory::~RefCountedMallocedMemory() {
- free(data_);
-}
-
-} // namespace base
« 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