OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 219 |
220 invokeRequest(request); | 220 invokeRequest(request); |
221 } | 221 } |
222 | 222 |
223 void SpellCheckRequester::cancelCheck() | 223 void SpellCheckRequester::cancelCheck() |
224 { | 224 { |
225 if (m_processingRequest) | 225 if (m_processingRequest) |
226 m_processingRequest->didCancel(); | 226 m_processingRequest->didCancel(); |
227 } | 227 } |
228 | 228 |
| 229 void SpellCheckRequester::prepareForLeakDetection() |
| 230 { |
| 231 m_timerToProcessQueuedRequest.stop(); |
| 232 // Empty the queue of pending requests to prevent it being a leak source. |
| 233 // Pending spell checker requests are cancellable requests not representing |
| 234 // leaks, just async work items waiting to be processed. |
| 235 // |
| 236 // Rather than somehow wait for this async queue to drain before running |
| 237 // the leak detector, they're all cancelled to prevent flaky leaks being |
| 238 // reported. |
| 239 m_requestQueue.clear(); |
| 240 } |
| 241 |
229 void SpellCheckRequester::invokeRequest(PassRefPtrWillBeRawPtr<SpellCheckRequest
> request) | 242 void SpellCheckRequester::invokeRequest(PassRefPtrWillBeRawPtr<SpellCheckRequest
> request) |
230 { | 243 { |
231 ASSERT(!m_processingRequest); | 244 ASSERT(!m_processingRequest); |
232 m_processingRequest = request; | 245 m_processingRequest = request; |
233 client().requestCheckingOfString(m_processingRequest); | 246 client().requestCheckingOfString(m_processingRequest); |
234 } | 247 } |
235 | 248 |
236 void SpellCheckRequester::clearProcessingRequest() | 249 void SpellCheckRequester::clearProcessingRequest() |
237 { | 250 { |
238 if (!m_processingRequest) | 251 if (!m_processingRequest) |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 } | 324 } |
312 | 325 |
313 DEFINE_TRACE(SpellCheckRequester) | 326 DEFINE_TRACE(SpellCheckRequester) |
314 { | 327 { |
315 visitor->trace(m_frame); | 328 visitor->trace(m_frame); |
316 visitor->trace(m_processingRequest); | 329 visitor->trace(m_processingRequest); |
317 visitor->trace(m_requestQueue); | 330 visitor->trace(m_requestQueue); |
318 } | 331 } |
319 | 332 |
320 } // namespace blink | 333 } // namespace blink |
OLD | NEW |