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

Side by Side Diff: base/memory/shared_memory_win.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_posix.cc ('k') | no next file » | 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) 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 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return nullptr; 129 return nullptr;
130 } 130 }
131 131
132 return h2; 132 return h2;
133 } 133 }
134 134
135 } // namespace. 135 } // namespace.
136 136
137 namespace base { 137 namespace base {
138 138
139 SharedMemory::SharedMemory() 139 SharedMemory::SharedMemory() {}
140 : external_section_(false),
141 mapped_size_(0),
142 memory_(NULL),
143 read_only_(false),
144 requested_size_(0) {}
145 140
146 SharedMemory::SharedMemory(const std::wstring& name) 141 SharedMemory::SharedMemory(const string16& name) : name_(name) {}
147 : external_section_(false),
148 name_(name),
149 mapped_size_(0),
150 memory_(NULL),
151 read_only_(false),
152 requested_size_(0) {}
153 142
154 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only) 143 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only)
155 : external_section_(true), 144 : external_section_(true), shm_(handle), read_only_(read_only) {}
156 shm_(handle),
157 mapped_size_(0),
158 memory_(NULL),
159 read_only_(read_only),
160 requested_size_(0) {}
161 145
162 SharedMemory::~SharedMemory() { 146 SharedMemory::~SharedMemory() {
163 Unmap(); 147 Unmap();
164 Close(); 148 Close();
165 } 149 }
166 150
167 // static 151 // static
168 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { 152 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) {
169 return handle.IsValid(); 153 return handle.IsValid();
170 } 154 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 SharedMemoryHandle SharedMemory::TakeHandle() { 347 SharedMemoryHandle SharedMemory::TakeHandle() {
364 SharedMemoryHandle handle(shm_); 348 SharedMemoryHandle handle(shm_);
365 handle.SetOwnershipPassesToIPC(true); 349 handle.SetOwnershipPassesToIPC(true);
366 shm_ = SharedMemoryHandle(); 350 shm_ = SharedMemoryHandle();
367 memory_ = nullptr; 351 memory_ = nullptr;
368 mapped_size_ = 0; 352 mapped_size_ = 0;
369 return handle; 353 return handle;
370 } 354 }
371 355
372 } // namespace base 356 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698