Chromium Code Reviews| Index: src/heap/heap.h |
| diff --git a/src/heap/heap.h b/src/heap/heap.h |
| index f5f66914fcf441c8eafd93c85b84ac0be249f118..50b2395f0d12b722da281e87f5bbc10d4e9a4e8f 100644 |
| --- a/src/heap/heap.h |
| +++ b/src/heap/heap.h |
| @@ -813,6 +813,7 @@ class Heap { |
| // TODO(hpayer): There is still a missmatch between capacity and actual |
| // committed memory size. |
| bool CanExpandOldGeneration(int size) { |
| + if (force_oom()) return false; |
| return (CommittedOldGenerationMemory() + size) < MaxOldGenerationSize(); |
| } |
| @@ -2113,6 +2114,9 @@ class Heap { |
| MUST_USE_RESULT AllocationResult InternalizeString(String* str); |
| + void set_force_oom(bool value) { force_oom_ = value; } |
| + bool force_oom() { return force_oom_; } |
|
Hannes Payer (out of office)
2015/12/10 18:32:06
you can remove the getter since it is just used in
Michael Lippautz
2015/12/10 18:34:55
Done.
|
| + |
| // The amount of external memory registered through the API kept alive |
| // by global handles |
| int64_t amount_of_external_allocated_memory_; |
| @@ -2363,6 +2367,9 @@ class Heap { |
| ArrayBufferTracker* array_buffer_tracker_; |
| + // Used for testing purposes. |
| + bool force_oom_; |
| + |
| // Classes in "heap" can be friends. |
| friend class AlwaysAllocateScope; |
| friend class GCCallbacksScope; |