| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 #include "bindings/core/v8/V8GCController.h" | 33 #include "bindings/core/v8/V8GCController.h" |
| 34 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" | 34 #include "core/editing/spellcheck/IdleSpellCheckCallback.h" |
| 35 #include "core/editing/spellcheck/SpellChecker.h" | 35 #include "core/editing/spellcheck/SpellChecker.h" |
| 36 #include "core/fetch/MemoryCache.h" | 36 #include "core/fetch/MemoryCache.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 "modules/compositorworker/AbstractAnimationWorkletThread.h" |
| 40 #include "platform/InstanceCounters.h" | 40 #include "platform/InstanceCounters.h" |
| 41 #include "platform/Timer.h" | 41 #include "platform/Timer.h" |
| 42 #include "public/platform/Platform.h" |
| 43 #include "public/platform/WebThread.h" |
| 42 #include "public/web/WebFrame.h" | 44 #include "public/web/WebFrame.h" |
| 43 #include "web/WebLocalFrameImpl.h" | 45 #include "web/WebLocalFrameImpl.h" |
| 44 | 46 |
| 45 namespace blink { | 47 namespace blink { |
| 46 | 48 |
| 47 namespace { | 49 namespace { |
| 48 | 50 |
| 49 class WebLeakDetectorImpl final : public WebLeakDetector { | 51 class WebLeakDetectorImpl final : public WebLeakDetector { |
| 50 WTF_MAKE_NONCOPYABLE(WebLeakDetectorImpl); | 52 WTF_MAKE_NONCOPYABLE(WebLeakDetectorImpl); |
| 51 | 53 |
| 52 public: | 54 public: |
| 53 explicit WebLeakDetectorImpl(WebLeakDetectorClient* client) | 55 explicit WebLeakDetectorImpl(WebLeakDetectorClient* client) |
| 54 : m_client(client), | 56 : m_client(client), |
| 55 m_delayedGCAndReportTimer(this, | 57 m_delayedGCAndReportTimer( |
| 56 &WebLeakDetectorImpl::delayedGCAndReport), | 58 Platform::current()->currentThread()->getWebTaskRunner(), |
| 57 m_delayedReportTimer(this, &WebLeakDetectorImpl::delayedReport), | 59 this, |
| 60 &WebLeakDetectorImpl::delayedGCAndReport), |
| 61 m_delayedReportTimer( |
| 62 Platform::current()->currentThread()->getWebTaskRunner(), |
| 63 this, |
| 64 &WebLeakDetectorImpl::delayedReport), |
| 58 m_numberOfGCNeeded(0) { | 65 m_numberOfGCNeeded(0) { |
| 59 DCHECK(m_client); | 66 DCHECK(m_client); |
| 60 } | 67 } |
| 61 | 68 |
| 62 ~WebLeakDetectorImpl() override {} | 69 ~WebLeakDetectorImpl() override {} |
| 63 | 70 |
| 64 void prepareForLeakDetection(WebFrame*) override; | 71 void prepareForLeakDetection(WebFrame*) override; |
| 65 void collectGarbageAndReport() override; | 72 void collectGarbageAndReport() override; |
| 66 | 73 |
| 67 private: | 74 private: |
| 68 void delayedGCAndReport(TimerBase*); | 75 void delayedGCAndReport(TimerBase*); |
| 69 void delayedReport(TimerBase*); | 76 void delayedReport(TimerBase*); |
| 70 | 77 |
| 71 WebLeakDetectorClient* m_client; | 78 WebLeakDetectorClient* m_client; |
| 72 Timer<WebLeakDetectorImpl> m_delayedGCAndReportTimer; | 79 TaskRunnerTimer<WebLeakDetectorImpl> m_delayedGCAndReportTimer; |
| 73 Timer<WebLeakDetectorImpl> m_delayedReportTimer; | 80 TaskRunnerTimer<WebLeakDetectorImpl> m_delayedReportTimer; |
| 74 int m_numberOfGCNeeded; | 81 int m_numberOfGCNeeded; |
| 75 }; | 82 }; |
| 76 | 83 |
| 77 void WebLeakDetectorImpl::prepareForLeakDetection(WebFrame* frame) { | 84 void WebLeakDetectorImpl::prepareForLeakDetection(WebFrame* frame) { |
| 78 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 85 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 79 v8::HandleScope handleScope(isolate); | 86 v8::HandleScope handleScope(isolate); |
| 80 | 87 |
| 81 // For example, calling isValidEmailAddress in EmailInputType.cpp with a | 88 // For example, calling isValidEmailAddress in EmailInputType.cpp with a |
| 82 // non-empty string creates a static ScriptRegexp value which holds a | 89 // non-empty string creates a static ScriptRegexp value which holds a |
| 83 // V8PerContextData indirectly. This affects the number of V8PerContextData. | 90 // V8PerContextData indirectly. This affects the number of V8PerContextData. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 #endif | 190 #endif |
| 184 } | 191 } |
| 185 | 192 |
| 186 } // namespace | 193 } // namespace |
| 187 | 194 |
| 188 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) { | 195 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) { |
| 189 return new WebLeakDetectorImpl(client); | 196 return new WebLeakDetectorImpl(client); |
| 190 } | 197 } |
| 191 | 198 |
| 192 } // namespace blink | 199 } // namespace blink |
| OLD | NEW |