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

Side by Side Diff: courgette/memory_allocator.h

Issue 1855133002: convert //courgette to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment in memory_allocator.h Created 4 years, 8 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 | « courgette/encoded_program_unittest.cc ('k') | courgette/patch_generator_x86_32.h » ('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) 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdlib.h> 10 #include <stdlib.h>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 // Complement of UncheckedNew(): destructs |object| and releases its memory. 71 // Complement of UncheckedNew(): destructs |object| and releases its memory.
72 template <class T> 72 template <class T>
73 void UncheckedDelete(T* object) { 73 void UncheckedDelete(T* object) {
74 if (object) { 74 if (object) {
75 object->T::~T(); 75 object->T::~T();
76 free(object); 76 free(object);
77 } 77 }
78 } 78 }
79 79
80 // A deleter for scoped_ptr that will delete the object via UncheckedDelete(). 80 // A deleter for std::unique_ptr that will delete the object via
81 // UncheckedDelete().
81 template <class T> 82 template <class T>
82 struct UncheckedDeleter { 83 struct UncheckedDeleter {
83 inline void operator()(T* ptr) const { UncheckedDelete(ptr); } 84 inline void operator()(T* ptr) const { UncheckedDelete(ptr); }
84 }; 85 };
85 86
86 #if defined(OS_WIN) 87 #if defined(OS_WIN)
87 88
88 // Manages a read/write virtual mapping of a physical file. 89 // Manages a read/write virtual mapping of a physical file.
89 class FileMapping { 90 class FileMapping {
90 public: 91 public:
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 protected: 497 protected:
497 T* buffer_; 498 T* buffer_;
498 size_t size_; // how much of the buffer we're using. 499 size_t size_; // how much of the buffer we're using.
499 size_t alloc_size_; // how much space we have allocated. 500 size_t alloc_size_; // how much space we have allocated.
500 Allocator alloc_; 501 Allocator alloc_;
501 }; 502 };
502 503
503 } // namespace courgette 504 } // namespace courgette
504 505
505 #endif // COURGETTE_MEMORY_ALLOCATOR_H_ 506 #endif // COURGETTE_MEMORY_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « courgette/encoded_program_unittest.cc ('k') | courgette/patch_generator_x86_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698