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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 // The conservative GC might have left floating garbage. Schedule | 385 // The conservative GC might have left floating garbage. Schedule |
386 // precise GC to ensure that we collect all available garbage. | 386 // precise GC to ensure that we collect all available garbage. |
387 if (ThreadState::current()) | 387 if (ThreadState::current()) |
388 ThreadState::current()->schedulePreciseGC(); | 388 ThreadState::current()->schedulePreciseGC(); |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); | 392 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data( )); |
393 } | 393 } |
394 | 394 |
395 void V8GCController::collectGarbage(v8::Isolate* isolate) | 395 void V8GCController::collectGarbage(v8::Isolate* isolate, bool onlyMinorGc) |
haraken
2016/09/02 10:53:14
onlyMinorGC
Marcel Hlopko
2016/09/02 12:12:40
Done.
| |
396 { | 396 { |
397 v8::HandleScope handleScope(isolate); | 397 v8::HandleScope handleScope(isolate); |
398 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola te), DOMWrapperWorld::create(isolate)); | 398 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola te), DOMWrapperWorld::create(isolate)); |
399 ScriptState::Scope scope(scriptState.get()); | 399 ScriptState::Scope scope(scriptState.get()); |
400 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc(); "), isolate); | 400 String flag = onlyMinorGc ? "true" : "false"; |
401 V8ScriptRunner::compileAndRunInternalScript( | |
402 v8String(isolate, (String) ("if (gc) gc(" + flag + ")")), isolate); | |
haraken
2016/09/02 10:53:14
Use StringBuilder instead.
StringBuilder builder
Marcel Hlopko
2016/09/02 12:12:40
Done.
| |
401 scriptState->disposePerContextData(); | 403 scriptState->disposePerContextData(); |
402 } | 404 } |
403 | 405 |
404 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) | 406 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) |
405 { | 407 { |
406 for (unsigned i = 0; i < 5; i++) | 408 for (unsigned i = 0; i < 5; i++) |
407 isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCol lection); | 409 isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCol lection); |
408 } | 410 } |
409 | 411 |
410 class DOMWrapperTracer : public v8::PersistentHandleVisitor { | 412 class DOMWrapperTracer : public v8::PersistentHandleVisitor { |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5 0)); | 493 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5 0)); |
492 double startTime = WTF::currentTimeMS(); | 494 double startTime = WTF::currentTimeMS(); |
493 v8::HandleScope scope(isolate); | 495 v8::HandleScope scope(isolate); |
494 PendingActivityVisitor visitor(isolate, executionContext); | 496 PendingActivityVisitor visitor(isolate, executionContext); |
495 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); | 497 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); |
496 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime)); | 498 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime)); |
497 return visitor.pendingActivityFound(); | 499 return visitor.pendingActivityFound(); |
498 } | 500 } |
499 | 501 |
500 } // namespace blink | 502 } // namespace blink |
OLD | NEW |