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

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

Issue 25942002: Make software compositing work on Mac. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows resolve Created 7 years, 1 month 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 7
8 #import <Cocoa/Cocoa.h> 8 #import <Cocoa/Cocoa.h>
9 #include <list> 9 #include <list>
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/mac/scoped_nsobject.h" 15 #include "base/mac/scoped_nsobject.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h" 19 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h"
20 #include "content/browser/renderer_host/render_widget_host_view_base.h" 20 #include "content/browser/renderer_host/render_widget_host_view_base.h"
21 #include "content/browser/renderer_host/software_frame_manager.h"
21 #include "content/common/edit_command.h" 22 #include "content/common/edit_command.h"
22 #import "content/public/browser/render_widget_host_view_mac_base.h" 23 #import "content/public/browser/render_widget_host_view_mac_base.h"
23 #include "ipc/ipc_sender.h" 24 #include "ipc/ipc_sender.h"
24 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 25 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
25 #include "ui/base/cocoa/base_view.h" 26 #include "ui/base/cocoa/base_view.h"
26 #include "webkit/common/cursors/webcursor.h" 27 #include "webkit/common/cursors/webcursor.h"
27 28
28 namespace content { 29 namespace content {
29 class CompositingIOSurfaceMac; 30 class CompositingIOSurfaceMac;
30 class CompositingIOSurfaceContext; 31 class CompositingIOSurfaceContext;
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // to display the data. 190 // to display the data.
190 // 191 //
191 // Comment excerpted from render_widget_host.h: 192 // Comment excerpted from render_widget_host.h:
192 // 193 //
193 // "The lifetime of the RenderWidgetHost* is tied to the render process. 194 // "The lifetime of the RenderWidgetHost* is tied to the render process.
194 // If the render process dies, the RenderWidgetHost* goes away and all 195 // If the render process dies, the RenderWidgetHost* goes away and all
195 // references to it must become NULL." 196 // references to it must become NULL."
196 // 197 //
197 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. 198 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
198 class RenderWidgetHostViewMac : public RenderWidgetHostViewBase, 199 class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
199 public IPC::Sender { 200 public IPC::Sender,
201 public SoftwareFrameManagerClient {
200 public: 202 public:
201 virtual ~RenderWidgetHostViewMac(); 203 virtual ~RenderWidgetHostViewMac();
202 204
203 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } 205 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; }
204 206
205 CONTENT_EXPORT void SetDelegate( 207 CONTENT_EXPORT void SetDelegate(
206 NSObject<RenderWidgetHostViewMacDelegate>* delegate); 208 NSObject<RenderWidgetHostViewMacDelegate>* delegate);
207 void SetAllowOverlappingViews(bool overlapping); 209 void SetAllowOverlappingViews(bool overlapping);
208 210
209 // RenderWidgetHostView implementation. 211 // RenderWidgetHostView implementation.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE; 278 const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE;
277 virtual void CopyFromCompositingSurfaceToVideoFrame( 279 virtual void CopyFromCompositingSurfaceToVideoFrame(
278 const gfx::Rect& src_subrect, 280 const gfx::Rect& src_subrect,
279 const scoped_refptr<media::VideoFrame>& target, 281 const scoped_refptr<media::VideoFrame>& target,
280 const base::Callback<void(bool)>& callback) OVERRIDE; 282 const base::Callback<void(bool)>& callback) OVERRIDE;
281 virtual bool CanCopyToVideoFrame() const OVERRIDE; 283 virtual bool CanCopyToVideoFrame() const OVERRIDE;
282 virtual bool CanSubscribeFrame() const OVERRIDE; 284 virtual bool CanSubscribeFrame() const OVERRIDE;
283 virtual void BeginFrameSubscription( 285 virtual void BeginFrameSubscription(
284 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) OVERRIDE; 286 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) OVERRIDE;
285 virtual void EndFrameSubscription() OVERRIDE; 287 virtual void EndFrameSubscription() OVERRIDE;
288 virtual void OnSwapCompositorFrame(
289 uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) OVERRIDE;
286 virtual void OnAcceleratedCompositingStateChange() OVERRIDE; 290 virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
287 virtual void OnAccessibilityEvents( 291 virtual void OnAccessibilityEvents(
288 const std::vector<AccessibilityHostMsg_EventParams>& params 292 const std::vector<AccessibilityHostMsg_EventParams>& params
289 ) OVERRIDE; 293 ) OVERRIDE;
290 virtual bool PostProcessEventForPluginIme( 294 virtual bool PostProcessEventForPluginIme(
291 const NativeWebKeyboardEvent& event) OVERRIDE; 295 const NativeWebKeyboardEvent& event) OVERRIDE;
292 296
293 virtual void AcceleratedSurfaceBuffersSwapped( 297 virtual void AcceleratedSurfaceBuffersSwapped(
294 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 298 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
295 int gpu_host_id) OVERRIDE; 299 int gpu_host_id) OVERRIDE;
(...skipping 13 matching lines...) Expand all
309 virtual void SetScrollOffsetPinning( 313 virtual void SetScrollOffsetPinning(
310 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE; 314 bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
311 virtual bool LockMouse() OVERRIDE; 315 virtual bool LockMouse() OVERRIDE;
312 virtual void UnlockMouse() OVERRIDE; 316 virtual void UnlockMouse() OVERRIDE;
313 virtual void UnhandledWheelEvent( 317 virtual void UnhandledWheelEvent(
314 const WebKit::WebMouseWheelEvent& event) OVERRIDE; 318 const WebKit::WebMouseWheelEvent& event) OVERRIDE;
315 319
316 // IPC::Sender implementation. 320 // IPC::Sender implementation.
317 virtual bool Send(IPC::Message* message) OVERRIDE; 321 virtual bool Send(IPC::Message* message) OVERRIDE;
318 322
323 // SoftwareFrameManagerClient implementation:
324 virtual void SoftwareFrameWasFreed(
325 uint32 output_surface_id, unsigned frame_id) OVERRIDE;
326 virtual void ReleaseReferencesToSoftwareFrame() OVERRIDE;
327
319 // Forwards the mouse event to the renderer. 328 // Forwards the mouse event to the renderer.
320 void ForwardMouseEvent(const WebKit::WebMouseEvent& event); 329 void ForwardMouseEvent(const WebKit::WebMouseEvent& event);
321 330
322 void KillSelf(); 331 void KillSelf();
323 332
324 void SetTextInputActive(bool active); 333 void SetTextInputActive(bool active);
325 334
326 // Change this view to use CoreAnimation to draw. 335 // Change this view to use CoreAnimation to draw.
327 void EnableCoreAnimation(); 336 void EnableCoreAnimation();
328 337
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 bool can_compose_inline_; 414 bool can_compose_inline_;
406 415
407 base::scoped_nsobject<CALayer> software_layer_; 416 base::scoped_nsobject<CALayer> software_layer_;
408 417
409 // Accelerated compositing structures. These may be dynamically created and 418 // Accelerated compositing structures. These may be dynamically created and
410 // destroyed together in Create/DestroyCompositedIOSurfaceAndLayer. 419 // destroyed together in Create/DestroyCompositedIOSurfaceAndLayer.
411 base::scoped_nsobject<CompositingIOSurfaceLayer> compositing_iosurface_layer_; 420 base::scoped_nsobject<CompositingIOSurfaceLayer> compositing_iosurface_layer_;
412 scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_; 421 scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_;
413 scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_; 422 scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_;
414 423
424 // This holds the current software compositing framebuffer, if any.
425 scoped_ptr<SoftwareFrameManager> software_frame_manager_;
426
415 // Whether to allow overlapping views. 427 // Whether to allow overlapping views.
416 bool allow_overlapping_views_; 428 bool allow_overlapping_views_;
417 429
418 // Whether to use the CoreAnimation path to draw content. 430 // Whether to use the CoreAnimation path to draw content.
419 bool use_core_animation_; 431 bool use_core_animation_;
420 432
421 ui::LatencyInfo software_latency_info_; 433 ui::LatencyInfo software_latency_info_;
422 434
423 NSWindow* pepper_fullscreen_window() const { 435 NSWindow* pepper_fullscreen_window() const {
424 return pepper_fullscreen_window_; 436 return pepper_fullscreen_window_;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // The current composition character range and its bounds. 557 // The current composition character range and its bounds.
546 gfx::Range composition_range_; 558 gfx::Range composition_range_;
547 std::vector<gfx::Rect> composition_bounds_; 559 std::vector<gfx::Rect> composition_bounds_;
548 560
549 // The current caret bounds. 561 // The current caret bounds.
550 gfx::Rect caret_rect_; 562 gfx::Rect caret_rect_;
551 563
552 // Subscriber that listens to frame presentation events. 564 // Subscriber that listens to frame presentation events.
553 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; 565 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
554 566
567 base::WeakPtrFactory<RenderWidgetHostViewMac>
568 software_frame_weak_ptr_factory_;
555 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); 569 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
556 }; 570 };
557 571
558 } // namespace content 572 } // namespace content
559 573
560 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 574 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698