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

Unified Diff: base/memory/discardable_memory_shmem.cc

Issue 1028333002: Chromium -> Mojo roll. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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/discardable_memory_shmem.h ('k') | base/memory/discardable_memory_shmem_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_shmem.cc
diff --git a/base/memory/discardable_memory_shmem.cc b/base/memory/discardable_memory_shmem.cc
deleted file mode 100644
index 059d84ca6111a86deef41162ee6129fe41f5a77a..0000000000000000000000000000000000000000
--- a/base/memory/discardable_memory_shmem.cc
+++ /dev/null
@@ -1,50 +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 "base/memory/discardable_memory_shmem.h"
-
-#include "base/lazy_instance.h"
-#include "base/memory/discardable_memory_shmem_allocator.h"
-
-namespace base {
-namespace internal {
-
-DiscardableMemoryShmem::DiscardableMemoryShmem(size_t bytes)
- : chunk_(DiscardableMemoryShmemAllocator::GetInstance()
- ->AllocateLockedDiscardableMemory(bytes)),
- is_locked_(true) {
- DCHECK(chunk_);
-}
-
-DiscardableMemoryShmem::~DiscardableMemoryShmem() {
- if (is_locked_)
- Unlock();
-}
-
-bool DiscardableMemoryShmem::Lock() {
- DCHECK(!is_locked_);
- DCHECK(chunk_);
-
- if (!chunk_->Lock()) {
- chunk_.reset();
- return false;
- }
-
- is_locked_ = true;
- return true;
-}
-
-void DiscardableMemoryShmem::Unlock() {
- DCHECK(is_locked_);
- chunk_->Unlock();
- is_locked_ = false;
-}
-
-void* DiscardableMemoryShmem::Memory() const {
- DCHECK(is_locked_);
- return chunk_->Memory();
-}
-
-} // namespace internal
-} // namespace base
« no previous file with comments | « base/memory/discardable_memory_shmem.h ('k') | base/memory/discardable_memory_shmem_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698