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

Side by Side Diff: mojo/edk/embedder/simple_platform_shared_buffer_posix.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: move to mojo::edk namespace in preparation for runtim flag Created 5 years, 3 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 "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 <stdio.h> // For |fileno()|. 8 #include <stdio.h> // For |fileno()|.
9 #include <sys/mman.h> // For |mmap()|/|munmap()|. 9 #include <sys/mman.h> // For |mmap()|/|munmap()|.
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/sys_info.h" 21 #include "base/sys_info.h"
22 #include "base/threading/thread_restrictions.h" 22 #include "base/threading/thread_restrictions.h"
23 #include "mojo/edk/embedder/platform_handle.h" 23 #include "mojo/edk/embedder/platform_handle.h"
24 24
25 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a 25 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a
26 // |uint64_t|. 26 // |uint64_t|.
27 static_assert(sizeof(size_t) <= sizeof(uint64_t), "size_t too big"); 27 static_assert(sizeof(size_t) <= sizeof(uint64_t), "size_t too big");
28 static_assert(sizeof(off_t) <= sizeof(uint64_t), "off_t too big"); 28 static_assert(sizeof(off_t) <= sizeof(uint64_t), "off_t too big");
29 29
30 namespace mojo { 30 namespace mojo {
31 namespace embedder { 31 namespace edk {
32 32
33 // SimplePlatformSharedBuffer -------------------------------------------------- 33 // SimplePlatformSharedBuffer --------------------------------------------------
34 34
35 // The implementation for android uses ashmem to generate the file descriptor 35 // The implementation for android uses ashmem to generate the file descriptor
36 // for the shared memory. See simple_platform_shared_buffer_android.cc 36 // for the shared memory. See simple_platform_shared_buffer_android.cc
37 #if !defined(OS_ANDROID) 37 #if !defined(OS_ANDROID)
38 38
39 bool SimplePlatformSharedBuffer::Init() { 39 bool SimplePlatformSharedBuffer::Init() {
40 DCHECK(!handle_.is_valid()); 40 DCHECK(!handle_.is_valid());
41 41
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 base, length, real_base, real_length)); 147 base, length, real_base, real_length));
148 } 148 }
149 149
150 // SimplePlatformSharedBufferMapping ------------------------------------------- 150 // SimplePlatformSharedBufferMapping -------------------------------------------
151 151
152 void SimplePlatformSharedBufferMapping::Unmap() { 152 void SimplePlatformSharedBufferMapping::Unmap() {
153 int result = munmap(real_base_, real_length_); 153 int result = munmap(real_base_, real_length_);
154 PLOG_IF(ERROR, result != 0) << "munmap"; 154 PLOG_IF(ERROR, result != 0) << "munmap";
155 } 155 }
156 156
157 } // namespace embedder 157 } // namespace edk
158 } // namespace mojo 158 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698