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

Unified Diff: content/browser/compositor/browser_compositor_view_mac.h

Issue 638123003: Prepare to move BrowserCompositorViewMac to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
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..034126be599022a7feee39133fb65e519b8c200f 100644
--- a/content/browser/compositor/browser_compositor_view_mac.h
+++ b/content/browser/compositor/browser_compositor_view_mac.h
@@ -5,6 +5,7 @@
#ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
#define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_
+#include <Cocoa/Cocoa.h>
tapted 2014/10/17 00:04:35 ui/gfx/native_widget_types.h (and NSView -> gfx::N
ccameron 2014/10/17 00:26:53 Actually, the #include turned out not the be neces
#include <vector>
#include "cc/output/software_frame_data.h"
@@ -20,6 +21,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,13 +32,6 @@ 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
@@ -44,19 +39,24 @@ class BrowserCompositorViewMacClient {
// 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.
+// TODO(ccameron): This should implement an interface in the ui namespace.
danakj 2014/10/16 23:38:56 Can you mark which methods would be that interface
ccameron 2014/10/17 00:02:19 Done.
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);
+ explicit BrowserCompositorViewMac(
tapted 2014/10/17 00:04:36 nit: explicit not needed
ccameron 2014/10/17 00:26:53 Done.
+ 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.
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 +66,10 @@ 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_;
tapted 2014/10/17 00:04:36 Thinking if there might be any lifetime issue arou
ccameron 2014/10/17 00:26:53 Done -- added a comment to the ctor.
+ ui::Layer* ui_root_layer_;
scoped_ptr<BrowserCompositorCALayerTreeMac> ca_layer_tree_;
tapted 2014/10/17 00:04:36 is the plan to move this into a subclass of Browse
ccameron 2014/10/17 00:26:53 Yes, exactly. I may go with something to the effec
};

Powered by Google App Engine
This is Rietveld 408576698