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

Side by Side Diff: base/memory/shared_memory.h

Issue 2102923002: Change MessagePumpForGpu and SharedMemory to ScopedHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed unit tests Created 4 years, 5 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
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 #ifndef BASE_MEMORY_SHARED_MEMORY_H_ 5 #ifndef BASE_MEMORY_SHARED_MEMORY_H_
6 #define BASE_MEMORY_SHARED_MEMORY_H_ 6 #define BASE_MEMORY_SHARED_MEMORY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/base_export.h" 12 #include "base/base_export.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/shared_memory_handle.h" 14 #include "base/memory/shared_memory_handle.h"
15 #include "base/process/process_handle.h" 15 #include "base/process/process_handle.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 17
18 #if defined(OS_POSIX) 18 #if defined(OS_POSIX)
19 #include <stdio.h> 19 #include <stdio.h>
20 #include <sys/types.h> 20 #include <sys/types.h>
21 #include <semaphore.h> 21 #include <semaphore.h>
22 #include "base/file_descriptor_posix.h" 22 #include "base/file_descriptor_posix.h"
23 #include "base/files/file_util.h" 23 #include "base/files/file_util.h"
24 #include "base/files/scoped_file.h" 24 #include "base/files/scoped_file.h"
25 #endif 25 #endif
26 26
27 #if defined(OS_WIN)
28 #include "base/win/scoped_handle.h"
29 #endif
30
27 namespace base { 31 namespace base {
28 32
29 class FilePath; 33 class FilePath;
30 34
31 // Options for creating a shared memory object. 35 // Options for creating a shared memory object.
32 struct BASE_EXPORT SharedMemoryCreateOptions { 36 struct BASE_EXPORT SharedMemoryCreateOptions {
33 SharedMemoryCreateOptions(); 37 SharedMemoryCreateOptions();
34 38
35 #if !(defined(OS_MACOSX) && !defined(OS_IOS)) 39 #if !(defined(OS_MACOSX) && !defined(OS_IOS))
36 // DEPRECATED (crbug.com/345734): 40 // DEPRECATED (crbug.com/345734):
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 bool ShareToProcessCommon(ProcessHandle process, 260 bool ShareToProcessCommon(ProcessHandle process,
257 SharedMemoryHandle* new_handle, 261 SharedMemoryHandle* new_handle,
258 bool close_self, 262 bool close_self,
259 ShareMode); 263 ShareMode);
260 264
261 #if defined(OS_WIN) 265 #if defined(OS_WIN)
262 // If true indicates this came from an external source so needs extra checks 266 // If true indicates this came from an external source so needs extra checks
263 // before being mapped. 267 // before being mapped.
264 bool external_section_; 268 bool external_section_;
265 std::wstring name_; 269 std::wstring name_;
266 HANDLE mapped_file_; 270 win::ScopedHandle mapped_file_;
Lei Zhang 2016/06/29 18:47:15 nit: extra space to keep the variable names lined
stanisc 2016/06/29 21:29:06 Done.
267 #elif defined(OS_MACOSX) && !defined(OS_IOS) 271 #elif defined(OS_MACOSX) && !defined(OS_IOS)
268 // The OS primitive that backs the shared memory region. 272 // The OS primitive that backs the shared memory region.
269 SharedMemoryHandle shm_; 273 SharedMemoryHandle shm_;
270 #elif defined(OS_POSIX) 274 #elif defined(OS_POSIX)
271 int mapped_file_; 275 int mapped_file_;
272 int readonly_mapped_file_; 276 int readonly_mapped_file_;
273 #endif 277 #endif
274 size_t mapped_size_; 278 size_t mapped_size_;
275 void* memory_; 279 void* memory_;
276 bool read_only_; 280 bool read_only_;
277 size_t requested_size_; 281 size_t requested_size_;
278 282
279 DISALLOW_COPY_AND_ASSIGN(SharedMemory); 283 DISALLOW_COPY_AND_ASSIGN(SharedMemory);
280 }; 284 };
281 } // namespace base 285 } // namespace base
282 286
283 #endif // BASE_MEMORY_SHARED_MEMORY_H_ 287 #endif // BASE_MEMORY_SHARED_MEMORY_H_
OLDNEW
« no previous file with comments | « no previous file | base/memory/shared_memory_unittest.cc » ('j') | base/memory/shared_memory_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698