| 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 } | |
| 449 } | 444 } |
| 450 | 445 |
| 451 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), | 446 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), |
| 452 "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", | 447 "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", |
| 453 InspectorUpdateCountersEvent::Data()); | 448 InspectorUpdateCountersEvent::Data()); |
| 454 } | 449 } |
| 455 | 450 |
| 456 void V8GCController::CollectGarbage(v8::Isolate* isolate, bool only_minor_gc) { | 451 void V8GCController::CollectGarbage(v8::Isolate* isolate, bool only_minor_gc) { |
| 457 v8::HandleScope handle_scope(isolate); | 452 v8::HandleScope handle_scope(isolate); |
| 458 RefPtr<ScriptState> script_state = ScriptState::Create( | 453 RefPtr<ScriptState> script_state = ScriptState::Create( |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 double start_time = WTF::CurrentTimeMS(); | 553 double start_time = WTF::CurrentTimeMS(); |
| 559 v8::HandleScope scope(isolate); | 554 v8::HandleScope scope(isolate); |
| 560 PendingActivityVisitor visitor(isolate, execution_context); | 555 PendingActivityVisitor visitor(isolate, execution_context); |
| 561 ToIsolate(execution_context)->VisitHandlesWithClassIds(&visitor); | 556 ToIsolate(execution_context)->VisitHandlesWithClassIds(&visitor); |
| 562 scan_pending_activity_histogram.Count( | 557 scan_pending_activity_histogram.Count( |
| 563 static_cast<int>(WTF::CurrentTimeMS() - start_time)); | 558 static_cast<int>(WTF::CurrentTimeMS() - start_time)); |
| 564 return visitor.PendingActivityFound(); | 559 return visitor.PendingActivityFound(); |
| 565 } | 560 } |
| 566 | 561 |
| 567 } // namespace blink | 562 } // namespace blink |
| OLD | NEW |