| OLD | NEW |
| 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 #ifndef COURGETTE_MEMORY_ALLOCATOR_H_ | 5 #ifndef COURGETTE_MEMORY_ALLOCATOR_H_ |
| 6 #define COURGETTE_MEMORY_ALLOCATOR_H_ | 6 #define COURGETTE_MEMORY_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 T value_; | 48 T value_; |
| 49 mutable bool checked_; | 49 mutable bool checked_; |
| 50 }; | 50 }; |
| 51 typedef CheckReturnValue<bool> CheckBool; | 51 typedef CheckReturnValue<bool> CheckBool; |
| 52 #else | 52 #else |
| 53 typedef bool CheckBool; | 53 typedef bool CheckBool; |
| 54 #endif | 54 #endif |
| 55 | 55 |
| 56 namespace courgette { | 56 namespace courgette { |
| 57 | 57 |
| 58 #ifdef OS_WIN | 58 #if defined(OS_WIN) |
| 59 | 59 |
| 60 // Manages a temporary file. The file is created in the %TEMP% folder and | 60 // Manages a temporary file. The file is created in the %TEMP% folder and |
| 61 // is deleted when the file handle is closed. | 61 // is deleted when the file handle is closed. |
| 62 // NOTE: Since the file will be used as backing for a memory allocation, | 62 // NOTE: Since the file will be used as backing for a memory allocation, |
| 63 // it will never be so big that size_t cannot represent its size. | 63 // it will never be so big that size_t cannot represent its size. |
| 64 class TempFile { | 64 class TempFile { |
| 65 public: | 65 public: |
| 66 TempFile(); | 66 TempFile(); |
| 67 ~TempFile(); | 67 ~TempFile(); |
| 68 | 68 |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 protected: | 481 protected: |
| 482 T* buffer_; | 482 T* buffer_; |
| 483 size_t size_; // how much of the buffer we're using. | 483 size_t size_; // how much of the buffer we're using. |
| 484 size_t alloc_size_; // how much space we have allocated. | 484 size_t alloc_size_; // how much space we have allocated. |
| 485 Allocator alloc_; | 485 Allocator alloc_; |
| 486 }; | 486 }; |
| 487 | 487 |
| 488 } // namespace courgette | 488 } // namespace courgette |
| 489 | 489 |
| 490 #endif // COURGETTE_MEMORY_ALLOCATOR_H_ | 490 #endif // COURGETTE_MEMORY_ALLOCATOR_H_ |
| OLD | NEW |