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

Side by Side Diff: content/browser/compositor/browser_compositor_ca_layer_tree_mac.h

Issue 638123003: Prepare to move BrowserCompositorViewMac to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use __OBJC__ 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_ 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_
6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_ 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_
7 7
8 #include <IOSurface/IOSurfaceAPI.h> 8 #include <IOSurface/IOSurfaceAPI.h>
9 9
10 #include "content/browser/compositor/browser_compositor_view_mac.h"
11
12 #if defined(__OBJC__)
13 #include <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h" 14 #include "base/mac/scoped_nsobject.h"
11 #include "content/browser/compositor/browser_compositor_view_mac.h"
12 #include "content/browser/compositor/io_surface_layer_mac.h" 15 #include "content/browser/compositor/io_surface_layer_mac.h"
13 #include "content/browser/compositor/software_layer_mac.h" 16 #include "content/browser/compositor/software_layer_mac.h"
14 #include "ui/base/cocoa/remote_layer_api.h" 17 #include "ui/base/cocoa/remote_layer_api.h"
18 #endif // __OBJC__
15 19
16 namespace content { 20 namespace content {
17 21
22 #if defined(__OBJC__)
23
18 // BrowserCompositorCALayerTreeMac owns tree of CALayer and a ui::Compositor 24 // BrowserCompositorCALayerTreeMac owns tree of CALayer and a ui::Compositor
19 // that is used to draw the layers. The CALayer tree can be attached to the 25 // that is used to draw the layers. The CALayer tree can be attached to the
20 // NSView of a BrowserCompositorViewMac 26 // NSView of a BrowserCompositorViewMac
21 class BrowserCompositorCALayerTreeMac 27 class BrowserCompositorCALayerTreeMac
22 : public IOSurfaceLayerClient { 28 : public IOSurfaceLayerClient {
23 public: 29 public:
24 BrowserCompositorCALayerTreeMac(); 30 BrowserCompositorCALayerTreeMac();
25 virtual ~BrowserCompositorCALayerTreeMac(); 31 virtual ~BrowserCompositorCALayerTreeMac();
26 static BrowserCompositorCALayerTreeMac* FromAcceleratedWidget( 32 static BrowserCompositorCALayerTreeMac* FromAcceleratedWidget(
27 gfx::AcceleratedWidget widget); 33 gfx::AcceleratedWidget widget);
28 34
29 void SetClient(BrowserCompositorViewMacClient* client); 35 void SetView(BrowserCompositorViewMac* view);
30 void ResetClient(); 36 void ResetView();
31 37
32 ui::Compositor* compositor() const { return compositor_.get(); } 38 ui::Compositor* compositor() const { return compositor_.get(); }
33 39
34 // Return true if the last frame swapped has a size in DIP of |dip_size|. 40 // Return true if the last frame swapped has a size in DIP of |dip_size|.
35 bool HasFrameOfSize(const gfx::Size& dip_size) const; 41 bool HasFrameOfSize(const gfx::Size& dip_size) const;
36 42
37 // Return the CGL renderer ID for the surface, if one is available. 43 // Return the CGL renderer ID for the surface, if one is available.
38 int GetRendererID() const; 44 int GetRendererID() const;
39 45
40 // Return true if the renderer should not be throttled by GPU back-pressure. 46 // Return true if the renderer should not be throttled by GPU back-pressure.
(...skipping 27 matching lines...) Expand all
68 // Remove a layer from the heirarchy and destroy it. Because the accelerated 74 // Remove a layer from the heirarchy and destroy it. Because the accelerated
69 // layer types may be replaced by a layer of the same type, the layer to 75 // layer types may be replaced by a layer of the same type, the layer to
70 // destroy is parameterized, and, if it is the current layer, the current 76 // destroy is parameterized, and, if it is the current layer, the current
71 // layer is reset. 77 // layer is reset.
72 void DestroyCAContextLayer( 78 void DestroyCAContextLayer(
73 base::scoped_nsobject<CALayerHost> ca_context_layer); 79 base::scoped_nsobject<CALayerHost> ca_context_layer);
74 void DestroyIOSurfaceLayer( 80 void DestroyIOSurfaceLayer(
75 base::scoped_nsobject<IOSurfaceLayer> io_surface_layer); 81 base::scoped_nsobject<IOSurfaceLayer> io_surface_layer);
76 void DestroySoftwareLayer(); 82 void DestroySoftwareLayer();
77 83
78 // The client of the BrowserCompositorViewMac that is using this as its 84 // The BrowserCompositorViewMac that is using this as its internals.
79 // internals. 85 BrowserCompositorViewMac* view_;
80 BrowserCompositorViewMacClient* client_;
81 86
82 // A phony NSView handle used to identify this. 87 // A phony NSView handle used to identify this.
83 gfx::AcceleratedWidget native_widget_; 88 gfx::AcceleratedWidget native_widget_;
84 89
85 // The compositor drawing the contents of this view. 90 // The compositor drawing the contents of this view.
86 scoped_ptr<ui::Compositor> compositor_; 91 scoped_ptr<ui::Compositor> compositor_;
87 92
88 // A flipped layer, which acts as the parent of the compositing and software 93 // A flipped layer, which acts as the parent of the compositing and software
89 // layers. This layer is flipped so that the we don't need to recompute the 94 // layers. This layer is flipped so that the we don't need to recompute the
90 // origin for sub-layers when their position changes (this is impossible when 95 // origin for sub-layers when their position changes (this is impossible when
(...skipping 15 matching lines...) Expand all
106 // The output surface and latency info of the last accelerated surface that 111 // The output surface and latency info of the last accelerated surface that
107 // was swapped. Sent back to the renderer when the accelerated surface is 112 // was swapped. Sent back to the renderer when the accelerated surface is
108 // drawn. 113 // drawn.
109 int accelerated_output_surface_id_; 114 int accelerated_output_surface_id_;
110 std::vector<ui::LatencyInfo> accelerated_latency_info_; 115 std::vector<ui::LatencyInfo> accelerated_latency_info_;
111 116
112 // The size in DIP of the last swap received from |compositor_|. 117 // The size in DIP of the last swap received from |compositor_|.
113 gfx::Size last_swap_size_dip_; 118 gfx::Size last_swap_size_dip_;
114 }; 119 };
115 120
121 #endif // __OBJC__
122
123 void BrowserCompositorCALayerTreeMacGotAcceleratedFrame(
124 gfx::AcceleratedWidget widget,
125 uint64 surface_handle, int surface_id,
126 const std::vector<ui::LatencyInfo>& latency_info,
127 gfx::Size pixel_size, float scale_factor,
128 bool* disable_throttling, int* renderer_id);
129
130 void BrowserCompositorCALayerTreeMacGotSoftwareFrame(
131 gfx::AcceleratedWidget widget,
132 cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas);
133
116 } // namespace content 134 } // namespace content
117 135
118 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_ 136 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698