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 29 matching lines...) Expand all Loading... | |
40 V8GCForContextDispose::V8GCForContextDispose() | 40 V8GCForContextDispose::V8GCForContextDispose() |
41 : m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired) | 41 : m_pseudoIdleTimer(this, &V8GCForContextDispose::pseudoIdleTimerFired) |
42 , m_didDisposeContextForMainFrame(false) | 42 , m_didDisposeContextForMainFrame(false) |
43 { | 43 { |
44 } | 44 } |
45 | 45 |
46 void V8GCForContextDispose::notifyContextDisposed(bool isMainFrame) | 46 void V8GCForContextDispose::notifyContextDisposed(bool isMainFrame) |
47 { | 47 { |
48 m_didDisposeContextForMainFrame = m_didDisposeContextForMainFrame || isMainF rame; | 48 m_didDisposeContextForMainFrame = m_didDisposeContextForMainFrame || isMainF rame; |
49 V8PerIsolateData::mainThreadIsolate()->ContextDisposedNotification(); | 49 V8PerIsolateData::mainThreadIsolate()->ContextDisposedNotification(); |
50 if (!m_pseudoIdleTimer.isActive()) | 50 if (!m_pseudoIdleTimer.isActive()) |
jochen (gone - plz use gerrit)
2014/09/04 11:20:42
why start the timer if it's for the main frame?
ulan
2014/09/04 11:41:25
Done.
| |
51 m_pseudoIdleTimer.startOneShot(0.8, FROM_HERE); | 51 m_pseudoIdleTimer.startOneShot(0.8, FROM_HERE); |
52 } | 52 } |
53 | 53 |
54 void V8GCForContextDispose::notifyIdleSooner(double maximumFireInterval) | 54 void V8GCForContextDispose::notifyIdleSooner(double maximumFireInterval) |
55 { | 55 { |
56 if (m_pseudoIdleTimer.isActive()) { | 56 if (m_pseudoIdleTimer.isActive()) { |
jochen (gone - plz use gerrit)
2014/09/04 11:20:42
same here
ulan
2014/09/04 11:41:25
Done.
| |
57 double nextFireInterval = m_pseudoIdleTimer.nextFireInterval(); | 57 double nextFireInterval = m_pseudoIdleTimer.nextFireInterval(); |
58 if (nextFireInterval > maximumFireInterval) { | 58 if (nextFireInterval > maximumFireInterval) { |
59 m_pseudoIdleTimer.stop(); | 59 m_pseudoIdleTimer.stop(); |
60 m_pseudoIdleTimer.startOneShot(maximumFireInterval, FROM_HERE); | 60 m_pseudoIdleTimer.startOneShot(maximumFireInterval, FROM_HERE); |
61 } | 61 } |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 V8GCForContextDispose& V8GCForContextDispose::instanceTemplate() | 65 V8GCForContextDispose& V8GCForContextDispose::instanceTemplate() |
66 { | 66 { |
67 DEFINE_STATIC_LOCAL(V8GCForContextDispose, staticInstance, ()); | 67 DEFINE_STATIC_LOCAL(V8GCForContextDispose, staticInstance, ()); |
68 return staticInstance; | 68 return staticInstance; |
69 } | 69 } |
70 | 70 |
71 void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*) | 71 void V8GCForContextDispose::pseudoIdleTimerFired(Timer<V8GCForContextDispose>*) |
72 { | 72 { |
73 const int longIdlePauseInMs = 100; | 73 const int idlePauseInMs = 10; |
74 const int shortIdlePauseInMs = 10; | 74 if (!m_didDisposeContextForMainFrame) |
75 int hint = m_didDisposeContextForMainFrame ? longIdlePauseInMs : shortIdlePa useInMs; | 75 V8PerIsolateData::mainThreadIsolate()->IdleNotification(idlePauseInMs); |
76 V8PerIsolateData::mainThreadIsolate()->IdleNotification(hint); | |
77 m_didDisposeContextForMainFrame = false; | 76 m_didDisposeContextForMainFrame = false; |
78 } | 77 } |
79 | 78 |
80 } // namespace blink | 79 } // namespace blink |
OLD | NEW |