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

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

Issue 1149943003: Oilpan: Rename weak callback related methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 7 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 | « Source/platform/heap/ThreadState.h ('k') | Source/platform/heap/Visitor.h » ('j') | 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size of(void*); 118 s_mainThreadUnderestimatedStackSize = underestimatedStackSize - size of(void*);
119 } 119 }
120 120
121 for (int heapIndex = 0; heapIndex < LargeObjectHeapIndex; heapIndex++) 121 for (int heapIndex = 0; heapIndex < LargeObjectHeapIndex; heapIndex++)
122 m_heaps[heapIndex] = new NormalPageHeap(this, heapIndex); 122 m_heaps[heapIndex] = new NormalPageHeap(this, heapIndex);
123 m_heaps[LargeObjectHeapIndex] = new LargeObjectHeap(this, LargeObjectHeapInd ex); 123 m_heaps[LargeObjectHeapIndex] = new LargeObjectHeap(this, LargeObjectHeapInd ex);
124 124
125 m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArr aySize]); 125 m_likelyToBePromptlyFreed = adoptArrayPtr(new int[likelyToBePromptlyFreedArr aySize]);
126 clearHeapAges(); 126 clearHeapAges();
127 127
128 m_weakCallbackStack = new CallbackStack(); 128 m_threadLocalWeakCallbackStack = new CallbackStack();
129 } 129 }
130 130
131 ThreadState::~ThreadState() 131 ThreadState::~ThreadState()
132 { 132 {
133 checkThread(); 133 checkThread();
134 delete m_weakCallbackStack; 134 delete m_threadLocalWeakCallbackStack;
135 m_weakCallbackStack = nullptr; 135 m_threadLocalWeakCallbackStack = nullptr;
136 for (int i = 0; i < NumberOfHeaps; ++i) 136 for (int i = 0; i < NumberOfHeaps; ++i)
137 delete m_heaps[i]; 137 delete m_heaps[i];
138 deleteAllValues(m_interruptors); 138 deleteAllValues(m_interruptors);
139 **s_threadSpecific = nullptr; 139 **s_threadSpecific = nullptr;
140 if (isMainThread()) { 140 if (isMainThread()) {
141 s_mainThreadStackStart = 0; 141 s_mainThreadStackStart = 0;
142 s_mainThreadUnderestimatedStackSize = 0; 142 s_mainThreadUnderestimatedStackSize = 0;
143 } 143 }
144 } 144 }
145 145
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("blink_gc", "ThreadState", this, json.re lease()); 461 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID("blink_gc", "ThreadState", this, json.re lease());
462 } 462 }
463 463
464 void ThreadState::incrementMarkedObjectsAge() 464 void ThreadState::incrementMarkedObjectsAge()
465 { 465 {
466 for (int i = 0; i < NumberOfHeaps; ++i) 466 for (int i = 0; i < NumberOfHeaps; ++i)
467 m_heaps[i]->incrementMarkedObjectsAge(); 467 m_heaps[i]->incrementMarkedObjectsAge();
468 } 468 }
469 #endif 469 #endif
470 470
471 void ThreadState::pushWeakPointerCallback(void* object, WeakPointerCallback call back) 471 void ThreadState::pushThreadLocalWeakCallback(void* object, WeakCallback callbac k)
472 { 472 {
473 CallbackStack::Item* slot = m_weakCallbackStack->allocateEntry(); 473 CallbackStack::Item* slot = m_threadLocalWeakCallbackStack->allocateEntry();
474 *slot = CallbackStack::Item(object, callback); 474 *slot = CallbackStack::Item(object, callback);
475 } 475 }
476 476
477 bool ThreadState::popAndInvokeWeakPointerCallback(Visitor* visitor) 477 bool ThreadState::popAndInvokeThreadLocalWeakCallback(Visitor* visitor)
478 { 478 {
479 // For weak processing we should never reach orphaned pages since orphaned 479 // For weak processing we should never reach orphaned pages since orphaned
480 // pages are not traced and thus objects on those pages are never be 480 // pages are not traced and thus objects on those pages are never be
481 // registered as objects on orphaned pages. We cannot assert this here since 481 // registered as objects on orphaned pages. We cannot assert this here since
482 // we might have an off-heap collection. We assert it in 482 // we might have an off-heap collection. We assert it in
483 // Heap::pushWeakPointerCallback. 483 // Heap::pushThreadLocalWeakCallback.
484 if (CallbackStack::Item* item = m_weakCallbackStack->pop()) { 484 if (CallbackStack::Item* item = m_threadLocalWeakCallbackStack->pop()) {
485 item->call(visitor); 485 item->call(visitor);
486 return true; 486 return true;
487 } 487 }
488 return false; 488 return false;
489 } 489 }
490 490
491 PersistentNode& ThreadState::globalRoots() 491 PersistentNode& ThreadState::globalRoots()
492 { 492 {
493 AtomicallyInitializedStaticReference(PersistentNode, anchor, new PersistentA nchor); 493 AtomicallyInitializedStaticReference(PersistentNode, anchor, new PersistentA nchor);
494 return anchor; 494 return anchor;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 if (isMainThread()) 874 if (isMainThread())
875 ScriptForbiddenScope::enter(); 875 ScriptForbiddenScope::enter();
876 876
877 SweepForbiddenScope forbiddenScope(this); 877 SweepForbiddenScope forbiddenScope(this);
878 { 878 {
879 // Disallow allocation during weak processing. 879 // Disallow allocation during weak processing.
880 NoAllocationScope noAllocationScope(this); 880 NoAllocationScope noAllocationScope(this);
881 { 881 {
882 TRACE_EVENT0("blink_gc", "ThreadState::threadLocalWeakProcessing "); 882 TRACE_EVENT0("blink_gc", "ThreadState::threadLocalWeakProcessing ");
883 // Perform thread-specific weak processing. 883 // Perform thread-specific weak processing.
884 while (popAndInvokeWeakPointerCallback(Heap::s_markingVisitor)) { } 884 while (popAndInvokeThreadLocalWeakCallback(Heap::s_markingVisito r)) { }
885 } 885 }
886 { 886 {
887 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); 887 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers");
888 invokePreFinalizers(*Heap::s_markingVisitor); 888 invokePreFinalizers(*Heap::s_markingVisitor);
889 } 889 }
890 } 890 }
891 891
892 if (isMainThread()) 892 if (isMainThread())
893 ScriptForbiddenScope::exit(); 893 ScriptForbiddenScope::exit();
894 } 894 }
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 json->beginArray(it->key.ascii().data()); 1329 json->beginArray(it->key.ascii().data());
1330 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1330 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1331 json->pushInteger(it->value.ages[age]); 1331 json->pushInteger(it->value.ages[age]);
1332 json->endArray(); 1332 json->endArray();
1333 } 1333 }
1334 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1334 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1335 } 1335 }
1336 #endif 1336 #endif
1337 1337
1338 } // namespace blink 1338 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698