| Index: content/browser/compositor/browser_compositor_view_mac.h
|
| diff --git a/content/browser/compositor/browser_compositor_view_mac.h b/content/browser/compositor/browser_compositor_view_mac.h
|
| index f73c3ac6b9b72eb6d01cb8f4f0e40c4a479e9b57..619aef55eddff458c65bafc4b6e243abac507bf2 100644
|
| --- a/content/browser/compositor/browser_compositor_view_mac.h
|
| +++ b/content/browser/compositor/browser_compositor_view_mac.h
|
| @@ -20,6 +20,7 @@ class BrowserCompositorCALayerTreeMac;
|
| // The interface through which BrowserCompositorViewMac calls back into
|
| // RenderWidgetHostViewMac (or any other structure that wishes to draw a
|
| // NSView backed by a ui::Compositor).
|
| +// TODO(ccameron): This interface should be in the ui namespace.
|
| class BrowserCompositorViewMacClient {
|
| public:
|
| // Drawing is usually throttled by the rate at which CoreAnimation draws
|
| @@ -30,33 +31,29 @@ class BrowserCompositorViewMacClient {
|
| // renderer (if any).
|
| virtual void BrowserCompositorViewFrameSwapped(
|
| const std::vector<ui::LatencyInfo>& latency_info) = 0;
|
| -
|
| - // Used to install the ui::Compositor-backed NSView as a child of its parent
|
| - // view.
|
| - virtual NSView* BrowserCompositorSuperview() = 0;
|
| -
|
| - // Used to install the root ui::Layer into the ui::Compositor.
|
| - virtual ui::Layer* BrowserCompositorRootLayer() = 0;
|
| };
|
|
|
| -// The class to hold a ui::Compositor-backed NSView. Because a ui::Compositor
|
| -// is expensive in terms of resources and re-allocating a ui::Compositor is
|
| -// expensive in terms of work, this class is largely used to manage recycled
|
| -// instances of BrowserCompositorViewCocoa, which actually is a NSView and
|
| -// has a ui::Compositor instance.
|
| +// The class to hold the ui::Compositor which is used to draw a NSView.
|
| +// TODO(ccameron): This should implement an interface in the ui namespace.
|
| class BrowserCompositorViewMac {
|
| public:
|
| // This will install the NSView which is drawn by the ui::Compositor into
|
| - // the NSView provided by the client.
|
| - explicit BrowserCompositorViewMac(BrowserCompositorViewMacClient* client);
|
| + // the NSView provided by the client. Note that |client|, |native_view|, and
|
| + // |ui_root_layer| outlive their BrowserCompositorViewMac object.
|
| + BrowserCompositorViewMac(
|
| + BrowserCompositorViewMacClient* client,
|
| + NSView* native_view,
|
| + ui::Layer* ui_root_layer);
|
| ~BrowserCompositorViewMac();
|
|
|
| + BrowserCompositorViewMacClient* client() const { return client_; }
|
| + NSView* native_view() const { return native_view_; }
|
| + ui::Layer* ui_root_layer() const { return ui_root_layer_; }
|
| +
|
| // The ui::Compositor being used to render the NSView.
|
| + // TODO(ccameron): This should be in the ui namespace interface.
|
| ui::Compositor* GetCompositor() const;
|
|
|
| - // The client (used by the BrowserCompositorViewCocoa to access the client).
|
| - BrowserCompositorViewMacClient* GetClient() const { return client_; }
|
| -
|
| // Return true if the last frame swapped has a size in DIP of |dip_size|.
|
| bool HasFrameOfSize(const gfx::Size& dip_size) const;
|
|
|
| @@ -66,19 +63,16 @@ class BrowserCompositorViewMac {
|
| void BeginPumpingFrames();
|
| void EndPumpingFrames();
|
|
|
| - static void GotAcceleratedFrame(
|
| - gfx::AcceleratedWidget widget,
|
| - uint64 surface_handle, int surface_id,
|
| - const std::vector<ui::LatencyInfo>& latency_info,
|
| - gfx::Size pixel_size, float scale_factor,
|
| - int gpu_host_id, int gpu_route_id);
|
| -
|
| - static void GotSoftwareFrame(
|
| - gfx::AcceleratedWidget widget,
|
| - cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas);
|
| -
|
| private:
|
| BrowserCompositorViewMacClient* client_;
|
| + NSView* native_view_;
|
| + ui::Layer* ui_root_layer_;
|
| +
|
| + // Because a ui::Compositor is expensive in terms of resources and
|
| + // re-allocating a ui::Compositor is expensive in terms of work, this class
|
| + // is largely used to manage recycled instances of
|
| + // BrowserCompositorCALayerTreeMac, which actually has a ui::Compositor
|
| + // instance and modifies the CALayers used to draw the NSView.
|
| scoped_ptr<BrowserCompositorCALayerTreeMac> ca_layer_tree_;
|
| };
|
|
|
|
|