| 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 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 28 matching lines...) Expand all Loading... |
| 39 : m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired) | 39 : m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired) |
| 40 , m_didDisposeContextForMainFrame(false) | 40 , m_didDisposeContextForMainFrame(false) |
| 41 { | 41 { |
| 42 } | 42 } |
| 43 | 43 |
| 44 void V8GCForContextDispose::notifyContextDisposed(bool isMainFrame) | 44 void V8GCForContextDispose::notifyContextDisposed(bool isMainFrame) |
| 45 { | 45 { |
| 46 m_didDisposeContextForMainFrame = m_didDisposeContextForMainFrame || isMainF
rame; | 46 m_didDisposeContextForMainFrame = m_didDisposeContextForMainFrame || isMainF
rame; |
| 47 v8::V8::ContextDisposedNotification(); | 47 v8::V8::ContextDisposedNotification(); |
| 48 if (!m_pseudoIdleTimer.isActive()) | 48 if (!m_pseudoIdleTimer.isActive()) |
| 49 m_pseudoIdleTimer.startOneShot(0.8); | 49 m_pseudoIdleTimer.startOneShot(0.8, FROM_HERE); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void V8GCForContextDispose::notifyIdleSooner(double maximumFireInterval) | 52 void V8GCForContextDispose::notifyIdleSooner(double maximumFireInterval) |
| 53 { | 53 { |
| 54 if (m_pseudoIdleTimer.isActive()) { | 54 if (m_pseudoIdleTimer.isActive()) { |
| 55 double nextFireInterval = m_pseudoIdleTimer.nextFireInterval(); | 55 double nextFireInterval = m_pseudoIdleTimer.nextFireInterval(); |
| 56 if (nextFireInterval > maximumFireInterval) { | 56 if (nextFireInterval > maximumFireInterval) { |
| 57 m_pseudoIdleTimer.stop(); | 57 m_pseudoIdleTimer.stop(); |
| 58 m_pseudoIdleTimer.startOneShot(maximumFireInterval); | 58 m_pseudoIdleTimer.startOneShot(maximumFireInterval, FROM_HERE); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 } | 61 } |
| 62 | 62 |
| 63 V8GCForContextDispose& V8GCForContextDispose::instanceTemplate() | 63 V8GCForContextDispose& V8GCForContextDispose::instanceTemplate() |
| 64 { | 64 { |
| 65 DEFINE_STATIC_LOCAL(V8GCForContextDispose, staticInstance, ()); | 65 DEFINE_STATIC_LOCAL(V8GCForContextDispose, staticInstance, ()); |
| 66 return staticInstance; | 66 return staticInstance; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*) | 69 void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*) |
| 70 { | 70 { |
| 71 const int longIdlePauseInMs = 1000; | 71 const int longIdlePauseInMs = 1000; |
| 72 const int shortIdlePauseInMs = 10; | 72 const int shortIdlePauseInMs = 10; |
| 73 int hint = m_didDisposeContextForMainFrame ? longIdlePauseInMs : shortIdlePa
useInMs; | 73 int hint = m_didDisposeContextForMainFrame ? longIdlePauseInMs : shortIdlePa
useInMs; |
| 74 v8::V8::IdleNotification(hint); | 74 v8::V8::IdleNotification(hint); |
| 75 m_didDisposeContextForMainFrame = false; | 75 m_didDisposeContextForMainFrame = false; |
| 76 } | 76 } |
| 77 | 77 |
| 78 } // namespace WebCore | 78 } // namespace WebCore |
| OLD | NEW |