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

Side by Side Diff: mojo/edk/embedder/simple_platform_shared_buffer_android.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more cleanup Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "third_party/mojo/src/mojo/edk/embedder/simple_platform_shared_buffer.h " 5 #include "mojo/edk/embedder/simple_platform_shared_buffer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <sys/mman.h> // For |PROT_...|. 8 #include <sys/mman.h> // For |PROT_...|.
9 #include <sys/types.h> // For |off_t|. 9 #include <sys/types.h> // For |off_t|.
10 10
11 #include <limits> 11 #include <limits>
12 12
13 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "mojo/edk/embedder/platform_handle.h"
15 #include "third_party/ashmem/ashmem.h" 16 #include "third_party/ashmem/ashmem.h"
16 #include "third_party/mojo/src/mojo/edk/embedder/platform_handle.h"
17 17
18 namespace mojo { 18 namespace mojo {
19 namespace embedder { 19 namespace edk {
20 20
21 // SimplePlatformSharedBuffer -------------------------------------------------- 21 // SimplePlatformSharedBuffer --------------------------------------------------
22 22
23 bool SimplePlatformSharedBuffer::Init() { 23 bool SimplePlatformSharedBuffer::Init() {
24 DCHECK(!handle_.is_valid()); 24 DCHECK(!handle_.is_valid());
25 25
26 if (static_cast<uint64_t>(num_bytes_) > 26 if (static_cast<uint64_t>(num_bytes_) >
27 static_cast<uint64_t>(std::numeric_limits<off_t>::max())) { 27 static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
28 return false; 28 return false;
29 } 29 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 if (static_cast<size_t>(size) != num_bytes_) { 62 if (static_cast<size_t>(size) != num_bytes_) {
63 LOG(ERROR) << "Shared memory region has the wrong size"; 63 LOG(ERROR) << "Shared memory region has the wrong size";
64 return false; 64 return false;
65 } 65 }
66 66
67 handle_ = platform_handle.Pass(); 67 handle_ = platform_handle.Pass();
68 return true; 68 return true;
69 } 69 }
70 70
71 } // namespace embedder 71 } // namespace edk
72 } // namespace mojo 72 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698