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

Side by Side Diff: base/memory/shared_memory_win.cc

Issue 2013623003: Add more debugging to figure out why SharedMemory creation in the browser process might fail. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « no previous file | 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 Unmap(); 370 Unmap();
371 } 371 }
372 372
373 if (process == GetCurrentProcess() && close_self) { 373 if (process == GetCurrentProcess() && close_self) {
374 *new_handle = SharedMemoryHandle(mapped_file, base::GetCurrentProcId()); 374 *new_handle = SharedMemoryHandle(mapped_file, base::GetCurrentProcId());
375 return true; 375 return true;
376 } 376 }
377 377
378 if (!::DuplicateHandle(GetCurrentProcess(), mapped_file, process, &result, 378 if (!::DuplicateHandle(GetCurrentProcess(), mapped_file, process, &result,
379 access, FALSE, options)) { 379 access, FALSE, options)) {
380 // Debugging to help track down https://crbug.com/585013
381 DWORD last_error = ::GetLastError();
382 base::debug::Alias(&last_error);
383 base::debug::DumpWithoutCrashing();
380 return false; 384 return false;
381 } 385 }
382 *new_handle = SharedMemoryHandle(result, base::GetProcId(process)); 386 *new_handle = SharedMemoryHandle(result, base::GetProcId(process));
383 new_handle->SetOwnershipPassesToIPC(true); 387 new_handle->SetOwnershipPassesToIPC(true);
384 return true; 388 return true;
385 } 389 }
386 390
387 391
388 void SharedMemory::Close() { 392 void SharedMemory::Close() {
389 if (mapped_file_ != NULL) { 393 if (mapped_file_ != NULL) {
390 ::CloseHandle(mapped_file_); 394 ::CloseHandle(mapped_file_);
391 mapped_file_ = NULL; 395 mapped_file_ = NULL;
392 } 396 }
393 } 397 }
394 398
395 SharedMemoryHandle SharedMemory::handle() const { 399 SharedMemoryHandle SharedMemory::handle() const {
396 return SharedMemoryHandle(mapped_file_, base::GetCurrentProcId()); 400 return SharedMemoryHandle(mapped_file_, base::GetCurrentProcId());
397 } 401 }
398 402
399 } // namespace base 403 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698