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

Side by Side Diff: base/shared_memory_nacl.cc

Issue 12537014: Make SharedMemory track the size that was actually mapped (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « base/shared_memory_android.cc ('k') | base/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/shared_memory.h" 5 #include "base/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 inode_(0),
21 mapped_size_(0), 22 mapped_size_(0),
22 inode_(0),
23 memory_(NULL), 23 memory_(NULL),
24 read_only_(false), 24 read_only_(false),
25 created_size_(0) { 25 requested_size_(0) {
26 } 26 }
27 27
28 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only) 28 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only)
29 : mapped_file_(handle.fd), 29 : mapped_file_(handle.fd),
30 inode_(0),
30 mapped_size_(0), 31 mapped_size_(0),
31 inode_(0),
32 memory_(NULL), 32 memory_(NULL),
33 read_only_(read_only), 33 read_only_(read_only),
34 created_size_(0) { 34 requested_size_(0) {
35 } 35 }
36 36
37 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only, 37 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only,
38 ProcessHandle process) 38 ProcessHandle process)
39 : mapped_file_(handle.fd), 39 : mapped_file_(handle.fd),
40 inode_(0),
40 mapped_size_(0), 41 mapped_size_(0),
41 inode_(0),
42 memory_(NULL), 42 memory_(NULL),
43 read_only_(read_only), 43 read_only_(read_only),
44 created_size_(0) { 44 requested_size_(0) {
45 NOTREACHED(); 45 NOTREACHED();
46 } 46 }
47 47
48 SharedMemory::~SharedMemory() { 48 SharedMemory::~SharedMemory() {
49 Close(); 49 Close();
50 } 50 }
51 51
52 // static 52 // static
53 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { 53 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) {
54 return handle.fd >= 0; 54 return handle.fd >= 0;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 new_handle->fd = new_fd; 150 new_handle->fd = new_fd;
151 new_handle->auto_close = true; 151 new_handle->auto_close = true;
152 152
153 if (close_self) 153 if (close_self)
154 Close(); 154 Close();
155 return true; 155 return true;
156 } 156 }
157 157
158 } // namespace base 158 } // namespace base
OLDNEW
« no previous file with comments | « base/shared_memory_android.cc ('k') | base/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698