Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(671)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8GCController.cpp

Issue 2238173002: Trigger Blink GC on v8::kGCCallbackFlagCollectAllExternalMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 // GCController.collectAll() forces multiple V8's GC. 369 // GCController.collectAll() forces multiple V8's GC.
370 ThreadHeap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GC WithSweep, BlinkGC::ForcedGC); 370 ThreadHeap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GC WithSweep, BlinkGC::ForcedGC);
371 371
372 // Forces a precise GC at the end of the current event loop. 372 // Forces a precise GC at the end of the current event loop.
373 RELEASE_ASSERT(!ThreadState::current()->isInGC()); 373 RELEASE_ASSERT(!ThreadState::current()->isInGC());
374 ThreadState::current()->setGCState(ThreadState::FullGCScheduled); 374 ThreadState::current()->setGCState(ThreadState::FullGCScheduled);
375 } 375 }
376 376
377 // v8::kGCCallbackFlagCollectAllAvailableGarbage is used when V8 handles 377 // v8::kGCCallbackFlagCollectAllAvailableGarbage is used when V8 handles
378 // low memory notifications. 378 // low memory notifications.
379 if (flags & v8::kGCCallbackFlagCollectAllAvailableGarbage) { 379 if (flags & v8::kGCCallbackFlagCollectAllAvailableGarbage
380 && flags & v8::kGCCallbackFlagCollectAllExternalMemory) {
haraken 2016/08/25 05:22:29 Add () to make the condition clearer. Shouldn't i
keishi 2016/08/25 05:25:05 oops. Done
380 // This single GC is not enough. See the above comment. 381 // This single GC is not enough. See the above comment.
381 ThreadHeap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GC WithSweep, BlinkGC::ForcedGC); 382 ThreadHeap::collectGarbage(BlinkGC::HeapPointersOnStack, BlinkGC::GC WithSweep, BlinkGC::ForcedGC);
382 383
383 // The conservative GC might have left floating garbage. Schedule 384 // The conservative GC might have left floating garbage. Schedule
384 // precise GC to ensure that we collect all available garbage. 385 // precise GC to ensure that we collect all available garbage.
385 if (ThreadState::current()) 386 if (ThreadState::current())
386 ThreadState::current()->schedulePreciseGC(); 387 ThreadState::current()->schedulePreciseGC();
387 } 388 }
388 } 389 }
389 390
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 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));
491 double startTime = WTF::currentTimeMS(); 492 double startTime = WTF::currentTimeMS();
492 v8::HandleScope scope(isolate); 493 v8::HandleScope scope(isolate);
493 PendingActivityVisitor visitor(isolate, executionContext); 494 PendingActivityVisitor visitor(isolate, executionContext);
494 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor); 495 toIsolate(executionContext)->VisitHandlesWithClassIds(&visitor);
495 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime)); 496 scanPendingActivityHistogram.count(static_cast<int>(WTF::currentTimeMS() - s tartTime));
496 return visitor.pendingActivityFound(); 497 return visitor.pendingActivityFound();
497 } 498 }
498 499
499 } // namespace blink 500 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698