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

Side by Side Diff: third_party/WebKit/Source/platform/wtf/allocator/Partitions.cpp

Issue 2948983002: Low memory page navigation GC for low end devices (Closed)
Patch Set: fix Created 3 years, 6 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 PartitionDumpStatsGeneric(FastMallocPartition(), "fast_malloc", is_light_dump, 110 PartitionDumpStatsGeneric(FastMallocPartition(), "fast_malloc", is_light_dump,
111 partition_stats_dumper); 111 partition_stats_dumper);
112 PartitionDumpStatsGeneric(ArrayBufferPartition(), "array_buffer", 112 PartitionDumpStatsGeneric(ArrayBufferPartition(), "array_buffer",
113 is_light_dump, partition_stats_dumper); 113 is_light_dump, partition_stats_dumper);
114 PartitionDumpStatsGeneric(BufferPartition(), "buffer", is_light_dump, 114 PartitionDumpStatsGeneric(BufferPartition(), "buffer", is_light_dump,
115 partition_stats_dumper); 115 partition_stats_dumper);
116 PartitionDumpStats(LayoutPartition(), "layout", is_light_dump, 116 PartitionDumpStats(LayoutPartition(), "layout", is_light_dump,
117 partition_stats_dumper); 117 partition_stats_dumper);
118 } 118 }
119 119
120 namespace {
121
122 class LightPartitionStatsDumperImpl : public WTF::PartitionStatsDumper {
123 public:
124 LightPartitionStatsDumperImpl() : total_active_bytes_(0) {}
125
126 void PartitionDumpTotals(
127 const char* partition_name,
128 const WTF::PartitionMemoryStats* memory_stats) override {
129 total_active_bytes_ += memory_stats->total_active_bytes;
130 }
131
132 void PartitionsDumpBucketStats(
133 const char* partition_name,
134 const WTF::PartitionBucketMemoryStats*) override {}
135
136 size_t TotalActiveBytes() const { return total_active_bytes_; }
137
138 private:
139 size_t total_active_bytes_;
140 };
141
142 } // namespace
143
144 size_t Partitions::TotalActiveBytes() {
145 LightPartitionStatsDumperImpl dumper;
146 WTF::Partitions::DumpMemoryStats(true, &dumper);
147 return dumper.TotalActiveBytes();
148 }
149
120 static NEVER_INLINE void PartitionsOutOfMemoryUsing2G() { 150 static NEVER_INLINE void PartitionsOutOfMemoryUsing2G() {
121 size_t signature = 2UL * 1024 * 1024 * 1024; 151 size_t signature = 2UL * 1024 * 1024 * 1024;
122 base::debug::Alias(&signature); 152 base::debug::Alias(&signature);
123 OOM_CRASH(); 153 OOM_CRASH();
124 } 154 }
125 155
126 static NEVER_INLINE void PartitionsOutOfMemoryUsing1G() { 156 static NEVER_INLINE void PartitionsOutOfMemoryUsing1G() {
127 size_t signature = 1UL * 1024 * 1024 * 1024; 157 size_t signature = 1UL * 1024 * 1024 * 1024;
128 base::debug::Alias(&signature); 158 base::debug::Alias(&signature);
129 OOM_CRASH(); 159 OOM_CRASH();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (total_usage >= 64 * 1024 * 1024) 220 if (total_usage >= 64 * 1024 * 1024)
191 PartitionsOutOfMemoryUsing64M(); 221 PartitionsOutOfMemoryUsing64M();
192 if (total_usage >= 32 * 1024 * 1024) 222 if (total_usage >= 32 * 1024 * 1024)
193 PartitionsOutOfMemoryUsing32M(); 223 PartitionsOutOfMemoryUsing32M();
194 if (total_usage >= 16 * 1024 * 1024) 224 if (total_usage >= 16 * 1024 * 1024)
195 PartitionsOutOfMemoryUsing16M(); 225 PartitionsOutOfMemoryUsing16M();
196 PartitionsOutOfMemoryUsingLessThan16M(); 226 PartitionsOutOfMemoryUsingLessThan16M();
197 } 227 }
198 228
199 } // namespace WTF 229 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698