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

Side by Side Diff: base/memory/shared_memory_nacl.cc

Issue 1197853004: Revert of Revert of Make SharedMemoryHandle a class on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_make_class3_base
Patch Set: Created 5 years, 6 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 | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_posix.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/memory/shared_memory.h" 5 #include "base/memory/shared_memory.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/mman.h> 9 #include <sys/mman.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
11 #include <unistd.h> 11 #include <unistd.h>
12 12
13 #include <limits> 13 #include <limits>
14 14
15 #include "base/logging.h" 15 #include "base/logging.h"
16 16
17 namespace base { 17 namespace base {
18 18
19 SharedMemory::SharedMemory() 19 SharedMemory::SharedMemory()
20 : mapped_file_(-1), 20 : mapped_file_(-1),
21 mapped_size_(0), 21 mapped_size_(0),
22 memory_(NULL), 22 memory_(NULL),
23 read_only_(false), 23 read_only_(false),
24 requested_size_(0) { 24 requested_size_(0) {
25 } 25 }
26 26
27 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only) 27 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only)
28 : mapped_file_(handle.fd), 28 : mapped_file_(handle.fd),
29 mapped_size_(0), 29 mapped_size_(0),
30 memory_(NULL), 30 memory_(NULL),
31 read_only_(read_only), 31 read_only_(read_only),
32 requested_size_(0) { 32 requested_size_(0) {
33 } 33 }
34 34
35 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only, 35 SharedMemory::SharedMemory(const SharedMemoryHandle& handle,
36 bool read_only,
36 ProcessHandle process) 37 ProcessHandle process)
37 : mapped_file_(handle.fd), 38 : mapped_file_(handle.fd),
38 mapped_size_(0), 39 mapped_size_(0),
39 memory_(NULL), 40 memory_(NULL),
40 read_only_(read_only), 41 read_only_(read_only),
41 requested_size_(0) { 42 requested_size_(0) {
42 NOTREACHED(); 43 NOTREACHED();
43 } 44 }
44 45
45 SharedMemory::~SharedMemory() { 46 SharedMemory::~SharedMemory() {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 new_handle->auto_close = true; 159 new_handle->auto_close = true;
159 160
160 if (close_self) { 161 if (close_self) {
161 Unmap(); 162 Unmap();
162 Close(); 163 Close();
163 } 164 }
164 return true; 165 return true;
165 } 166 }
166 167
167 } // namespace base 168 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698