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

Side by Side Diff: media/audio/win/audio_output_win_unittest.cc

Issue 2448533002: Fix 'ordered comparison between pointer and zero' errors (Closed)
Patch Set: Created 4 years, 1 month 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <windows.h> 5 #include <windows.h>
6 #include <mmsystem.h> 6 #include <mmsystem.h>
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 ::VirtualQuery(start_, &mbi, sizeof(mbi)); 131 ::VirtualQuery(start_, &mbi, sizeof(mbi));
132 size_ = mbi.RegionSize; 132 size_ = mbi.RegionSize;
133 } 133 }
134 ~ReadOnlyMappedFile() { 134 ~ReadOnlyMappedFile() {
135 if (start_) { 135 if (start_) {
136 ::UnmapViewOfFile(start_); 136 ::UnmapViewOfFile(start_);
137 ::CloseHandle(fmap_); 137 ::CloseHandle(fmap_);
138 } 138 }
139 } 139 }
140 // Returns true if the file was successfully mapped. 140 // Returns true if the file was successfully mapped.
141 bool is_valid() const { 141 bool is_valid() const { return (start_ && (size_ > 0)); }
142 return ((start_ > 0) && (size_ > 0));
143 }
144 // Returns the size in bytes of the mapped memory. 142 // Returns the size in bytes of the mapped memory.
145 uint32_t size() const { return size_; } 143 uint32_t size() const { return size_; }
146 // Returns the memory backing the file. 144 // Returns the memory backing the file.
147 const void* GetChunkAt(uint32_t offset) { return &start_[offset]; } 145 const void* GetChunkAt(uint32_t offset) { return &start_[offset]; }
148 146
149 private: 147 private:
150 HANDLE fmap_; 148 HANDLE fmap_;
151 char* start_; 149 char* start_;
152 uint32_t size_; 150 uint32_t size_;
153 }; 151 };
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 oas->Start(&source); 650 oas->Start(&source);
653 651
654 ::WaitForSingleObject(thread, INFINITE); 652 ::WaitForSingleObject(thread, INFINITE);
655 ::CloseHandle(thread); 653 ::CloseHandle(thread);
656 654
657 oas->Stop(); 655 oas->Stop();
658 oas->Close(); 656 oas->Close();
659 } 657 }
660 658
661 } // namespace media 659 } // namespace media
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