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 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 | 384 |
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 currentThreadState->schedulePreciseGC(); | 387 currentThreadState->schedulePreciseGC(); |
388 } | 388 } |
389 } | 389 } |
390 | 390 |
391 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 391 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
392 } | 392 } |
393 | 393 |
394 void V8GCController::collectGarbage(v8::Isolate* isolate, bool onlyMinorGC) | 394 void V8GCController::collectGarbage(v8::Isolate* isolate) |
395 { | 395 { |
396 v8::HandleScope handleScope(isolate); | 396 v8::HandleScope handleScope(isolate); |
397 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola
te), DOMWrapperWorld::create(isolate)); | 397 RefPtr<ScriptState> scriptState = ScriptState::create(v8::Context::New(isola
te), DOMWrapperWorld::create(isolate)); |
398 ScriptState::Scope scope(scriptState.get()); | 398 ScriptState::Scope scope(scriptState.get()); |
399 StringBuilder builder; | 399 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, "if (gc) gc();
"), isolate); |
400 builder.append("if (gc) gc("); | |
401 builder.append(onlyMinorGC ? "true" : "false"); | |
402 builder.append(")"); | |
403 V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, builder.toStri
ng()), isolate); | |
404 scriptState->disposePerContextData(); | 400 scriptState->disposePerContextData(); |
405 } | 401 } |
406 | 402 |
407 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) | 403 void V8GCController::collectAllGarbageForTesting(v8::Isolate* isolate) |
408 { | 404 { |
409 for (unsigned i = 0; i < 5; i++) | 405 for (unsigned i = 0; i < 5; i++) |
410 isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCol
lection); | 406 isolate->RequestGarbageCollectionForTesting(v8::Isolate::kFullGarbageCol
lection); |
411 } | 407 } |
412 | 408 |
413 class DOMWrapperTracer : public v8::PersistentHandleVisitor { | 409 class DOMWrapperTracer : public v8::PersistentHandleVisitor { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis
togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5
0)); | 491 DEFINE_THREAD_SAFE_STATIC_LOCAL(CustomCountHistogram, scanPendingActivityHis
togram, new CustomCountHistogram("Blink.ScanPendingActivityDuration", 1, 1000, 5
0)); |
496 double startTime = WTF::currentTimeMS(); | 492 double startTime = WTF::currentTimeMS(); |
497 v8::HandleScope scope(isolate); | 493 v8::HandleScope scope(isolate); |
498 PendingActivityVisitor visitor(isolate, executionContext); | 494 PendingActivityVisitor visitor(isolate, executionContext); |
499 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); | 495 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); |
500 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s
tartTime)); | 496 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s
tartTime)); |
501 return visitor.pendingActivityFound(); | 497 return visitor.pendingActivityFound(); |
502 } | 498 } |
503 | 499 |
504 } // namespace blink | 500 } // namespace blink |
OLD | NEW |