| Index: content/browser/compositor/browser_compositor_view_private_mac.h
|
| diff --git a/content/browser/compositor/browser_compositor_view_private_mac.h b/content/browser/compositor/browser_compositor_view_private_mac.h
|
| index aba01cafd5085d6f3599696008e5f2bc7d3dbd0e..aaeaed69cc19e8eb0af2d7d3fee5e0f814df261b 100644
|
| --- a/content/browser/compositor/browser_compositor_view_private_mac.h
|
| +++ b/content/browser/compositor/browser_compositor_view_private_mac.h
|
| @@ -7,17 +7,69 @@
|
|
|
| #include "content/browser/compositor/browser_compositor_view_mac.h"
|
|
|
| +@class BrowserCompositorViewCocoa;
|
| +
|
| namespace content {
|
| -class BrowserCompositorViewCocoaHelper;
|
| -}
|
|
|
| -// An NSView drawn by a ui::Compositor. This structure is expensive to create,
|
| -// because it has a ui::Compositor. As a result, this structure may be recycled
|
| -// across multiple BrowserCompositorViewMac objects.
|
| -@interface BrowserCompositorViewCocoa : NSView {
|
| +// BrowserCompositorViewCocoaClient is the interface through which
|
| +// gfx::NativeWidget (aka NSView aka BrowserCompositorViewCocoa) calls back to
|
| +// BrowserCompositorViewMacInternal.
|
| +class BrowserCompositorViewCocoaClient {
|
| + public:
|
| + virtual void GotAcceleratedIOSurfaceFrame(
|
| + IOSurfaceID io_surface_id,
|
| + int output_surface_id,
|
| + const std::vector<ui::LatencyInfo>& latency_info,
|
| + gfx::Size pixel_size,
|
| + float scale_factor) = 0;
|
| +
|
| + virtual void GotSoftwareFrame(
|
| + cc::SoftwareFrameData* frame_data,
|
| + float scale_factor,
|
| + SkCanvas* canvas) = 0;
|
| +};
|
| +
|
| +// BrowserCompositorViewMacInternal owns a NSView and a ui::Compositor that
|
| +// draws that view.
|
| +class BrowserCompositorViewMacInternal
|
| + : public BrowserCompositorViewCocoaClient,
|
| + public CompositingIOSurfaceLayerClient {
|
| + public:
|
| + BrowserCompositorViewMacInternal();
|
| + virtual ~BrowserCompositorViewMacInternal();
|
| +
|
| + void SetClient(BrowserCompositorViewMacClient* client);
|
| + void ResetClient();
|
| +
|
| + ui::Compositor* compositor() const { return compositor_.get(); }
|
| +
|
| + private:
|
| + // BrowserCompositorViewCocoaClient implementation:
|
| + virtual void GotAcceleratedIOSurfaceFrame(
|
| + IOSurfaceID io_surface_id,
|
| + int output_surface_id,
|
| + const std::vector<ui::LatencyInfo>& latency_info,
|
| + gfx::Size pixel_size,
|
| + float scale_factor) OVERRIDE;
|
| + virtual void GotSoftwareFrame(
|
| + cc::SoftwareFrameData* frame_data,
|
| + float scale_factor,
|
| + SkCanvas* canvas) OVERRIDE;
|
| +
|
| + // CompositingIOSurfaceLayerClient implementation:
|
| + virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE;
|
| +
|
| + // The client of the BrowserCompositorViewMac that is using this as its
|
| + // internals.
|
| + BrowserCompositorViewMacClient* client_;
|
| +
|
| + // The compositor drawing the contents of |cooca_view_|.
|
| scoped_ptr<ui::Compositor> compositor_;
|
|
|
| - // The layer hosted by this view.
|
| + // The NSView drawn by the |compositor_|
|
| + base::scoped_nsobject<BrowserCompositorViewCocoa> cocoa_view_;
|
| +
|
| + // The layer hosted by cocoa_view_.
|
| base::scoped_nsobject<CALayer> background_layer_;
|
|
|
| // A flipped layer, which acts as the parent of the compositing and software
|
| @@ -33,48 +85,21 @@ class BrowserCompositorViewCocoaHelper;
|
| std::vector<ui::LatencyInfo> accelerated_latency_info_;
|
|
|
| base::scoped_nsobject<SoftwareLayer> software_layer_;
|
| +};
|
|
|
| - content::BrowserCompositorViewMacClient* client_;
|
| - scoped_ptr<content::BrowserCompositorViewCocoaHelper> helper_;
|
| -}
|
| -
|
| -// Change the client and superview of the view. If this is set to NULL then
|
| -// the compositor will be prepared to be recycled.
|
| -- (void)setClient:(content::BrowserCompositorViewMacClient*)client;
|
| -
|
| -// This is called to destroy the underlying ui::Compositor, if it is known
|
| -// that this will not be recycled again.
|
| -- (void)destroyCompositor;
|
| -
|
| -// Access the underlying ui::Compositor for this view.
|
| -- (ui::Compositor*)compositor;
|
| -
|
| -// Called when the accelerated or software layer draws its frame to the screen.
|
| -- (void)layerDidDrawFrame;
|
| -
|
| -// Called when an error is encountered while drawing to the screen.
|
| -- (void)gotAcceleratedLayerError;
|
| -
|
| -@end // BrowserCompositorViewCocoa
|
| -
|
| -namespace content {
|
| -
|
| -// This class implements the parts of BrowserCompositorViewCocoa that need to
|
| -// be a C++ class and not an Objective C class.
|
| -class BrowserCompositorViewCocoaHelper
|
| - : public content::CompositingIOSurfaceLayerClient {
|
| - public:
|
| - BrowserCompositorViewCocoaHelper(BrowserCompositorViewCocoa* view)
|
| - : view_(view) {}
|
| - virtual ~BrowserCompositorViewCocoaHelper() {}
|
| +} // namespace content
|
|
|
| - private:
|
| - // CompositingIOSurfaceLayerClient implementation:
|
| - virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE;
|
| +// BrowserCompositorViewCocoa is the actual NSView to which the layers drawn
|
| +// by the ui::Compositor are attached.
|
| +@interface BrowserCompositorViewCocoa : NSView {
|
| + content::BrowserCompositorViewCocoaClient* client_;
|
| +}
|
|
|
| - BrowserCompositorViewCocoa* view_;
|
| -};
|
| +- (id)initWithClient:(content::BrowserCompositorViewCocoaClient*)client;
|
|
|
| -} // namespace content
|
| +// Mark that the client provided at initialization is no longer valid and may
|
| +// not be called back into.
|
| +- (void)resetClient;
|
| +@end
|
|
|
| #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_
|
|
|