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

Unified Diff: third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc

Issue 1410053006: Move third_party/mojo/src/mojo/public to mojo/public (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 1 month 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
Index: third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
diff --git a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc b/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
deleted file mode 100644
index 44d0c867e0607961ae389ea373548a7c70c4fbab..0000000000000000000000000000000000000000
--- a/third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 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 "third_party/mojo/src/mojo/public/cpp/bindings/lib/fixed_buffer.h"
-
-#include <stdlib.h>
-
-#include <algorithm>
-
-#include "third_party/mojo/src/mojo/public/cpp/bindings/lib/bindings_serialization.h"
-#include "third_party/mojo/src/mojo/public/cpp/environment/logging.h"
-
-namespace mojo {
-namespace internal {
-
-FixedBuffer::FixedBuffer() : ptr_(nullptr), cursor_(0), size_(0) {}
-
-void FixedBuffer::Initialize(void* memory, size_t size) {
- MOJO_DCHECK(size == internal::Align(size));
-
- ptr_ = static_cast<char*>(memory);
- cursor_ = 0;
- size_ = size;
-}
-
-void* FixedBuffer::Allocate(size_t delta) {
- delta = internal::Align(delta);
-
- if (delta == 0 || delta > size_ - cursor_) {
- MOJO_DCHECK(false) << "Not reached";
- return nullptr;
- }
-
- char* result = ptr_ + cursor_;
- cursor_ += delta;
-
- return result;
-}
-
-FixedBufferForTesting::FixedBufferForTesting(size_t size) {
- size_ = internal::Align(size);
- // Use calloc here to ensure all message memory is zero'd out.
- ptr_ = static_cast<char*>(calloc(size_, 1));
-}
-
-FixedBufferForTesting::~FixedBufferForTesting() {
- free(ptr_);
-}
-
-void* FixedBufferForTesting::Leak() {
- char* ptr = ptr_;
- ptr_ = nullptr;
- cursor_ = 0;
- size_ = 0;
- return ptr;
-}
-
-} // namespace internal
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698