Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: webkit/glue/plugins/webplugin_delegate_impl.h

Issue 18082: Improve scrolling performance when there are many windowed plugins in a page.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Call DestroyWindow on the right thread & ensure NPP_SetWindow is called right away Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ 5 #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ 6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
7 7
8 #include <string> 8 #include <string>
9 #include <list> 9 #include <list>
10 10
(...skipping 26 matching lines...) Expand all
37 37
38 // WebPluginDelegate implementation 38 // WebPluginDelegate implementation
39 virtual void PluginDestroyed(); 39 virtual void PluginDestroyed();
40 virtual bool Initialize(const GURL& url, 40 virtual bool Initialize(const GURL& url,
41 char** argn, 41 char** argn,
42 char** argv, 42 char** argv,
43 int argc, 43 int argc,
44 WebPlugin* plugin, 44 WebPlugin* plugin,
45 bool load_manually); 45 bool load_manually);
46 virtual void UpdateGeometry(const gfx::Rect& window_rect, 46 virtual void UpdateGeometry(const gfx::Rect& window_rect,
47 const gfx::Rect& clip_rect, 47 const gfx::Rect& clip_rect);
48 const std::vector<gfx::Rect>& cutout_rects,
49 bool visible);
50 virtual void Paint(HDC hdc, const gfx::Rect& rect); 48 virtual void Paint(HDC hdc, const gfx::Rect& rect);
51 virtual void Print(HDC hdc); 49 virtual void Print(HDC hdc);
52 virtual void SetFocus(); // only called when windowless 50 virtual void SetFocus(); // only called when windowless
53 // only called when windowless 51 // only called when windowless
54 virtual bool HandleEvent(NPEvent* event, 52 virtual bool HandleEvent(NPEvent* event,
55 WebCursor* cursor); 53 WebCursor* cursor);
56 virtual NPObject* GetPluginScriptableObject(); 54 virtual NPObject* GetPluginScriptableObject();
57 virtual void DidFinishLoadWithReason(NPReason reason); 55 virtual void DidFinishLoadWithReason(NPReason reason);
58 virtual int GetProcessId(); 56 virtual int GetProcessId();
59 57
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, 89 PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4,
92 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, 90 PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8,
93 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, 91 PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16,
94 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, 92 PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32,
95 PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU = 64, 93 PLUGIN_QUIRK_PATCH_TRACKPOPUP_MENU = 64,
96 PLUGIN_QUIRK_PATCH_SETCURSOR = 128, 94 PLUGIN_QUIRK_PATCH_SETCURSOR = 128,
97 }; 95 };
98 96
99 int quirks() { return quirks_; } 97 int quirks() { return quirks_; }
100 98
101 static void MoveWindow(HWND window,
102 const gfx::Rect& window_rect,
103 const gfx::Rect& clip_rect,
104 const std::vector<gfx::Rect>& cutout_rects,
105 bool visible);
106
107 private: 99 private:
108 WebPluginDelegateImpl(gfx::NativeView containing_view, 100 WebPluginDelegateImpl(gfx::NativeView containing_view,
109 NPAPI::PluginInstance *instance); 101 NPAPI::PluginInstance *instance);
110 ~WebPluginDelegateImpl(); 102 ~WebPluginDelegateImpl();
111 103
112 //-------------------------- 104 //--------------------------
113 // used for windowed plugins 105 // used for windowed plugins
114 void WindowedUpdateGeometry(const gfx::Rect& window_rect, 106 void WindowedUpdateGeometry(const gfx::Rect& window_rect,
115 const gfx::Rect& clip_rect, 107 const gfx::Rect& clip_rect);
116 const std::vector<gfx::Rect>& cutout_rects,
117 bool visible);
118 // Create the native window. 108 // Create the native window.
119 // Returns true if the window is created (or already exists). 109 // Returns true if the window is created (or already exists).
120 // Returns false if unable to create the window. 110 // Returns false if unable to create the window.
121 bool WindowedCreatePlugin(); 111 bool WindowedCreatePlugin();
122 112
123 // Destroy the native window. 113 // Destroy the native window.
124 void WindowedDestroyWindow(); 114 void WindowedDestroyWindow();
125 115
126 // Reposition the native window to be in sync with the given geometry. 116 // Reposition the native window to be in sync with the given geometry.
127 // Returns true if the native window has moved or been clipped differently. 117 // Returns true if the native window has moved or been clipped differently.
128 bool WindowedReposition(const gfx::Rect& window_rect, 118 bool WindowedReposition(const gfx::Rect& window_rect,
129 const gfx::Rect& clip_rect, 119 const gfx::Rect& clip_rect);
130 const std::vector<gfx::Rect>& cutout_rects,
131 bool visible);
132 120
133 // Tells the plugin about the current state of the window. 121 // Tells the plugin about the current state of the window.
134 // See NPAPI NPP_SetWindow for more information. 122 // See NPAPI NPP_SetWindow for more information.
135 void WindowedSetWindow(); 123 void WindowedSetWindow();
136 124
137 // Registers the window class for our window 125 // Registers the window class for our window
138 ATOM RegisterNativeWindowClass(); 126 ATOM RegisterNativeWindowClass();
139 127
140 // Our WndProc functions. 128 // Our WndProc functions.
141 static LRESULT CALLBACK DummyWindowProc( 129 static LRESULT CALLBACK DummyWindowProc(
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 uint32 last_message_; 182 uint32 last_message_;
195 bool is_calling_wndproc; 183 bool is_calling_wndproc;
196 184
197 HWND parent_; 185 HWND parent_;
198 NPWindow window_; 186 NPWindow window_;
199 gfx::Rect window_rect_; 187 gfx::Rect window_rect_;
200 gfx::Rect clip_rect_; 188 gfx::Rect clip_rect_;
201 std::vector<gfx::Rect> cutout_rects_; 189 std::vector<gfx::Rect> cutout_rects_;
202 int quirks_; 190 int quirks_;
203 191
204 // We only move/size the plugin window once after its creation. The
205 // rest of the moves are controlled by the browser. This flag controls
206 // this behaviour.
207 bool initial_plugin_resize_done_;
208
209 // Windowless plugins don't have keyboard focus causing issues with the 192 // Windowless plugins don't have keyboard focus causing issues with the
210 // plugin not receiving keyboard events if the plugin enters a modal 193 // plugin not receiving keyboard events if the plugin enters a modal
211 // loop like TrackPopupMenuEx or MessageBox, etc. 194 // loop like TrackPopupMenuEx or MessageBox, etc.
212 // This is a basic issue with windows activation and focus arising due to 195 // This is a basic issue with windows activation and focus arising due to
213 // the fact that these windows are created by different threads. Activation 196 // the fact that these windows are created by different threads. Activation
214 // and focus are thread specific states, and if the browser has focus, 197 // and focus are thread specific states, and if the browser has focus,
215 // the plugin may not have focus. 198 // the plugin may not have focus.
216 // To fix a majority of these activation issues we create a dummy visible 199 // To fix a majority of these activation issues we create a dummy visible
217 // child window to which we set focus whenever the windowless plugin 200 // child window to which we set focus whenever the windowless plugin
218 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent. 201 // receives a WM_LBUTTONDOWN/WM_RBUTTONDOWN message via NPP_HandleEvent.
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 static iat_patch::IATPatchFunction iat_patch_set_cursor_; 264 static iat_patch::IATPatchFunction iat_patch_set_cursor_;
282 265
283 // Holds the current cursor set by the windowless plugin. 266 // Holds the current cursor set by the windowless plugin.
284 WebCursor current_windowless_cursor_; 267 WebCursor current_windowless_cursor_;
285 268
286 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl); 269 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateImpl);
287 }; 270 };
288 271
289 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__ 272 #endif // #ifndef WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_IMPL_H__
290 273
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698