| 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> |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 #include <unistd.h> | 12 #include <unistd.h> |
| 13 | 13 |
| 14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
| 15 #include "base/files/scoped_file.h" |
| 15 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 16 #include "base/logging.h" | 17 #include "base/logging.h" |
| 17 #include "base/process/process_metrics.h" | 18 #include "base/process/process_metrics.h" |
| 18 #include "base/safe_strerror_posix.h" | 19 #include "base/safe_strerror_posix.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
| 21 #include "base/threading/platform_thread.h" | 22 #include "base/threading/platform_thread.h" |
| 22 #include "base/threading/thread_restrictions.h" | 23 #include "base/threading/thread_restrictions.h" |
| 23 | 24 |
| 24 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
| 25 #include "base/mac/foundation_util.h" | 26 #include "base/mac/foundation_util.h" |
| 26 #endif // OS_MACOSX | 27 #endif // OS_MACOSX |
| 27 | 28 |
| 28 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 29 #include "base/os_compat_android.h" | 30 #include "base/os_compat_android.h" |
| 30 #include "third_party/ashmem/ashmem.h" | 31 #include "third_party/ashmem/ashmem.h" |
| 31 #endif | 32 #endif |
| 32 | 33 |
| 33 using file_util::ScopedFILE; | |
| 34 | |
| 35 namespace base { | 34 namespace base { |
| 36 | 35 |
| 37 namespace { | 36 namespace { |
| 38 | 37 |
| 39 LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER; | 38 LazyInstance<Lock>::Leaky g_thread_lock_ = LAZY_INSTANCE_INITIALIZER; |
| 40 | 39 |
| 41 } | 40 } |
| 42 | 41 |
| 43 SharedMemory::SharedMemory() | 42 SharedMemory::SharedMemory() |
| 44 : mapped_file_(-1), | 43 : mapped_file_(-1), |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 new_handle->fd = new_fd; | 454 new_handle->fd = new_fd; |
| 456 new_handle->auto_close = true; | 455 new_handle->auto_close = true; |
| 457 | 456 |
| 458 if (close_self) | 457 if (close_self) |
| 459 Close(); | 458 Close(); |
| 460 | 459 |
| 461 return true; | 460 return true; |
| 462 } | 461 } |
| 463 | 462 |
| 464 } // namespace base | 463 } // namespace base |
| OLD | NEW |