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

Side by Side Diff: courgette/third_party/bsdiff/paged_array.h

Issue 1961963003: Move //courgette/third_party to subfolder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: static is needed afterall Created 4 years, 7 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // PagedArray implements an array stored using many fixed-size pages. 5 // PagedArray implements an array stored using many fixed-size pages.
6 // 6 //
7 // PagedArray is a work-around to allow large arrays to be allocated when there 7 // PagedArray is a work-around to allow large arrays to be allocated when there
8 // is too much address space fragmentation for allocating the large arrays as 8 // is too much address space fragmentation for allocating the large arrays as
9 // contigous arrays. 9 // contiguous arrays.
10 10
11 #ifndef COURGETTE_BSDIFF_PAGED_ARRAY_H_ 11 #ifndef COURGETTE_BSDIFF_PAGED_ARRAY_H_
huangs 2016/05/13 03:56:47 Should these be modified? I don't know what the co
altimin 2016/05/13 13:16:57 Done.
12 #define COURGETTE_BSDIFF_PAGED_ARRAY_H_ 12 #define COURGETTE_BSDIFF_PAGED_ARRAY_H_
13 13
14 #include <stddef.h> 14 #include <stddef.h>
15 15
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/process/memory.h" 17 #include "base/process/memory.h"
18 18
19 namespace courgette { 19 namespace courgette {
20 20
21 // PagedArray implements an array stored using many fixed-size pages. 21 // PagedArray implements an array stored using many fixed-size pages.
22 template<typename T> 22 template <typename T>
23 class PagedArray { 23 class PagedArray {
24 enum { 24 enum {
25 // Page size in elements. Page size of 2^18 * sizeof(T) is 1MB for T = int. 25 // Page size in elements. Page size of 2^18 * sizeof(T) is 1MB for T = int.
26 kLogPageSize = 18, 26 kLogPageSize = 18,
27 kPageSize = 1 << kLogPageSize 27 kPageSize = 1 << kLogPageSize
28 }; 28 };
29 29
30 public: 30 public:
31 PagedArray() : pages_(NULL), page_count_(0) {} 31 PagedArray() : pages_(NULL), page_count_(0) {}
32 32
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 pages_ = NULL; 73 pages_ = NULL;
74 } 74 }
75 } 75 }
76 76
77 private: 77 private:
78 T** pages_; 78 T** pages_;
79 size_t page_count_; 79 size_t page_count_;
80 80
81 DISALLOW_COPY_AND_ASSIGN(PagedArray); 81 DISALLOW_COPY_AND_ASSIGN(PagedArray);
82 }; 82 };
83
83 } // namespace 84 } // namespace
huangs 2016/05/13 03:56:47 NIT: // namespace courgette
altimin 2016/05/13 13:16:57 Done.
84 #endif // COURGETTE_BSDIFF_PAGED_ARRAY_H_ 85 #endif // COURGETTE_BSDIFF_PAGED_ARRAY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698