| OLD | NEW |
| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 #if ENABLE(ASSERT) | 321 #if ENABLE(ASSERT) |
| 322 bool checkThread() const { return m_thread == currentThread(); } | 322 bool checkThread() const { return m_thread == currentThread(); } |
| 323 #endif | 323 #endif |
| 324 | 324 |
| 325 void performIdleGC(double deadlineSeconds); | 325 void performIdleGC(double deadlineSeconds); |
| 326 void performIdleLazySweep(double deadlineSeconds); | 326 void performIdleLazySweep(double deadlineSeconds); |
| 327 | 327 |
| 328 void scheduleIdleGC(); | 328 void scheduleIdleGC(); |
| 329 void scheduleIdleLazySweep(); | 329 void scheduleIdleLazySweep(); |
| 330 void schedulePreciseGC(); | 330 void schedulePreciseGC(); |
| 331 void scheduleV8FollowupGCIfNeeded(); |
| 331 void schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio); | 332 void schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio); |
| 332 void schedulePageNavigationGC(); | 333 void schedulePageNavigationGC(); |
| 333 void scheduleGCIfNeeded(); | 334 void scheduleGCIfNeeded(); |
| 334 void setGCState(GCState); | 335 void setGCState(GCState); |
| 335 GCState gcState() const; | 336 GCState gcState() const; |
| 336 bool isInGC() const { return gcState() == GCRunning; } | 337 bool isInGC() const { return gcState() == GCRunning; } |
| 337 bool isSweepingInProgress() const | 338 bool isSweepingInProgress() const |
| 338 { | 339 { |
| 339 return gcState() == Sweeping || gcState() == SweepingAndPreciseGCSchedul
ed || gcState() == SweepingAndIdleGCScheduled; | 340 return gcState() == Sweeping || gcState() == SweepingAndPreciseGCSchedul
ed || gcState() == SweepingAndIdleGCScheduled; |
| 340 } | 341 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC | 683 // shouldSchedule{Precise,Idle}GC and shouldForceConservativeGC |
| 683 // implement the heuristics that are used to determine when to collect garba
ge. | 684 // implement the heuristics that are used to determine when to collect garba
ge. |
| 684 // If shouldForceConservativeGC returns true, we force the garbage | 685 // If shouldForceConservativeGC returns true, we force the garbage |
| 685 // collection immediately. Otherwise, if should*GC returns true, we | 686 // collection immediately. Otherwise, if should*GC returns true, we |
| 686 // record that we should garbage collect the next time we return | 687 // record that we should garbage collect the next time we return |
| 687 // to the event loop. If both return false, we don't need to | 688 // to the event loop. If both return false, we don't need to |
| 688 // collect garbage at this point. | 689 // collect garbage at this point. |
| 689 bool shouldScheduleIdleGC(); | 690 bool shouldScheduleIdleGC(); |
| 690 bool shouldSchedulePreciseGC(); | 691 bool shouldSchedulePreciseGC(); |
| 691 bool shouldForceConservativeGC(); | 692 bool shouldForceConservativeGC(); |
| 693 // V8 minor or major GC is likely to drop a lot of references to objects |
| 694 // on Oilpan's heap. We give a chance to schedule a GC. |
| 695 bool shouldScheduleV8FollowupGC(); |
| 696 // Page navigation is likely to drop a lot of references to objects |
| 697 // on Oilpan's heap. We give a chance to schedule a GC. |
| 692 // estimatedRemovalRatio is the estimated ratio of objects that will be no | 698 // estimatedRemovalRatio is the estimated ratio of objects that will be no |
| 693 // longer necessary due to the navigation. | 699 // longer necessary due to the navigation. |
| 694 bool shouldSchedulePageNavigationGC(float estimatedRemovalRatio); | 700 bool shouldSchedulePageNavigationGC(float estimatedRemovalRatio); |
| 695 | 701 |
| 696 // Internal helper for GC policy handling code. Returns true if | 702 // Internal helper for GC policy handling code. Returns true if |
| 697 // an urgent conservative GC is now needed due to memory pressure. | 703 // an urgent conservative GC is now needed due to memory pressure. |
| 698 bool shouldForceMemoryPressureGC(); | 704 bool shouldForceMemoryPressureGC(); |
| 699 size_t estimatedLiveObjectSize(); | 705 size_t estimatedLiveObjectSize(); |
| 700 size_t currentObjectSize(); | 706 size_t currentObjectSize(); |
| 701 double heapGrowingRate(); | 707 double heapGrowingRate(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 }; | 825 }; |
| 820 | 826 |
| 821 template<> class ThreadStateFor<AnyThread> { | 827 template<> class ThreadStateFor<AnyThread> { |
| 822 public: | 828 public: |
| 823 static ThreadState* state() { return ThreadState::current(); } | 829 static ThreadState* state() { return ThreadState::current(); } |
| 824 }; | 830 }; |
| 825 | 831 |
| 826 } // namespace blink | 832 } // namespace blink |
| 827 | 833 |
| 828 #endif // ThreadState_h | 834 #endif // ThreadState_h |
| OLD | NEW |