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

Unified Diff: base/memory/shared_memory.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory.h
diff --git a/base/memory/shared_memory.h b/base/memory/shared_memory.h
index 35067e6aaeab848080c681fa729f7853df720f3c..9d8fd5c3d9fa89030faa450434c9237b9bb2c997 100644
--- a/base/memory/shared_memory.h
+++ b/base/memory/shared_memory.h
@@ -14,6 +14,7 @@
#include "base/macros.h"
#include "base/memory/shared_memory_handle.h"
#include "base/process/process_handle.h"
+#include "base/strings/string16.h"
#include "build/build_config.h"
#if defined(OS_POSIX)
@@ -75,7 +76,7 @@ class BASE_EXPORT SharedMemory {
// Similar to the default constructor, except that this allows for
// calling LockDeprecated() to acquire the named mutex before either Create or
// Open are called on Windows.
- explicit SharedMemory(const std::wstring& name);
+ explicit SharedMemory(const string16& name);
#endif
// Create a new SharedMemory object from an existing, open
@@ -241,10 +242,9 @@ class BASE_EXPORT SharedMemory {
#if defined(OS_WIN)
// If true indicates this came from an external source so needs extra checks
// before being mapped.
- bool external_section_;
- std::wstring name_;
+ bool external_section_ = false;
+ string16 name_;
#else
-
// If valid, points to the same memory region as shm_, but with readonly
// permissions.
SharedMemoryHandle readonly_shm_;
@@ -253,16 +253,16 @@ class BASE_EXPORT SharedMemory {
#if defined(OS_MACOSX) && !defined(OS_IOS)
// The mechanism by which the memory is mapped. Only valid if |memory_| is not
// |nullptr|.
- SharedMemoryHandle::Type mapped_memory_mechanism_;
+ SharedMemoryHandle::Type mapped_memory_mechanism_ = SharedMemoryHandle::MACH;
#endif
// The OS primitive that backs the shared memory region.
SharedMemoryHandle shm_;
- size_t mapped_size_;
- void* memory_;
- bool read_only_;
- size_t requested_size_;
+ size_t mapped_size_ = 0;
+ void* memory_ = nullptr;
+ bool read_only_ = false;
+ size_t requested_size_ = 0;
DISALLOW_COPY_AND_ASSIGN(SharedMemory);
};
« no previous file with comments | « no previous file | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698