| OLD | NEW |
| 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_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <IOSurface/IOSurfaceAPI.h> | 9 #include <IOSurface/IOSurfaceAPI.h> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/mac/scoped_nsobject.h" | 12 #include "base/mac/scoped_nsobject.h" |
| 13 #include "cc/output/software_frame_data.h" | 13 #include "cc/output/software_frame_data.h" |
| 14 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" | 14 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" |
| 15 #include "content/browser/renderer_host/software_layer_mac.h" | 15 #include "content/browser/renderer_host/software_layer_mac.h" |
| 16 #include "skia/ext/platform_canvas.h" | 16 #include "skia/ext/platform_canvas.h" |
| 17 #include "ui/compositor/compositor.h" | 17 #include "ui/compositor/compositor.h" |
| 18 #include "ui/events/latency_info.h" | 18 #include "ui/events/latency_info.h" |
| 19 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
| 20 | 20 |
| 21 @class BrowserCompositorViewCocoa; | |
| 22 | |
| 23 // Additions to the NSView interface for compositor frames. | 21 // Additions to the NSView interface for compositor frames. |
| 24 @interface NSView (BrowserCompositorView) | 22 @interface NSView (BrowserCompositorView) |
| 25 - (void)gotAcceleratedIOSurfaceFrame:(IOSurfaceID)surface_handle | 23 - (void)gotAcceleratedIOSurfaceFrame:(IOSurfaceID)surface_handle |
| 26 withOutputSurfaceID:(int)surface_id | 24 withOutputSurfaceID:(int)surface_id |
| 27 withLatencyInfo:(std::vector<ui::LatencyInfo>) latency_info | 25 withLatencyInfo:(std::vector<ui::LatencyInfo>) latency_info |
| 28 withPixelSize:(gfx::Size)pixel_size | 26 withPixelSize:(gfx::Size)pixel_size |
| 29 withScaleFactor:(float)scale_factor; | 27 withScaleFactor:(float)scale_factor; |
| 30 | 28 |
| 31 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data | 29 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data |
| 32 withScaleFactor:(float)scale_factor | 30 withScaleFactor:(float)scale_factor |
| 33 withCanvas:(SkCanvas*)canvas; | 31 withCanvas:(SkCanvas*)canvas; |
| 34 @end // NSView (BrowserCompositorView) | 32 @end // NSView (BrowserCompositorView) |
| 35 | 33 |
| 36 | 34 |
| 37 namespace content { | 35 namespace content { |
| 38 | 36 |
| 37 class BrowserCompositorViewMacInternal; |
| 38 |
| 39 // The interface through which BrowserCompositorViewMac calls back into | 39 // The interface through which BrowserCompositorViewMac calls back into |
| 40 // RenderWidgetHostViewMac (or any other structure that wishes to draw a | 40 // RenderWidgetHostViewMac (or any other structure that wishes to draw a |
| 41 // NSView backed by a ui::Compositor). | 41 // NSView backed by a ui::Compositor). |
| 42 class BrowserCompositorViewMacClient { | 42 class BrowserCompositorViewMacClient { |
| 43 public: | 43 public: |
| 44 // Called when a frame is drawn, and used to pass latency info back to the | 44 // Called when a frame is drawn, and used to pass latency info back to the |
| 45 // renderer (if any). | 45 // renderer (if any). |
| 46 virtual void BrowserCompositorViewFrameSwapped( | 46 virtual void BrowserCompositorViewFrameSwapped( |
| 47 const std::vector<ui::LatencyInfo>& latency_info) = 0; | 47 const std::vector<ui::LatencyInfo>& latency_info) = 0; |
| 48 | 48 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 67 ~BrowserCompositorViewMac(); | 67 ~BrowserCompositorViewMac(); |
| 68 | 68 |
| 69 // The ui::Compositor being used to render the NSView. | 69 // The ui::Compositor being used to render the NSView. |
| 70 ui::Compositor* GetCompositor() const; | 70 ui::Compositor* GetCompositor() const; |
| 71 | 71 |
| 72 // The client (used by the BrowserCompositorViewCocoa to access the client). | 72 // The client (used by the BrowserCompositorViewCocoa to access the client). |
| 73 BrowserCompositorViewMacClient* GetClient() const { return client_; } | 73 BrowserCompositorViewMacClient* GetClient() const { return client_; } |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 BrowserCompositorViewMacClient* client_; | 76 BrowserCompositorViewMacClient* client_; |
| 77 base::scoped_nsobject<BrowserCompositorViewCocoa> cocoa_view_; | 77 scoped_ptr<BrowserCompositorViewMacInternal> internal_view_; |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 // A class to keep around whenever a BrowserCompositorViewMac may be created. | 80 // A class to keep around whenever a BrowserCompositorViewMac may be created. |
| 81 // While at least one instance of this class exists, a spare | 81 // While at least one instance of this class exists, a spare |
| 82 // BrowserCompositorViewCocoa will be kept around to be recycled so that the | 82 // BrowserCompositorViewCocoa will be kept around to be recycled so that the |
| 83 // next BrowserCompositorViewMac to be created will be be created quickly. | 83 // next BrowserCompositorViewMac to be created will be be created quickly. |
| 84 class BrowserCompositorViewPlaceholderMac { | 84 class BrowserCompositorViewPlaceholderMac { |
| 85 public: | 85 public: |
| 86 BrowserCompositorViewPlaceholderMac(); | 86 BrowserCompositorViewPlaceholderMac(); |
| 87 ~BrowserCompositorViewPlaceholderMac(); | 87 ~BrowserCompositorViewPlaceholderMac(); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 } // namespace content | 90 } // namespace content |
| 91 | 91 |
| 92 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 92 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
| OLD | NEW |