| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 : m_client(client) | 57 : m_client(client) |
| 58 , m_delayedGCAndReportTimer(this, &WebLeakDetectorImpl::delayedGCAndRepo
rt) | 58 , m_delayedGCAndReportTimer(this, &WebLeakDetectorImpl::delayedGCAndRepo
rt) |
| 59 , m_delayedReportTimer(this, &WebLeakDetectorImpl::delayedReport) | 59 , m_delayedReportTimer(this, &WebLeakDetectorImpl::delayedReport) |
| 60 , m_numberOfGCNeeded(0) | 60 , m_numberOfGCNeeded(0) |
| 61 { | 61 { |
| 62 ASSERT(m_client); | 62 ASSERT(m_client); |
| 63 } | 63 } |
| 64 | 64 |
| 65 ~WebLeakDetectorImpl() override {} | 65 ~WebLeakDetectorImpl() override {} |
| 66 | 66 |
| 67 void prepareForLeakDetection(WebLocalFrame*) override; | 67 void prepareForLeakDetection() override; |
| 68 void collectGarbageAndReport() override; | 68 void collectGarbageAndReport() override; |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 void delayedGCAndReport(Timer<WebLeakDetectorImpl>*); | 71 void delayedGCAndReport(Timer<WebLeakDetectorImpl>*); |
| 72 void delayedReport(Timer<WebLeakDetectorImpl>*); | 72 void delayedReport(Timer<WebLeakDetectorImpl>*); |
| 73 | 73 |
| 74 WebLeakDetectorClient* m_client; | 74 WebLeakDetectorClient* m_client; |
| 75 Timer<WebLeakDetectorImpl> m_delayedGCAndReportTimer; | 75 Timer<WebLeakDetectorImpl> m_delayedGCAndReportTimer; |
| 76 Timer<WebLeakDetectorImpl> m_delayedReportTimer; | 76 Timer<WebLeakDetectorImpl> m_delayedReportTimer; |
| 77 int m_numberOfGCNeeded; | 77 int m_numberOfGCNeeded; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 void WebLeakDetectorImpl::prepareForLeakDetection(WebLocalFrame* frame) | 80 void WebLeakDetectorImpl::prepareForLeakDetection() |
| 81 { | 81 { |
| 82 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 82 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 83 v8::HandleScope handleScope(isolate); | 83 v8::HandleScope handleScope(isolate); |
| 84 | 84 |
| 85 // For example, calling isValidEmailAddress in EmailInputType.cpp with a | 85 // For example, calling isValidEmailAddress in EmailInputType.cpp with a |
| 86 // non-empty string creates a static ScriptRegexp value which holds a | 86 // non-empty string creates a static ScriptRegexp value which holds a |
| 87 // V8PerContextData indirectly. This affects the number of V8PerContextData. | 87 // V8PerContextData indirectly. This affects the number of V8PerContextData. |
| 88 // To ensure that context data is created, call ensureScriptRegexpContext | 88 // To ensure that context data is created, call ensureScriptRegexpContext |
| 89 // here. | 89 // here. |
| 90 V8PerIsolateData::from(isolate)->ensureScriptRegexpContext(); | 90 V8PerIsolateData::from(isolate)->ensureScriptRegexpContext(); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 149 } |
| 150 | 150 |
| 151 } // namespace | 151 } // namespace |
| 152 | 152 |
| 153 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) | 153 WebLeakDetector* WebLeakDetector::create(WebLeakDetectorClient* client) |
| 154 { | 154 { |
| 155 return new WebLeakDetectorImpl(client); | 155 return new WebLeakDetectorImpl(client); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace blink | 158 } // namespace blink |
| OLD | NEW |