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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.h

Issue 9958100: Unobfuscate RWHVMac accelerated compositing code path by separating it from plugin code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
7 #pragma once 7 #pragma once
8 8
9 #import <Cocoa/Cocoa.h> 9 #import <Cocoa/Cocoa.h>
10 #include <list>
10 11
11 #include "base/memory/scoped_nsobject.h" 12 #include "base/memory/scoped_nsobject.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h" 16 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h"
16 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma c.h" 17 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma c.h"
17 #include "content/browser/renderer_host/render_widget_host_view_base.h" 18 #include "content/browser/renderer_host/render_widget_host_view_base.h"
18 #include "content/common/edit_command.h" 19 #include "content/common/edit_command.h"
19 #import "content/public/browser/render_widget_host_view_mac_base.h" 20 #import "content/public/browser/render_widget_host_view_mac_base.h"
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
21 #include "ui/base/cocoa/base_view.h" 22 #include "ui/base/cocoa/base_view.h"
22 #include "webkit/glue/webcursor.h" 23 #include "webkit/glue/webcursor.h"
23 24
24 @class AcceleratedPluginView; 25 @class AcceleratedPluginView;
26 class CompositingIOSurfaceMac;
25 class RenderWidgetHostViewMac; 27 class RenderWidgetHostViewMac;
26 @protocol RenderWidgetHostViewMacDelegate; 28 @protocol RenderWidgetHostViewMacDelegate;
27 class RenderWidgetHostViewMacEditCommandHelper; 29 class RenderWidgetHostViewMacEditCommandHelper;
28 @class ToolTip; 30 @class ToolTip;
29 31
30 namespace content { 32 namespace content {
31 class RenderWidgetHostImpl; 33 class RenderWidgetHostImpl;
32 } 34 }
33 35
34 @protocol RenderWidgetHostViewMacOwner 36 @protocol RenderWidgetHostViewMacOwner
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 int focusedPluginIdentifier_; 120 int focusedPluginIdentifier_;
119 121
120 // Whether or not plugin IME is currently enabled active. 122 // Whether or not plugin IME is currently enabled active.
121 BOOL pluginImeActive_; 123 BOOL pluginImeActive_;
122 124
123 // Whether the previous mouse event was ignored due to hitTest check. 125 // Whether the previous mouse event was ignored due to hitTest check.
124 BOOL mouseEventWasIgnored_; 126 BOOL mouseEventWasIgnored_;
125 127
126 // Event monitor for gesture-end events. 128 // Event monitor for gesture-end events.
127 id endGestureMonitor_; 129 id endGestureMonitor_;
130
131 // OpenGL Support:
132
133 // recursive globalFrameDidChange protection:
134 BOOL handlingGlobalFrameDidChange_;
135
136 // Set to YES once a GL context is attached to this NSView; never set back to
137 // NO.
138 BOOL hasGLContext_;
128 } 139 }
129 140
130 @property(nonatomic, readonly) NSRange selectedRange; 141 @property(nonatomic, readonly) NSRange selectedRange;
131 142
132 - (void)setCanBeKeyView:(BOOL)can; 143 - (void)setCanBeKeyView:(BOOL)can;
133 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b; 144 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b;
134 - (void)setCloseOnDeactivate:(BOOL)b; 145 - (void)setCloseOnDeactivate:(BOOL)b;
135 - (void)setToolTipAtMousePoint:(NSString *)string; 146 - (void)setToolTipAtMousePoint:(NSString *)string;
136 // True for always-on-top special windows (e.g. Balloons and Panels). 147 // True for always-on-top special windows (e.g. Balloons and Panels).
137 - (BOOL)acceptsMouseEventsWhenInactive; 148 - (BOOL)acceptsMouseEventsWhenInactive;
138 // Cancel ongoing composition (abandon the marked text). 149 // Cancel ongoing composition (abandon the marked text).
139 - (void)cancelComposition; 150 - (void)cancelComposition;
140 // Confirm ongoing composition. 151 // Confirm ongoing composition.
141 - (void)confirmComposition; 152 - (void)confirmComposition;
142 // Enables or disables plugin IME. 153 // Enables or disables plugin IME.
143 - (void)setPluginImeActive:(BOOL)active; 154 - (void)setPluginImeActive:(BOOL)active;
144 // Updates the current plugin focus state. 155 // Updates the current plugin focus state.
145 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId; 156 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId;
146 // Evaluates the event in the context of plugin IME, if plugin IME is enabled. 157 // Evaluates the event in the context of plugin IME, if plugin IME is enabled.
147 // Returns YES if the event was handled. 158 // Returns YES if the event was handled.
148 - (BOOL)postProcessEventForPluginIme:(NSEvent*)event; 159 - (BOOL)postProcessEventForPluginIme:(NSEvent*)event;
160 // Tell the view that a GL context was created and accelerated rendering may
161 // ensue.
162 - (void)addedGLContext;
149 163
150 @end 164 @end
151 165
152 /////////////////////////////////////////////////////////////////////////////// 166 ///////////////////////////////////////////////////////////////////////////////
153 // RenderWidgetHostViewMac 167 // RenderWidgetHostViewMac
154 // 168 //
155 // An object representing the "View" of a rendered web page. This object is 169 // An object representing the "View" of a rendered web page. This object is
156 // responsible for displaying the content of the web page, and integrating with 170 // responsible for displaying the content of the web page, and integrating with
157 // the Cocoa view system. It is the implementation of the RenderWidgetHostView 171 // the Cocoa view system. It is the implementation of the RenderWidgetHostView
158 // that the cross-platform RenderWidgetHost object uses 172 // that the cross-platform RenderWidgetHost object uses
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 314
301 void KillSelf(); 315 void KillSelf();
302 316
303 void SetTextInputActive(bool active); 317 void SetTextInputActive(bool active);
304 318
305 // Sends completed plugin IME notification and text back to the renderer. 319 // Sends completed plugin IME notification and text back to the renderer.
306 void PluginImeCompositionCompleted(const string16& text, int plugin_id); 320 void PluginImeCompositionCompleted(const string16& text, int plugin_id);
307 321
308 const std::string& selected_text() const { return selected_text_; } 322 const std::string& selected_text() const { return selected_text_; }
309 323
310 void UpdateRootGpuViewVisibility(bool show_gpu_widget); 324 void CompositorSwapBuffers(uint64 surface_handle,
311 325 int32 route_id,
312 // When rendering transitions from gpu to software, the gpu widget can't be 326 int32 gpu_host_id);
313 // hidden until the software backing store has been updated. This method 327 void CompositorSwapBuffersComplete();
314 // checks if the GPU view needs to be hidden and hides it if necessary. It
315 // should be called after the software backing store has been painted to.
316 void HandleDelayedGpuViewHiding();
317 328
318 // These member variables should be private, but the associated ObjC class 329 // These member variables should be private, but the associated ObjC class
319 // needs access to them and can't be made a friend. 330 // needs access to them and can't be made a friend.
320 331
321 // The associated Model. Can be NULL if Destroy() is called when 332 // The associated Model. Can be NULL if Destroy() is called when
322 // someone (other than superview) has retained |cocoa_view_|. 333 // someone (other than superview) has retained |cocoa_view_|.
323 content::RenderWidgetHostImpl* render_widget_host_; 334 content::RenderWidgetHostImpl* render_widget_host_;
324 335
325 // This is true when we are currently painting and thus should handle extra 336 // This is true when we are currently painting and thus should handle extra
326 // paint requests by expanding the invalid rect rather than actually painting. 337 // paint requests by expanding the invalid rect rather than actually painting.
(...skipping 24 matching lines...) Expand all
351 ui::TextInputType text_input_type_; 362 ui::TextInputType text_input_type_;
352 bool can_compose_inline_; 363 bool can_compose_inline_;
353 364
354 typedef std::map<gfx::PluginWindowHandle, AcceleratedPluginView*> 365 typedef std::map<gfx::PluginWindowHandle, AcceleratedPluginView*>
355 PluginViewMap; 366 PluginViewMap;
356 PluginViewMap plugin_views_; // Weak values. 367 PluginViewMap plugin_views_; // Weak values.
357 368
358 // Helper class for managing instances of accelerated plug-ins. 369 // Helper class for managing instances of accelerated plug-ins.
359 AcceleratedSurfaceContainerManagerMac plugin_container_manager_; 370 AcceleratedSurfaceContainerManagerMac plugin_container_manager_;
360 371
372 scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_;
373
361 private: 374 private:
362 friend class content::RenderWidgetHostView; 375 friend class content::RenderWidgetHostView;
363 376
364 // The view will associate itself with the given widget. The native view must 377 // The view will associate itself with the given widget. The native view must
365 // be hooked up immediately to the view hierarchy, or else when it is 378 // be hooked up immediately to the view hierarchy, or else when it is
366 // deleted it will delete this out from under the caller. 379 // deleted it will delete this out from under the caller.
367 explicit RenderWidgetHostViewMac(content::RenderWidgetHost* widget); 380 explicit RenderWidgetHostViewMac(content::RenderWidgetHost* widget);
368 381
369 // If the window is at the root of the plugin container hierachy,
370 // we need to update the geometry manually.
371 void UpdatePluginGeometry(gfx::PluginWindowHandle window,
372 int32 width,
373 int32 height);
374
375 // Returns whether this render view is a popup (autocomplete window). 382 // Returns whether this render view is a popup (autocomplete window).
376 bool IsPopup() const; 383 bool IsPopup() const;
377 384
378 // Updates the display cursor if the current event is over the view's window. 385 // Updates the display cursor if the current event is over the view's window.
379 void UpdateCursorIfNecessary(); 386 void UpdateCursorIfNecessary();
380 387
381 // Shuts down the render_widget_host_. This is a separate function so we can 388 // Shuts down the render_widget_host_. This is a separate function so we can
382 // invoke it from the message loop. 389 // invoke it from the message loop.
383 void ShutdownHost(); 390 void ShutdownHost();
384 391
(...skipping 12 matching lines...) Expand all
397 404
398 // The text to be shown in the tooltip, supplied by the renderer. 405 // The text to be shown in the tooltip, supplied by the renderer.
399 string16 tooltip_text_; 406 string16 tooltip_text_;
400 407
401 // Factory used to safely scope delayed calls to ShutdownHost(). 408 // Factory used to safely scope delayed calls to ShutdownHost().
402 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; 409 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_;
403 410
404 // selected text on the renderer. 411 // selected text on the renderer.
405 std::string selected_text_; 412 std::string selected_text_;
406 413
407 bool accelerated_compositing_active_; 414 gfx::PluginWindowHandle compositing_surface_;
408 415
409 // When rendering transitions from gpu to software, the gpu widget can't be 416 // List of pending swaps for deferred acking:
410 // hidden until the software backing store has been updated. This variable is 417 // pairs of (route_id, gpu_host_id).
411 // set when the gpu widget needs to be hidden once a paint is completed. 418 std::list<std::pair<int32, int32> > pending_swap_buffers_acks_;
412 bool needs_gpu_visibility_update_after_repaint_;
413
414 gfx::PluginWindowHandle compositing_surface_;
415 419
416 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); 420 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
417 }; 421 };
418 422
419 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 423 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698