OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "public/web/WebLeakDetector.h" | 31 #include "public/web/WebLeakDetector.h" |
32 | 32 |
33 #include "bindings/core/v8/V8GCController.h" | 33 #include "bindings/core/v8/V8GCController.h" |
34 #include "core/editing/spellcheck/SpellChecker.h" | 34 #include "core/editing/spellcheck/SpellChecker.h" |
35 #include "core/fetch/MemoryCache.h" | 35 #include "core/fetch/MemoryCache.h" |
36 #include "core/inspector/InstanceCounters.h" | 36 #include "core/inspector/InstanceCounters.h" |
37 #include "core/workers/InProcessWorkerMessagingProxy.h" | 37 #include "core/workers/InProcessWorkerMessagingProxy.h" |
38 #include "core/workers/WorkerThread.h" | 38 #include "core/workers/WorkerThread.h" |
| 39 #include "modules/compositorworker/AbstractAnimationWorkletThread.h" |
39 #include "platform/Timer.h" | 40 #include "platform/Timer.h" |
40 #include "public/web/WebFrame.h" | 41 #include "public/web/WebFrame.h" |
41 #include "web/WebLocalFrameImpl.h" | 42 #include "web/WebLocalFrameImpl.h" |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
45 namespace { | 46 namespace { |
46 | 47 |
47 class WebLeakDetectorImpl final : public WebLeakDetector { | 48 class WebLeakDetectorImpl final : public WebLeakDetector { |
48 WTF_MAKE_NONCOPYABLE(WebLeakDetectorImpl); | 49 WTF_MAKE_NONCOPYABLE(WebLeakDetectorImpl); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 99 } |
99 | 100 |
100 // FIXME: HTML5 Notification should be closed because notification affects t
he result of number of DOM objects. | 101 // FIXME: HTML5 Notification should be closed because notification affects t
he result of number of DOM objects. |
101 | 102 |
102 V8PerIsolateData::from(isolate)->clearScriptRegexpContext(); | 103 V8PerIsolateData::from(isolate)->clearScriptRegexpContext(); |
103 } | 104 } |
104 | 105 |
105 void WebLeakDetectorImpl::collectGarbageAndReport() | 106 void WebLeakDetectorImpl::collectGarbageAndReport() |
106 { | 107 { |
107 V8GCController::collectAllGarbageForTesting(V8PerIsolateData::mainThreadIsol
ate()); | 108 V8GCController::collectAllGarbageForTesting(V8PerIsolateData::mainThreadIsol
ate()); |
| 109 AbstractAnimationWorkletThread::collectAllGarbage(); |
108 // Note: Oilpan precise GC is scheduled at the end of the event loop. | 110 // Note: Oilpan precise GC is scheduled at the end of the event loop. |
109 | 111 |
110 // Task queue may contain delayed object destruction tasks. | 112 // Task queue may contain delayed object destruction tasks. |
111 // This method is called from navigation hook inside FrameLoader, | 113 // This method is called from navigation hook inside FrameLoader, |
112 // so previous document is still held by the loader until the next event loo
p. | 114 // so previous document is still held by the loader until the next event loo
p. |
113 // Complete all pending tasks before proceeding to gc. | 115 // Complete all pending tasks before proceeding to gc. |
114 m_numberOfGCNeeded = 2; | 116 m_numberOfGCNeeded = 2; |
115 m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE); | 117 m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE); |
116 } | 118 } |
117 | 119 |
118 void WebLeakDetectorImpl::delayedGCAndReport(TimerBase*) | 120 void WebLeakDetectorImpl::delayedGCAndReport(TimerBase*) |
119 { | 121 { |
120 // We do a second and third GC here to address flakiness | 122 // We do a second and third GC here to address flakiness |
121 // The second GC is necessary as Resource GC may have postponed clean-up tas
ks to next event loop. | 123 // The second GC is necessary as Resource GC may have postponed clean-up tas
ks to next event loop. |
122 // The third GC is necessary for cleaning up Document after worker object di
ed. | 124 // The third GC is necessary for cleaning up Document after worker object di
ed. |
123 | 125 |
124 V8GCController::collectAllGarbageForTesting(V8PerIsolateData::mainThreadIsol
ate()); | 126 V8GCController::collectAllGarbageForTesting(V8PerIsolateData::mainThreadIsol
ate()); |
| 127 AbstractAnimationWorkletThread::collectAllGarbage(); |
125 // Note: Oilpan precise GC is scheduled at the end of the event loop. | 128 // Note: Oilpan precise GC is scheduled at the end of the event loop. |
126 | 129 |
127 // Inspect counters on the next event loop. | 130 // Inspect counters on the next event loop. |
128 if (--m_numberOfGCNeeded > 0) { | 131 if (--m_numberOfGCNeeded > 0) { |
129 m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE); | 132 m_delayedGCAndReportTimer.startOneShot(0, BLINK_FROM_HERE); |
130 } else if (m_numberOfGCNeeded > -1 && InProcessWorkerMessagingProxy::proxyCo
unt()) { | 133 } else if (m_numberOfGCNeeded > -1 && InProcessWorkerMessagingProxy::proxyCo
unt()) { |
131 // It is possible that all posted tasks for finalizing in-process proxy
objects | 134 // It is possible that all posted tasks for finalizing in-process proxy
objects |
132 // will not have run before the final round of GCs started. If so, do ye
t | 135 // will not have run before the final round of GCs started. If so, do ye
t |
133 // another pass, letting these tasks run and then afterwards perform a G
C to tidy up. | 136 // another pass, letting these tasks run and then afterwards perform a G
C to tidy up. |
134 // | 137 // |
(...skipping 29 matching lines...) Expand all Loading... |
164 } | 167 } |
165 | 168 |
166 } // namespace | 169 } // namespace |
167 | 170 |
168 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) | 171 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) |
169 { | 172 { |
170 return new WebLeakDetectorImpl(client); | 173 return new WebLeakDetectorImpl(client); |
171 } | 174 } |
172 | 175 |
173 } // namespace blink | 176 } // namespace blink |
OLD | NEW |