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

Unified Diff: base/memory/shared_memory_win.cc

Issue 786123002: Update from https://crrev.com/307330 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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 | « base/ios/ios_util.mm ('k') | base/process/kill.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_win.cc
diff --git a/base/memory/shared_memory_win.cc b/base/memory/shared_memory_win.cc
index eef7f037752636505dc49ce57949391d085d79b3..5d2fa2af9fccf217d47122c40f3252f1024f8b6a 100644
--- a/base/memory/shared_memory_win.cc
+++ b/base/memory/shared_memory_win.cc
@@ -118,8 +118,8 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
return false;
size_t rounded_size = (options.size + kSectionMask) & ~kSectionMask;
- name_ = ASCIIToWide(options.name_deprecated == NULL ? "" :
- *options.name_deprecated);
+ name_ = options.name_deprecated ?
+ ASCIIToUTF16(*options.name_deprecated) : L"";
SECURITY_ATTRIBUTES sa = { sizeof(sa), NULL, FALSE };
SECURITY_DESCRIPTOR sd;
ACL dacl;
@@ -137,10 +137,10 @@ bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
// Windows ignores DACLs on certain unnamed objects (like shared sections).
// So, we generate a random name when we need to enforce read-only.
uint64_t rand_values[4];
- base::RandBytes(&rand_values, sizeof(rand_values));
- name_ = base::StringPrintf(L"CrSharedMem_%016x%016x%016x%016x",
- rand_values[0], rand_values[1],
- rand_values[2], rand_values[3]);
+ RandBytes(&rand_values, sizeof(rand_values));
+ name_ = StringPrintf(L"CrSharedMem_%016x%016x%016x%016x",
+ rand_values[0], rand_values[1],
+ rand_values[2], rand_values[3]);
}
mapped_file_ = CreateFileMapping(INVALID_HANDLE_VALUE, &sa,
PAGE_READWRITE, 0, static_cast<DWORD>(rounded_size), name_.c_str());
@@ -171,7 +171,7 @@ bool SharedMemory::Delete(const std::string& name) {
bool SharedMemory::Open(const std::string& name, bool read_only) {
DCHECK(!mapped_file_);
- name_ = ASCIIToWide(name);
+ name_ = ASCIIToUTF16(name);
read_only_ = read_only;
mapped_file_ = OpenFileMapping(
read_only_ ? FILE_MAP_READ : FILE_MAP_READ | FILE_MAP_WRITE,
@@ -218,7 +218,7 @@ bool SharedMemory::Unmap() {
}
bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
- SharedMemoryHandle *new_handle,
+ SharedMemoryHandle* new_handle,
bool close_self,
ShareMode share_mode) {
*new_handle = 0;
« no previous file with comments | « base/ios/ios_util.mm ('k') | base/process/kill.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698