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

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

Issue 2876593002: Change SharedMemory to initialize member vars in header. (Closed)
Patch Set: wstring -> string16 Created 3 years, 7 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_win.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 <stddef.h> 9 #include <stddef.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 15 matching lines...) Expand all
26 #include "base/unguessable_token.h" 26 #include "base/unguessable_token.h"
27 #include "build/build_config.h" 27 #include "build/build_config.h"
28 28
29 #if defined(OS_ANDROID) 29 #if defined(OS_ANDROID)
30 #include "base/os_compat_android.h" 30 #include "base/os_compat_android.h"
31 #include "third_party/ashmem/ashmem.h" 31 #include "third_party/ashmem/ashmem.h"
32 #endif 32 #endif
33 33
34 namespace base { 34 namespace base {
35 35
36 SharedMemory::SharedMemory() 36 SharedMemory::SharedMemory() {}
37 : mapped_size_(0), memory_(NULL), read_only_(false), requested_size_(0) {}
38 37
39 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only) 38 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only)
40 : shm_(handle), 39 : shm_(handle), read_only_(read_only) {}
41 mapped_size_(0),
42 memory_(NULL),
43 read_only_(read_only),
44 requested_size_(0) {}
45 40
46 SharedMemory::~SharedMemory() { 41 SharedMemory::~SharedMemory() {
47 Unmap(); 42 Unmap();
48 Close(); 43 Close();
49 } 44 }
50 45
51 // static 46 // static
52 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { 47 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) {
53 return handle.IsValid(); 48 return handle.IsValid();
54 } 49 }
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 struct stat file_stat; 380 struct stat file_stat;
386 if (HANDLE_EINTR( 381 if (HANDLE_EINTR(
387 ::fstat(static_cast<int>(handle().GetHandle()), &file_stat)) != 0) 382 ::fstat(static_cast<int>(handle().GetHandle()), &file_stat)) != 0)
388 return false; 383 return false;
389 id->first = file_stat.st_dev; 384 id->first = file_stat.st_dev;
390 id->second = file_stat.st_ino; 385 id->second = file_stat.st_ino;
391 return true; 386 return true;
392 } 387 }
393 388
394 } // namespace base 389 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698