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

Side by Side Diff: Source/platform/heap/ThreadState.cpp

Issue 1107573003: Oilpan: Add a missing null check for Platform::current() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« 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) 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 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 { 656 {
657 // Idle GC is supported only in the main thread. 657 // Idle GC is supported only in the main thread.
658 if (!isMainThread()) 658 if (!isMainThread())
659 return; 659 return;
660 660
661 if (isSweepingInProgress()) { 661 if (isSweepingInProgress()) {
662 setGCState(SweepingAndIdleGCScheduled); 662 setGCState(SweepingAndIdleGCScheduled);
663 return; 663 return;
664 } 664 }
665 665
666 Platform::current()->currentThread()->scheduler()->postNonNestableIdleTask(F ROM_HERE, WTF::bind<double>(&ThreadState::performIdleGC, this)); 666 if (Platform::current()) {
sof 2015/04/23 18:22:41 Platform::current() will exist, but it may not hav
667 setGCState(IdleGCScheduled); 667 Platform::current()->currentThread()->scheduler()->postNonNestableIdleTa sk(FROM_HERE, WTF::bind<double>(&ThreadState::performIdleGC, this));
668 setGCState(IdleGCScheduled);
669 }
668 } 670 }
669 671
670 void ThreadState::scheduleIdleLazySweep() 672 void ThreadState::scheduleIdleLazySweep()
671 { 673 {
672 // Idle complete sweep is supported only in the main thread. 674 // Idle complete sweep is supported only in the main thread.
673 if (!isMainThread()) 675 if (!isMainThread())
674 return; 676 return;
675 677
676 // TODO(haraken): Remove this. Lazy sweeping is not yet enabled in non-oilpa n builds. 678 // TODO(haraken): Remove this. Lazy sweeping is not yet enabled in non-oilpa n builds.
677 #if ENABLE(OILPAN) 679 #if ENABLE(OILPAN)
678 Platform::current()->currentThread()->scheduler()->postIdleTask(FROM_HERE, W TF::bind<double>(&ThreadState::performIdleLazySweep, this)); 680 if (Platform::current()) {
681 Platform::current()->currentThread()->scheduler()->postIdleTask(FROM_HER E, WTF::bind<double>(&ThreadState::performIdleLazySweep, this));
682 }
679 #endif 683 #endif
680 } 684 }
681 685
682 void ThreadState::schedulePreciseGC() 686 void ThreadState::schedulePreciseGC()
683 { 687 {
684 if (isSweepingInProgress()) { 688 if (isSweepingInProgress()) {
685 setGCState(SweepingAndPreciseGCScheduled); 689 setGCState(SweepingAndPreciseGCScheduled);
686 return; 690 return;
687 } 691 }
688 692
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 json->beginArray(it->key.ascii().data()); 1300 json->beginArray(it->key.ascii().data());
1297 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1301 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1298 json->pushInteger(it->value.ages[age]); 1302 json->pushInteger(it->value.ages[age]);
1299 json->endArray(); 1303 json->endArray();
1300 } 1304 }
1301 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1305 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1302 } 1306 }
1303 #endif 1307 #endif
1304 1308
1305 } // namespace blink 1309 } // 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