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

Unified Diff: third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_android.cc

Issue 1676913002: [mojo] Delete third_party/mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: let's try that again Created 4 years, 10 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
Index: third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_android.cc
diff --git a/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_android.cc b/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_android.cc
deleted file mode 100644
index 8eb8fb1ce0c71bb43ec61b81f1502baf83cbc88b..0000000000000000000000000000000000000000
--- a/third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer_android.cc
+++ /dev/null
@@ -1,72 +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/edk/embedder/simple_platform_shared_buffer.h"
-
-#include <stdint.h>
-#include <sys/mman.h> // For |PROT_...|.
-#include <sys/types.h> // For |off_t|.
-#include <limits>
-#include <utility>
-
-#include "base/files/scoped_file.h"
-#include "base/logging.h"
-#include "third_party/ashmem/ashmem.h"
-#include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
-
-namespace mojo {
-namespace embedder {
-
-// SimplePlatformSharedBuffer --------------------------------------------------
-
-bool SimplePlatformSharedBuffer::Init() {
- DCHECK(!handle_.is_valid());
-
- if (static_cast<uint64_t>(num_bytes_) >
- static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
- return false;
- }
-
- base::ScopedFD fd(ashmem_create_region(nullptr, num_bytes_));
- if (!fd.is_valid()) {
- DPLOG(ERROR) << "ashmem_create_region()";
- return false;
- }
-
- if (ashmem_set_prot_region(fd.get(), PROT_READ | PROT_WRITE) < 0) {
- DPLOG(ERROR) << "ashmem_set_prot_region()";
- return false;
- }
-
- handle_.reset(PlatformHandle(fd.release()));
- return true;
-}
-
-bool SimplePlatformSharedBuffer::InitFromPlatformHandle(
- ScopedPlatformHandle platform_handle) {
- DCHECK(!handle_.is_valid());
-
- if (static_cast<uint64_t>(num_bytes_) >
- static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
- return false;
- }
-
- int size = ashmem_get_size_region(platform_handle.get().fd);
-
- if (size < 0) {
- DPLOG(ERROR) << "ashmem_get_size_region()";
- return false;
- }
-
- if (static_cast<size_t>(size) != num_bytes_) {
- LOG(ERROR) << "Shared memory region has the wrong size";
- return false;
- }
-
- handle_ = std::move(platform_handle);
- return true;
-}
-
-} // namespace embedder
-} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698