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

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

Issue 2690913002: Thread-local weak processing should just use a global weak callback stacks (Closed)
Patch Set: Created 3 years, 10 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) 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 } 303 }
304 304
305 void ThreadHeap::pushGlobalWeakCallback(void** cell, WeakCallback callback) { 305 void ThreadHeap::pushGlobalWeakCallback(void** cell, WeakCallback callback) {
306 ASSERT(ThreadState::current()->isInGC()); 306 ASSERT(ThreadState::current()->isInGC());
307 307
308 CallbackStack::Item* slot = m_globalWeakCallbackStack->allocateEntry(); 308 CallbackStack::Item* slot = m_globalWeakCallbackStack->allocateEntry();
309 *slot = CallbackStack::Item(cell, callback); 309 *slot = CallbackStack::Item(cell, callback);
310 } 310 }
311 311
312 void ThreadHeap::pushThreadLocalWeakCallback(void* closure, 312 void ThreadHeap::pushThreadLocalWeakCallback(void* closure,
313 void* object, 313 void* object,
haraken 2017/02/13 04:17:40 I'll remove the unused parameter and methods in a
sof 2017/02/13 06:45:00 ok, needed as this is now identical to the above p
314 WeakCallback callback) { 314 WeakCallback callback) {
315 ASSERT(ThreadState::current()->isInGC()); 315 ASSERT(ThreadState::current()->isInGC());
316 316
317 ThreadState* state = pageFromObject(object)->arena()->getThreadState(); 317 CallbackStack::Item* slot = m_globalWeakCallbackStack->allocateEntry();
318 state->pushThreadLocalWeakCallback(closure, callback); 318 *slot = CallbackStack::Item(closure, callback);
319 } 319 }
320 320
321 bool ThreadHeap::popAndInvokeGlobalWeakCallback(Visitor* visitor) { 321 bool ThreadHeap::popAndInvokeGlobalWeakCallback(Visitor* visitor) {
322 if (CallbackStack::Item* item = m_globalWeakCallbackStack->pop()) { 322 if (CallbackStack::Item* item = m_globalWeakCallbackStack->pop()) {
323 item->call(visitor); 323 item->call(visitor);
324 return true; 324 return true;
325 } 325 }
326 return false; 326 return false;
327 } 327 }
328 328
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); 599 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize());
600 600
601 m_stats.reset(); 601 m_stats.reset();
602 for (ThreadState* state : m_threads) 602 for (ThreadState* state : m_threads)
603 state->resetHeapCounters(); 603 state->resetHeapCounters();
604 } 604 }
605 605
606 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; 606 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr;
607 607
608 } // namespace blink 608 } // 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