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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapPage.cpp

Issue 1411843008: Make blink platform time consistent with the timer virtual time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CachingCorrectnessTest Created 5 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // m_firstPages. 322 // m_firstPages.
323 page->sweep(); 323 page->sweep();
324 page->unlink(&m_firstUnsweptPage); 324 page->unlink(&m_firstUnsweptPage);
325 page->link(&m_firstPage); 325 page->link(&m_firstPage);
326 page->markAsSwept(); 326 page->markAsSwept();
327 } 327 }
328 } 328 }
329 329
330 bool BaseHeap::lazySweepWithDeadline(double deadlineSeconds) 330 bool BaseHeap::lazySweepWithDeadline(double deadlineSeconds)
331 { 331 {
332 // It might be heavy to call Platform::current()->monotonicallyIncreasingTim e() 332 // It might be heavy to call Platform::current()->monotonicallyIncreasingTim eSeconds()
333 // per page (i.e., 128 KB sweep or one LargeObject sweep), so we check 333 // per page (i.e., 128 KB sweep or one LargeObject sweep), so we check
334 // the deadline per 10 pages. 334 // the deadline per 10 pages.
335 static const int deadlineCheckInterval = 10; 335 static const int deadlineCheckInterval = 10;
336 336
337 RELEASE_ASSERT(threadState()->isSweepingInProgress()); 337 RELEASE_ASSERT(threadState()->isSweepingInProgress());
338 ASSERT(threadState()->sweepForbidden()); 338 ASSERT(threadState()->sweepForbidden());
339 ASSERT(!threadState()->isMainThread() || ScriptForbiddenScope::isScriptForbi dden()); 339 ASSERT(!threadState()->isMainThread() || ScriptForbiddenScope::isScriptForbi dden());
340 340
341 int pageCount = 1; 341 int pageCount = 1;
342 while (m_firstUnsweptPage) { 342 while (m_firstUnsweptPage) {
343 sweepUnsweptPage(); 343 sweepUnsweptPage();
344 if (pageCount % deadlineCheckInterval == 0) { 344 if (pageCount % deadlineCheckInterval == 0) {
345 if (deadlineSeconds <= Platform::current()->monotonicallyIncreasingT ime()) { 345 if (deadlineSeconds <= Platform::current()->monotonicallyIncreasingT imeSeconds()) {
346 // Deadline has come. 346 // Deadline has come.
347 Heap::reportMemoryUsageForTracing(); 347 Heap::reportMemoryUsageForTracing();
348 return !m_firstUnsweptPage; 348 return !m_firstUnsweptPage;
349 } 349 }
350 } 350 }
351 pageCount++; 351 pageCount++;
352 } 352 }
353 Heap::reportMemoryUsageForTracing(); 353 Heap::reportMemoryUsageForTracing();
354 return true; 354 return true;
355 } 355 }
(...skipping 1228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 1584
1585 m_hasEntries = true; 1585 m_hasEntries = true;
1586 size_t index = hash(address); 1586 size_t index = hash(address);
1587 ASSERT(!(index & 1)); 1587 ASSERT(!(index & 1));
1588 Address cachePage = roundToBlinkPageStart(address); 1588 Address cachePage = roundToBlinkPageStart(address);
1589 m_entries[index + 1] = m_entries[index]; 1589 m_entries[index + 1] = m_entries[index];
1590 m_entries[index] = cachePage; 1590 m_entries[index] = cachePage;
1591 } 1591 }
1592 1592
1593 } // namespace blink 1593 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698