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

Side by Side Diff: mojo/embedder/simple_platform_shared_buffer_posix.cc

Issue 603983003: Mojo: COMPILE_ASSERT -> static_assert in mojo/system and mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | mojo/system/channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/embedder/simple_platform_shared_buffer.h" 5 #include "mojo/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>
11 #include <sys/types.h> // For |off_t|. 11 #include <sys/types.h> // For |off_t|.
12 #include <unistd.h> 12 #include <unistd.h>
13 13
14 #include <limits> 14 #include <limits>
15 15
16 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/files/scoped_file.h" 18 #include "base/files/scoped_file.h"
19 #include "base/logging.h" 19 #include "base/logging.h"
20 #include "base/macros.h" 20 #include "base/macros.h"
21 #include "base/posix/eintr_wrapper.h" 21 #include "base/posix/eintr_wrapper.h"
22 #include "base/sys_info.h" 22 #include "base/sys_info.h"
23 #include "base/threading/thread_restrictions.h" 23 #include "base/threading/thread_restrictions.h"
24 #include "mojo/embedder/platform_handle.h" 24 #include "mojo/embedder/platform_handle.h"
25 25
26 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a 26 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a
27 // |uint64_t|. 27 // |uint64_t|.
28 COMPILE_ASSERT(sizeof(size_t) <= sizeof(uint64_t), size_t_too_big); 28 static_assert(sizeof(size_t) <= sizeof(uint64_t), "size_t too big");
29 COMPILE_ASSERT(sizeof(off_t) <= sizeof(uint64_t), off_t_too_big); 29 static_assert(sizeof(off_t) <= sizeof(uint64_t), "off_t too big");
30 30
31 namespace mojo { 31 namespace mojo {
32 namespace embedder { 32 namespace embedder {
33 33
34 // SimplePlatformSharedBuffer -------------------------------------------------- 34 // SimplePlatformSharedBuffer --------------------------------------------------
35 35
36 bool SimplePlatformSharedBuffer::Init() { 36 bool SimplePlatformSharedBuffer::Init() {
37 DCHECK(!handle_.is_valid()); 37 DCHECK(!handle_.is_valid());
38 38
39 base::ThreadRestrictions::ScopedAllowIO allow_io; 39 base::ThreadRestrictions::ScopedAllowIO allow_io;
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 // SimplePlatformSharedBufferMapping ------------------------------------------- 149 // SimplePlatformSharedBufferMapping -------------------------------------------
150 150
151 void SimplePlatformSharedBufferMapping::Unmap() { 151 void SimplePlatformSharedBufferMapping::Unmap() {
152 int result = munmap(real_base_, real_length_); 152 int result = munmap(real_base_, real_length_);
153 PLOG_IF(ERROR, result != 0) << "munmap"; 153 PLOG_IF(ERROR, result != 0) << "munmap";
154 } 154 }
155 155
156 } // namespace embedder 156 } // namespace embedder
157 } // namespace mojo 157 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/system/channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698