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

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

Issue 1257723002: Simplify ownership of a ThreadState's interruptors. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Switch addInterruptor() to take a PassOwnPtr<> Created 5 years, 5 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 | « Source/platform/heap/ThreadState.h ('k') | Source/web/WebKit.cpp » ('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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 ThreadState::~ThreadState() 134 ThreadState::~ThreadState()
135 { 135 {
136 ASSERT(checkThread()); 136 ASSERT(checkThread());
137 delete m_threadLocalWeakCallbackStack; 137 delete m_threadLocalWeakCallbackStack;
138 m_threadLocalWeakCallbackStack = nullptr; 138 m_threadLocalWeakCallbackStack = nullptr;
139 for (int i = 0; i < NumberOfHeaps; ++i) 139 for (int i = 0; i < NumberOfHeaps; ++i)
140 delete m_heaps[i]; 140 delete m_heaps[i];
141 141
142 for (Interruptor* interruptor : m_interruptors)
143 delete interruptor;
144
145 **s_threadSpecific = nullptr; 142 **s_threadSpecific = nullptr;
146 if (isMainThread()) { 143 if (isMainThread()) {
147 s_mainThreadStackStart = 0; 144 s_mainThreadStackStart = 0;
148 s_mainThreadUnderestimatedStackSize = 0; 145 s_mainThreadUnderestimatedStackSize = 0;
149 } 146 }
150 } 147 }
151 148
152 void ThreadState::init() 149 void ThreadState::init()
153 { 150 {
154 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>(); 151 s_threadSpecific = new WTF::ThreadSpecific<ThreadState*>();
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 ASSERT(slotCount < 1024); 1273 ASSERT(slotCount < 1024);
1277 #endif 1274 #endif
1278 1275
1279 ASSERT(!m_safePointStackCopy.size()); 1276 ASSERT(!m_safePointStackCopy.size());
1280 m_safePointStackCopy.resize(slotCount); 1277 m_safePointStackCopy.resize(slotCount);
1281 for (size_t i = 0; i < slotCount; ++i) { 1278 for (size_t i = 0; i < slotCount; ++i) {
1282 m_safePointStackCopy[i] = from[i]; 1279 m_safePointStackCopy[i] = from[i];
1283 } 1280 }
1284 } 1281 }
1285 1282
1286 void ThreadState::addInterruptor(Interruptor* interruptor) 1283 void ThreadState::addInterruptor(PassOwnPtr<Interruptor> interruptor)
1287 { 1284 {
1288 ASSERT(checkThread()); 1285 ASSERT(checkThread());
1289 SafePointScope scope(HeapPointersOnStack); 1286 SafePointScope scope(HeapPointersOnStack);
1290 { 1287 {
1291 MutexLocker locker(threadAttachMutex()); 1288 MutexLocker locker(threadAttachMutex());
1292 m_interruptors.append(interruptor); 1289 m_interruptors.append(interruptor);
1293 } 1290 }
1294 } 1291 }
1295 1292
1296 void ThreadState::removeInterruptor(Interruptor* interruptor) 1293 void ThreadState::removeInterruptor(Interruptor* interruptor)
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1532 json->beginArray(it->key.ascii().data()); 1529 json->beginArray(it->key.ascii().data());
1533 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1530 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1534 json->pushInteger(it->value.ages[age]); 1531 json->pushInteger(it->value.ages[age]);
1535 json->endArray(); 1532 json->endArray();
1536 } 1533 }
1537 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1534 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1538 } 1535 }
1539 #endif 1536 #endif
1540 1537
1541 } // namespace blink 1538 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | Source/web/WebKit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698