| OLD | NEW | 
|---|
| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 107 | 107 | 
| 108 void ProcessHeap::init() | 108 void ProcessHeap::init() | 
| 109 { | 109 { | 
| 110     s_shutdownComplete = false; | 110     s_shutdownComplete = false; | 
| 111     s_totalAllocatedSpace = 0; | 111     s_totalAllocatedSpace = 0; | 
| 112     s_totalAllocatedObjectSize = 0; | 112     s_totalAllocatedObjectSize = 0; | 
| 113     s_totalMarkedObjectSize = 0; | 113     s_totalMarkedObjectSize = 0; | 
| 114     s_isLowEndDevice = base::SysInfo::IsLowEndDevice(); | 114     s_isLowEndDevice = base::SysInfo::IsLowEndDevice(); | 
| 115 | 115 | 
| 116     GCInfoTable::init(); | 116     GCInfoTable::init(); | 
| 117 |  | 
| 118     if (Platform::current() && Platform::current()->currentThread()) |  | 
| 119         Platform::current()->registerMemoryDumpProvider(BlinkGCMemoryDumpProvide
     r::instance(), "BlinkGC"); |  | 
| 120 } | 117 } | 
| 121 | 118 | 
| 122 void ProcessHeap::resetHeapCounters() | 119 void ProcessHeap::resetHeapCounters() | 
| 123 { | 120 { | 
| 124     s_totalAllocatedObjectSize = 0; | 121     s_totalAllocatedObjectSize = 0; | 
| 125     s_totalMarkedObjectSize = 0; | 122     s_totalMarkedObjectSize = 0; | 
| 126 } | 123 } | 
| 127 | 124 | 
| 128 void ProcessHeap::shutdown() | 125 void ProcessHeap::shutdown() | 
| 129 { | 126 { | 
| 130     ASSERT(!s_shutdownComplete); | 127     ASSERT(!s_shutdownComplete); | 
| 131 | 128 | 
| 132     if (Platform::current() && Platform::current()->currentThread()) |  | 
| 133         Platform::current()->unregisterMemoryDumpProvider(BlinkGCMemoryDumpProvi
     der::instance()); |  | 
| 134 |  | 
| 135     { | 129     { | 
| 136         // The main thread must be the last thread that gets detached. | 130         // The main thread must be the last thread that gets detached. | 
| 137         MutexLocker locker(ThreadHeap::allHeapsMutex()); | 131         MutexLocker locker(ThreadHeap::allHeapsMutex()); | 
| 138         RELEASE_ASSERT(ThreadHeap::allHeaps().isEmpty()); | 132         RELEASE_ASSERT(ThreadHeap::allHeaps().isEmpty()); | 
| 139     } | 133     } | 
| 140 | 134 | 
| 141     GCInfoTable::shutdown(); | 135     GCInfoTable::shutdown(); | 
| 142     ASSERT(ProcessHeap::totalAllocatedSpace() == 0); | 136     ASSERT(ProcessHeap::totalAllocatedSpace() == 0); | 
| 143     s_shutdownComplete = true; | 137     s_shutdownComplete = true; | 
| 144 } | 138 } | 
| (...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 789     ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 783     ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 
| 790 | 784 | 
| 791     m_stats.reset(); | 785     m_stats.reset(); | 
| 792     for (ThreadState* state : m_threads) | 786     for (ThreadState* state : m_threads) | 
| 793         state->resetHeapCounters(); | 787         state->resetHeapCounters(); | 
| 794 } | 788 } | 
| 795 | 789 | 
| 796 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 790 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 
| 797 | 791 | 
| 798 } // namespace blink | 792 } // namespace blink | 
| OLD | NEW | 
|---|