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

Side by Side Diff: base/shared_memory_win.cc

Issue 48005: Port visitedlink tests to Linux. Also make them pass on Linux, which (Closed)
Patch Set: GetInvalidHandle -> NULLHandle Created 11 years, 9 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/shared_memory_posix.cc ('k') | chrome/browser/visitedlink_master.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/shared_memory.h" 5 #include "base/shared_memory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/win_util.h" 8 #include "base/win_util.h"
9 9
10 namespace base { 10 namespace base {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 Close(); 43 Close();
44 if (lock_ != NULL) 44 if (lock_ != NULL)
45 CloseHandle(lock_); 45 CloseHandle(lock_);
46 } 46 }
47 47
48 // static 48 // static
49 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { 49 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) {
50 return handle != NULL; 50 return handle != NULL;
51 } 51 }
52 52
53 // static
54 SharedMemoryHandle SharedMemory::NULLHandle() {
55 return NULL;
56 }
57
53 bool SharedMemory::Create(const std::wstring &name, bool read_only, 58 bool SharedMemory::Create(const std::wstring &name, bool read_only,
54 bool open_existing, size_t size) { 59 bool open_existing, size_t size) {
55 DCHECK(mapped_file_ == NULL); 60 DCHECK(mapped_file_ == NULL);
56 61
57 name_ = name; 62 name_ = name;
58 read_only_ = read_only; 63 read_only_ = read_only;
59 mapped_file_ = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, 64 mapped_file_ = CreateFileMapping(INVALID_HANDLE_VALUE, NULL,
60 read_only_ ? PAGE_READONLY : PAGE_READWRITE, 0, static_cast<DWORD>(size), 65 read_only_ ? PAGE_READONLY : PAGE_READWRITE, 0, static_cast<DWORD>(size),
61 name.empty() ? NULL : name.c_str()); 66 name.empty() ? NULL : name.c_str());
62 if (!mapped_file_) 67 if (!mapped_file_)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 void SharedMemory::Unlock() { 176 void SharedMemory::Unlock() {
172 DCHECK(lock_ != NULL); 177 DCHECK(lock_ != NULL);
173 ReleaseMutex(lock_); 178 ReleaseMutex(lock_);
174 } 179 }
175 180
176 SharedMemoryHandle SharedMemory::handle() const { 181 SharedMemoryHandle SharedMemory::handle() const {
177 return mapped_file_; 182 return mapped_file_;
178 } 183 }
179 184
180 } // namespace base 185 } // namespace base
OLDNEW
« no previous file with comments | « base/shared_memory_posix.cc ('k') | chrome/browser/visitedlink_master.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698