| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <aclapi.h> | 7 #include <aclapi.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 SharedMemory::SharedMemory(const std::wstring& name) | 38 SharedMemory::SharedMemory(const std::wstring& name) |
| 39 : mapped_file_(NULL), | 39 : mapped_file_(NULL), |
| 40 memory_(NULL), | 40 memory_(NULL), |
| 41 read_only_(false), | 41 read_only_(false), |
| 42 requested_size_(0), | 42 requested_size_(0), |
| 43 mapped_size_(0), | 43 mapped_size_(0), |
| 44 name_(name) { | 44 name_(name) { |
| 45 } | 45 } |
| 46 | 46 |
| 47 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only) | 47 SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only) |
| 48 : mapped_file_(handle), | 48 : mapped_file_(handle), |
| 49 memory_(NULL), | 49 memory_(NULL), |
| 50 read_only_(read_only), | 50 read_only_(read_only), |
| 51 requested_size_(0), | 51 requested_size_(0), |
| 52 mapped_size_(0) { | 52 mapped_size_(0) { |
| 53 } | 53 } |
| 54 | 54 |
| 55 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, | 55 SharedMemory::SharedMemory(SharedMemoryHandle handle, |
| 56 bool read_only, | 56 bool read_only, |
| 57 ProcessHandle process) | 57 ProcessHandle process) |
| 58 : mapped_file_(NULL), | 58 : mapped_file_(NULL), |
| 59 memory_(NULL), | 59 memory_(NULL), |
| 60 read_only_(read_only), | 60 read_only_(read_only), |
| 61 requested_size_(0), | 61 requested_size_(0), |
| 62 mapped_size_(0) { | 62 mapped_size_(0) { |
| 63 ::DuplicateHandle(process, handle, | 63 ::DuplicateHandle(process, handle, |
| 64 GetCurrentProcess(), &mapped_file_, | 64 GetCurrentProcess(), &mapped_file_, |
| 65 read_only_ ? FILE_MAP_READ : FILE_MAP_READ | | 65 read_only_ ? FILE_MAP_READ : FILE_MAP_READ | |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 CloseHandle(mapped_file_); | 263 CloseHandle(mapped_file_); |
| 264 mapped_file_ = NULL; | 264 mapped_file_ = NULL; |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 SharedMemoryHandle SharedMemory::handle() const { | 268 SharedMemoryHandle SharedMemory::handle() const { |
| 269 return mapped_file_; | 269 return mapped_file_; |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace base | 272 } // namespace base |
| OLD | NEW |