| OLD | NEW |
| 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> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 29 #include "base/os_compat_android.h" | 29 #include "base/os_compat_android.h" |
| 30 #include "third_party/ashmem/ashmem.h" | 30 #include "third_party/ashmem/ashmem.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 namespace base { | 33 namespace base { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 // Paranoia. Semaphores and shared memory segments should live in different | |
| 38 // namespaces, but who knows what's out there. | |
| 39 const char kSemaphoreSuffix[] = "-sem"; | |
| 40 | |
| 41 LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER; | 37 LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER; |
| 42 | 38 |
| 43 } | 39 } |
| 44 | 40 |
| 45 SharedMemory::SharedMemory() | 41 SharedMemory::SharedMemory() |
| 46 : mapped_file_(-1), | 42 : mapped_file_(-1), |
| 47 inode_(0), | 43 inode_(0), |
| 48 mapped_size_(0), | 44 mapped_size_(0), |
| 49 memory_(NULL), | 45 memory_(NULL), |
| 50 read_only_(false), | 46 read_only_(false), |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 new_handle->fd = new_fd; | 410 new_handle->fd = new_fd; |
| 415 new_handle->auto_close = true; | 411 new_handle->auto_close = true; |
| 416 | 412 |
| 417 if (close_self) | 413 if (close_self) |
| 418 Close(); | 414 Close(); |
| 419 | 415 |
| 420 return true; | 416 return true; |
| 421 } | 417 } |
| 422 | 418 |
| 423 } // namespace base | 419 } // namespace base |
| OLD | NEW |