OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkOSFile.h" | 8 #include "SkOSFile.h" |
9 | 9 |
10 #include "SkTFitsIn.h" | 10 #include "SkTFitsIn.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 && aID.fLsbSize == bID.fLsbSize | 59 && aID.fLsbSize == bID.fLsbSize |
60 && aID.fMsbSize == bID.fMsbSize | 60 && aID.fMsbSize == bID.fMsbSize |
61 && aID.fVolume == bID.fVolume; | 61 && aID.fVolume == bID.fVolume; |
62 } | 62 } |
63 | 63 |
64 class SkAutoNullKernelHandle : SkNoncopyable { | 64 class SkAutoNullKernelHandle : SkNoncopyable { |
65 public: | 65 public: |
66 SkAutoNullKernelHandle(const HANDLE handle) : fHandle(handle) { } | 66 SkAutoNullKernelHandle(const HANDLE handle) : fHandle(handle) { } |
67 ~SkAutoNullKernelHandle() { CloseHandle(fHandle); } | 67 ~SkAutoNullKernelHandle() { CloseHandle(fHandle); } |
68 operator HANDLE() const { return fHandle; } | 68 operator HANDLE() const { return fHandle; } |
69 bool isValid() const { return NULL != fHandle; } | 69 bool isValid() const { return SkToBool(fHandle); } |
70 private: | 70 private: |
71 HANDLE fHandle; | 71 HANDLE fHandle; |
72 }; | 72 }; |
73 typedef SkAutoNullKernelHandle SkAutoWinMMap; | 73 typedef SkAutoNullKernelHandle SkAutoWinMMap; |
74 | 74 |
75 void sk_fmunmap(const void* addr, size_t) { | 75 void sk_fmunmap(const void* addr, size_t) { |
76 UnmapViewOfFile(addr); | 76 UnmapViewOfFile(addr); |
77 } | 77 } |
78 | 78 |
79 void* sk_fdmmap(int fileno, size_t* length) { | 79 void* sk_fdmmap(int fileno, size_t* length) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 void* sk_fmmap(SkFILE* f, size_t* length) { | 115 void* sk_fmmap(SkFILE* f, size_t* length) { |
116 int fileno = sk_fileno(f); | 116 int fileno = sk_fileno(f); |
117 if (fileno < 0) { | 117 if (fileno < 0) { |
118 return NULL; | 118 return NULL; |
119 } | 119 } |
120 | 120 |
121 return sk_fdmmap(fileno, length); | 121 return sk_fdmmap(fileno, length); |
122 } | 122 } |
OLD | NEW |