OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 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 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 (flags & v8::kGCCallbackFlagCollectAllExternalMemory)) { | 434 (flags & v8::kGCCallbackFlagCollectAllExternalMemory)) { |
435 // This single GC is not enough. See the above comment. | 435 // This single GC is not enough. See the above comment. |
436 current_thread_state->CollectGarbage(BlinkGC::kHeapPointersOnStack, | 436 current_thread_state->CollectGarbage(BlinkGC::kHeapPointersOnStack, |
437 BlinkGC::kGCWithSweep, | 437 BlinkGC::kGCWithSweep, |
438 BlinkGC::kForcedGC); | 438 BlinkGC::kForcedGC); |
439 | 439 |
440 // The conservative GC might have left floating garbage. Schedule | 440 // The conservative GC might have left floating garbage. Schedule |
441 // precise GC to ensure that we collect all available garbage. | 441 // precise GC to ensure that we collect all available garbage. |
442 current_thread_state->SchedulePreciseGC(); | 442 current_thread_state->SchedulePreciseGC(); |
443 } | 443 } |
| 444 |
| 445 // Schedules a precise GC for the next idle time period. |
| 446 if (flags & v8::kGCCallbackScheduleIdleGarbageCollection) { |
| 447 current_thread_state->ScheduleIdleGC(); |
| 448 } |
444 } | 449 } |
445 | 450 |
446 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), | 451 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), |
447 "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", | 452 "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", |
448 InspectorUpdateCountersEvent::Data()); | 453 InspectorUpdateCountersEvent::Data()); |
449 } | 454 } |
450 | 455 |
451 void V8GCController::CollectGarbage(v8::Isolate* isolate, bool only_minor_gc) { | 456 void V8GCController::CollectGarbage(v8::Isolate* isolate, bool only_minor_gc) { |
452 v8::HandleScope handle_scope(isolate); | 457 v8::HandleScope handle_scope(isolate); |
453 RefPtr<ScriptState> script_state = ScriptState::Create( | 458 RefPtr<ScriptState> script_state = ScriptState::Create( |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 double start_time = WTF::CurrentTimeMS(); | 558 double start_time = WTF::CurrentTimeMS(); |
554 v8::HandleScope scope(isolate); | 559 v8::HandleScope scope(isolate); |
555 PendingActivityVisitor visitor(isolate, execution_context); | 560 PendingActivityVisitor visitor(isolate, execution_context); |
556 ToIsolate(execution_context)->VisitHandlesWithClassIds(&visitor); | 561 ToIsolate(execution_context)->VisitHandlesWithClassIds(&visitor); |
557 scan_pending_activity_histogram.Count( | 562 scan_pending_activity_histogram.Count( |
558 static_cast<int>(WTF::CurrentTimeMS() - start_time)); | 563 static_cast<int>(WTF::CurrentTimeMS() - start_time)); |
559 return visitor.PendingActivityFound(); | 564 return visitor.PendingActivityFound(); |
560 } | 565 } |
561 | 566 |
562 } // namespace blink | 567 } // namespace blink |
OLD | NEW |