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..0c6206520ad947d6678d00ca3d168604ebc6f9c2 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,55 +31,50 @@ 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; |
danakj
2014/10/17 00:30:33
I wanna make sure we're on the right path and i'm
ccameron
2014/10/17 00:40:14
The NSView that owns this will be calling SetSizeA
danakj
2014/10/17 00:44:14
OK. The NSView doesn't exist yet right? I guess it
ccameron
2014/10/17 01:06:38
Ah -- the NSView exists -- this class then goes in
danakj
2014/10/18 18:42:01
OK. Maybe it would make sense to do that messing a
|
- // 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|. |
+ // TODO(ccameron): This should be in the ui namespace interface. |
bool HasFrameOfSize(const gfx::Size& dip_size) const; |
danakj
2014/10/17 00:30:33
Similarly can you give a brief example or handwavi
ccameron
2014/10/17 00:40:13
The frame pumping bit is useful for making sure th
danakj
2014/10/17 00:44:14
OK thanks. Ya I'd add it when we need it.
ccameron
2014/10/17 01:06:38
K -- removed the TODOs for these guys.
|
// Mark a bracket in which new frames are pumped in a restricted nested run |
// loop because the the target window is resizing or because the view is being |
// shown after previously being hidden. |
+ // TODO(ccameron): This should be in the ui namespace interface. |
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_; |
}; |