| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 7 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 SendIdleEventsToDelegates(visible_delegates_); | 135 SendIdleEventsToDelegates(visible_delegates_); |
| 136 } | 136 } |
| 137 | 137 |
| 138 void SendHiddenPluginEvents() { | 138 void SendHiddenPluginEvents() { |
| 139 SendIdleEventsToDelegates(hidden_delegates_); | 139 SendIdleEventsToDelegates(hidden_delegates_); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void SendIdleEventsToDelegates( | 142 void SendIdleEventsToDelegates( |
| 143 const std::set<WebPluginDelegateImpl*>& delegates) const { | 143 const std::set<WebPluginDelegateImpl*>& delegates) const { |
| 144 for (std::set<WebPluginDelegateImpl*>::iterator i = delegates.begin(); | 144 for (std::set<WebPluginDelegateImpl*>::iterator i = delegates.begin(); |
| 145 i != delegates.end(); ++i) { | 145 i != delegates.end();) { |
| 146 (*i)->FireIdleEvent(); | 146 // If the plugin changes size or position during idle event handling, it |
| 147 // may be removed from this set; increment the iterator before calling |
| 148 // into the delegate to ensure that the iteration won't be corrupted. |
| 149 WebPluginDelegateImpl* delegate = *(i++); |
| 150 delegate->FireIdleEvent(); |
| 147 } | 151 } |
| 148 } | 152 } |
| 149 | 153 |
| 150 base::RepeatingTimer<CarbonIdleEventSource> visible_timer_; | 154 base::RepeatingTimer<CarbonIdleEventSource> visible_timer_; |
| 151 base::RepeatingTimer<CarbonIdleEventSource> hidden_timer_; | 155 base::RepeatingTimer<CarbonIdleEventSource> hidden_timer_; |
| 152 std::set<WebPluginDelegateImpl*> visible_delegates_; | 156 std::set<WebPluginDelegateImpl*> visible_delegates_; |
| 153 std::set<WebPluginDelegateImpl*> hidden_delegates_; | 157 std::set<WebPluginDelegateImpl*> hidden_delegates_; |
| 154 }; | 158 }; |
| 155 #endif // !NP_NO_CARBON | 159 #endif // !NP_NO_CARBON |
| 156 | 160 |
| (...skipping 832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 #ifndef NP_NO_QUICKDRAW | 993 #ifndef NP_NO_QUICKDRAW |
| 990 // Quickdraw-based plugins can draw at any time, so tell the renderer to | 994 // Quickdraw-based plugins can draw at any time, so tell the renderer to |
| 991 // repaint. | 995 // repaint. |
| 992 // TODO: only do this if the contents of the offscreen window has changed, | 996 // TODO: only do this if the contents of the offscreen window has changed, |
| 993 // so as not to spam the renderer with an unchanging image. | 997 // so as not to spam the renderer with an unchanging image. |
| 994 if (instance()->drawing_model() == NPDrawingModelQuickDraw) | 998 if (instance()->drawing_model() == NPDrawingModelQuickDraw) |
| 995 instance()->webplugin()->Invalidate(); | 999 instance()->webplugin()->Invalidate(); |
| 996 #endif | 1000 #endif |
| 997 } | 1001 } |
| 998 #endif // !NP_NO_CARBON | 1002 #endif // !NP_NO_CARBON |
| OLD | NEW |