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

Side by Side Diff: mojo/embedder/simple_platform_shared_buffer_win.cc

Issue 612923002: Revert of Revert of Mojo: Convert scoped_ptr<...>() to nullptr in mojo/embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « mojo/embedder/simple_platform_shared_buffer_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/embedder/simple_platform_shared_buffer.h" 5 #include "mojo/embedder/simple_platform_shared_buffer.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DCHECK_LE(static_cast<uint64_t>(real_offset), 68 DCHECK_LE(static_cast<uint64_t>(real_offset),
69 static_cast<uint64_t>(std::numeric_limits<DWORD>::max())); 69 static_cast<uint64_t>(std::numeric_limits<DWORD>::max()));
70 70
71 void* real_base = MapViewOfFile(handle_.get().handle, 71 void* real_base = MapViewOfFile(handle_.get().handle,
72 FILE_MAP_READ | FILE_MAP_WRITE, 72 FILE_MAP_READ | FILE_MAP_WRITE,
73 0, 73 0,
74 static_cast<DWORD>(real_offset), 74 static_cast<DWORD>(real_offset),
75 real_length); 75 real_length);
76 if (!real_base) { 76 if (!real_base) {
77 PLOG(ERROR) << "MapViewOfFile"; 77 PLOG(ERROR) << "MapViewOfFile";
78 return scoped_ptr<PlatformSharedBufferMapping>(); 78 return nullptr;
79 } 79 }
80 80
81 void* base = static_cast<char*>(real_base) + offset_rounding; 81 void* base = static_cast<char*>(real_base) + offset_rounding;
82 return scoped_ptr<PlatformSharedBufferMapping>( 82 return scoped_ptr<PlatformSharedBufferMapping>(
83 new SimplePlatformSharedBufferMapping( 83 new SimplePlatformSharedBufferMapping(
84 base, length, real_base, real_length)); 84 base, length, real_base, real_length));
85 } 85 }
86 86
87 // SimplePlatformSharedBufferMapping ------------------------------------------- 87 // SimplePlatformSharedBufferMapping -------------------------------------------
88 88
89 void SimplePlatformSharedBufferMapping::Unmap() { 89 void SimplePlatformSharedBufferMapping::Unmap() {
90 BOOL result = UnmapViewOfFile(real_base_); 90 BOOL result = UnmapViewOfFile(real_base_);
91 PLOG_IF(ERROR, !result) << "UnmapViewOfFile"; 91 PLOG_IF(ERROR, !result) << "UnmapViewOfFile";
92 } 92 }
93 93
94 } // namespace embedder 94 } // namespace embedder
95 } // namespace mojo 95 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/embedder/simple_platform_shared_buffer_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698