diff options
author | ccameron <ccameron@chromium.org> | 2014-09-30 18:09:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-01 01:10:27 +0000 |
commit | 649349bc12f2bf8e254dd9fb3b3c70ff18fbb325 (patch) | |
tree | 70854b987259da0d27775651521a2903dfe1bc37 | |
parent | b97abf827d0e9576951364fa86c58561e5530de9 (diff) | |
download | chromium_src-649349bc12f2bf8e254dd9fb3b3c70ff18fbb325.zip chromium_src-649349bc12f2bf8e254dd9fb3b3c70ff18fbb325.tar.gz chromium_src-649349bc12f2bf8e254dd9fb3b3c70ff18fbb325.tar.bz2 |
Mass-rename of CompositingIOSurface types
Change CompositingIOSurfaceMac to IOSurface
Change CompositingIOSurfaceContext to IOSurfaceContext.
Change BrowserCompositorViewInternalsMac to
BrowserCompositorCALayerTree (as it is claimed to be in the docs).
Change the "window number" in IOSurfaceContext to the "type" since
there is no "window number" post-CoreAnimation.
Move files to browser/compositor, as they are only used by the
IOSurfaceLayer structure in browser/compositor.
All changes should be aesthetic only -- functional cleanup is coming
next.
BUG=
Review URL: https://codereview.chromium.org/618153002
Cr-Commit-Position: refs/heads/master@{#297569}
-rw-r--r-- | content/browser/compositor/browser_compositor_ca_layer_tree_mac.h (renamed from content/browser/compositor/browser_compositor_view_private_mac.h) | 19 | ||||
-rw-r--r-- | content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm (renamed from content/browser/compositor/browser_compositor_view_private_mac.mm) | 44 | ||||
-rw-r--r-- | content/browser/compositor/browser_compositor_view_mac.h | 4 | ||||
-rw-r--r-- | content/browser/compositor/browser_compositor_view_mac.mm | 70 | ||||
-rw-r--r-- | content/browser/compositor/io_surface_context_mac.h (renamed from content/browser/renderer_host/compositing_iosurface_context_mac.h) | 49 | ||||
-rw-r--r-- | content/browser/compositor/io_surface_context_mac.mm (renamed from content/browser/renderer_host/compositing_iosurface_context_mac.mm) | 79 | ||||
-rw-r--r-- | content/browser/compositor/io_surface_layer_mac.h | 14 | ||||
-rw-r--r-- | content/browser/compositor/io_surface_layer_mac.mm | 14 | ||||
-rw-r--r-- | content/browser/compositor/io_surface_texture_mac.h (renamed from content/browser/renderer_host/compositing_iosurface_mac.h) | 71 | ||||
-rw-r--r-- | content/browser/compositor/io_surface_texture_mac.mm (renamed from content/browser/renderer_host/compositing_iosurface_mac.mm) | 70 | ||||
-rw-r--r-- | content/content_browser.gypi | 12 |
11 files changed, 205 insertions, 241 deletions
diff --git a/content/browser/compositor/browser_compositor_view_private_mac.h b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.h index 696f02f..e4157b0 100644 --- a/content/browser/compositor/browser_compositor_view_private_mac.h +++ b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ -#define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ +#ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_ +#define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_ #include <IOSurface/IOSurfaceAPI.h> @@ -15,14 +15,15 @@ namespace content { -// BrowserCompositorViewMacInternal owns a NSView and a ui::Compositor that -// draws that view. -class BrowserCompositorViewMacInternal +// BrowserCompositorCALayerTreeMac owns tree of CALayer and a ui::Compositor +// that is used to draw the layers. The CALayer tree can be attached to the +// NSView of a BrowserCompositorViewMac +class BrowserCompositorCALayerTreeMac : public IOSurfaceLayerClient { public: - BrowserCompositorViewMacInternal(); - virtual ~BrowserCompositorViewMacInternal(); - static BrowserCompositorViewMacInternal* FromAcceleratedWidget( + BrowserCompositorCALayerTreeMac(); + virtual ~BrowserCompositorCALayerTreeMac(); + static BrowserCompositorCALayerTreeMac* FromAcceleratedWidget( gfx::AcceleratedWidget widget); void SetClient(BrowserCompositorViewMacClient* client); @@ -111,4 +112,4 @@ private: } // namespace content -#endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_PRIVATE_MAC_H_ +#endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_CA_LAYER_TREE_MAC_H_ diff --git a/content/browser/compositor/browser_compositor_view_private_mac.mm b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm index 913b4b0..f746701 100644 --- a/content/browser/compositor/browser_compositor_view_private_mac.mm +++ b/content/browser/compositor/browser_compositor_ca_layer_tree_mac.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/compositor/browser_compositor_view_private_mac.h" +#include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" #include <map> @@ -22,16 +22,16 @@ namespace content { namespace { -typedef std::map<gfx::AcceleratedWidget,BrowserCompositorViewMacInternal*> +typedef std::map<gfx::AcceleratedWidget,BrowserCompositorCALayerTreeMac*> WidgetToInternalsMap; base::LazyInstance<WidgetToInternalsMap> g_widget_to_internals_map; } //////////////////////////////////////////////////////////////////////////////// -// BrowserCompositorViewMacInternal +// BrowserCompositorCALayerTreeMac -BrowserCompositorViewMacInternal::BrowserCompositorViewMacInternal() +BrowserCompositorCALayerTreeMac::BrowserCompositorCALayerTreeMac() : client_(NULL), accelerated_output_surface_id_(0) { // Disable the fade-in animation as the layers are added. @@ -63,12 +63,12 @@ BrowserCompositorViewMacInternal::BrowserCompositorViewMacInternal() compositor_->SetVisible(false); } -BrowserCompositorViewMacInternal::~BrowserCompositorViewMacInternal() { +BrowserCompositorCALayerTreeMac::~BrowserCompositorCALayerTreeMac() { DCHECK(!client_); g_widget_to_internals_map.Pointer()->erase(native_widget_); } -void BrowserCompositorViewMacInternal::SetClient( +void BrowserCompositorCALayerTreeMac::SetClient( BrowserCompositorViewMacClient* client) { // Disable the fade-in animation as the view is added. ScopedCAActionDisabler disabler; @@ -84,7 +84,7 @@ void BrowserCompositorViewMacInternal::SetClient( compositor_->SetVisible(true); } -void BrowserCompositorViewMacInternal::ResetClient() { +void BrowserCompositorCALayerTreeMac::ResetClient() { if (!client_) return; @@ -105,26 +105,26 @@ void BrowserCompositorViewMacInternal::ResetClient() { client_ = NULL; } -bool BrowserCompositorViewMacInternal::HasFrameOfSize( +bool BrowserCompositorCALayerTreeMac::HasFrameOfSize( const gfx::Size& dip_size) const { return last_swap_size_dip_ == dip_size; } -int BrowserCompositorViewMacInternal::GetRendererID() const { +int BrowserCompositorCALayerTreeMac::GetRendererID() const { if (io_surface_layer_) return [io_surface_layer_ rendererID]; return 0; } -void BrowserCompositorViewMacInternal::BeginPumpingFrames() { +void BrowserCompositorCALayerTreeMac::BeginPumpingFrames() { [io_surface_layer_ beginPumpingFrames]; } -void BrowserCompositorViewMacInternal::EndPumpingFrames() { +void BrowserCompositorCALayerTreeMac::EndPumpingFrames() { [io_surface_layer_ endPumpingFrames]; } -void BrowserCompositorViewMacInternal::GotAcceleratedFrame( +void BrowserCompositorCALayerTreeMac::GotAcceleratedFrame( uint64 surface_handle, int output_surface_id, const std::vector<ui::LatencyInfo>& latency_info, gfx::Size pixel_size, float scale_factor) { @@ -161,7 +161,7 @@ void BrowserCompositorViewMacInternal::GotAcceleratedFrame( } } -void BrowserCompositorViewMacInternal::GotAcceleratedCAContextFrame( +void BrowserCompositorCALayerTreeMac::GotAcceleratedCAContextFrame( CAContextID ca_context_id, gfx::Size pixel_size, float scale_factor) { @@ -194,7 +194,7 @@ void BrowserCompositorViewMacInternal::GotAcceleratedCAContextFrame( DestroySoftwareLayer(); } -void BrowserCompositorViewMacInternal::GotAcceleratedIOSurfaceFrame( +void BrowserCompositorCALayerTreeMac::GotAcceleratedIOSurfaceFrame( IOSurfaceID io_surface_id, gfx::Size pixel_size, float scale_factor) { @@ -264,7 +264,7 @@ void BrowserCompositorViewMacInternal::GotAcceleratedIOSurfaceFrame( DestroySoftwareLayer(); } -void BrowserCompositorViewMacInternal::GotSoftwareFrame( +void BrowserCompositorCALayerTreeMac::GotSoftwareFrame( cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas) { @@ -296,7 +296,7 @@ void BrowserCompositorViewMacInternal::GotSoftwareFrame( DestroyIOSurfaceLayer(io_surface_layer_); } -void BrowserCompositorViewMacInternal::DestroyCAContextLayer( +void BrowserCompositorCALayerTreeMac::DestroyCAContextLayer( base::scoped_nsobject<CALayerHost> ca_context_layer) { if (!ca_context_layer) return; @@ -305,7 +305,7 @@ void BrowserCompositorViewMacInternal::DestroyCAContextLayer( ca_context_layer_.reset(); } -void BrowserCompositorViewMacInternal::DestroyIOSurfaceLayer( +void BrowserCompositorCALayerTreeMac::DestroyIOSurfaceLayer( base::scoped_nsobject<IOSurfaceLayer> io_surface_layer) { if (!io_surface_layer) return; @@ -315,14 +315,14 @@ void BrowserCompositorViewMacInternal::DestroyIOSurfaceLayer( io_surface_layer_.reset(); } -void BrowserCompositorViewMacInternal::DestroySoftwareLayer() { +void BrowserCompositorCALayerTreeMac::DestroySoftwareLayer() { if (!software_layer_) return; [software_layer_ removeFromSuperlayer]; software_layer_.reset(); } -bool BrowserCompositorViewMacInternal::IOSurfaceLayerShouldAckImmediately() +bool BrowserCompositorCALayerTreeMac::IOSurfaceLayerShouldAckImmediately() const { // If there is no client then the accelerated layer is not in the hierarchy // and will never draw. @@ -331,7 +331,7 @@ bool BrowserCompositorViewMacInternal::IOSurfaceLayerShouldAckImmediately() return client_->BrowserCompositorViewShouldAckImmediately(); } -void BrowserCompositorViewMacInternal::IOSurfaceLayerDidDrawFrame() { +void BrowserCompositorCALayerTreeMac::IOSurfaceLayerDidDrawFrame() { if (accelerated_output_surface_id_) { content::ImageTransportFactory::GetInstance()->OnSurfaceDisplayed( accelerated_output_surface_id_); @@ -344,7 +344,7 @@ void BrowserCompositorViewMacInternal::IOSurfaceLayerDidDrawFrame() { accelerated_latency_info_.clear(); } -void BrowserCompositorViewMacInternal::IOSurfaceLayerHitError() { +void BrowserCompositorCALayerTreeMac::IOSurfaceLayerHitError() { // Perform all acks that would have been done if the frame had succeeded, to // un-block the compositor and renderer. IOSurfaceLayerDidDrawFrame(); @@ -355,7 +355,7 @@ void BrowserCompositorViewMacInternal::IOSurfaceLayerHitError() { } // static -BrowserCompositorViewMacInternal* BrowserCompositorViewMacInternal:: +BrowserCompositorCALayerTreeMac* BrowserCompositorCALayerTreeMac:: FromAcceleratedWidget(gfx::AcceleratedWidget widget) { WidgetToInternalsMap::const_iterator found = g_widget_to_internals_map.Pointer()->find(widget); diff --git a/content/browser/compositor/browser_compositor_view_mac.h b/content/browser/compositor/browser_compositor_view_mac.h index e6019c3..f73c3ac 100644 --- a/content/browser/compositor/browser_compositor_view_mac.h +++ b/content/browser/compositor/browser_compositor_view_mac.h @@ -15,7 +15,7 @@ namespace content { -class BrowserCompositorViewMacInternal; +class BrowserCompositorCALayerTreeMac; // The interface through which BrowserCompositorViewMac calls back into // RenderWidgetHostViewMac (or any other structure that wishes to draw a @@ -79,7 +79,7 @@ class BrowserCompositorViewMac { private: BrowserCompositorViewMacClient* client_; - scoped_ptr<BrowserCompositorViewMacInternal> internal_view_; + scoped_ptr<BrowserCompositorCALayerTreeMac> ca_layer_tree_; }; // A class to keep around whenever a BrowserCompositorViewMac may be created. diff --git a/content/browser/compositor/browser_compositor_view_mac.mm b/content/browser/compositor/browser_compositor_view_mac.mm index 00fe0f5..b99f173 100644 --- a/content/browser/compositor/browser_compositor_view_mac.mm +++ b/content/browser/compositor/browser_compositor_view_mac.mm @@ -7,7 +7,7 @@ #include "base/debug/trace_event.h" #include "base/lazy_instance.h" #include "content/browser/gpu/gpu_process_host_ui_shim.h" -#include "content/browser/compositor/browser_compositor_view_private_mac.h" +#include "content/browser/compositor/browser_compositor_ca_layer_tree_mac.h" #include "content/common/gpu/gpu_messages.h" //////////////////////////////////////////////////////////////////////////////// @@ -17,60 +17,60 @@ namespace content { namespace { // The number of placeholder objects allocated. If this reaches zero, then -// the BrowserCompositorViewMacInternal being held on to for recycling, -// |g_recyclable_internal_view|, will be freed. +// the BrowserCompositorCALayerTreeMac being held on to for recycling, +// |g_recyclable_ca_layer_tree|, will be freed. uint32 g_placeholder_count = 0; -// A spare BrowserCompositorViewMacInternal kept around for recycling. -base::LazyInstance<scoped_ptr<BrowserCompositorViewMacInternal>> - g_recyclable_internal_view; +// A spare BrowserCompositorCALayerTreeMac kept around for recycling. +base::LazyInstance<scoped_ptr<BrowserCompositorCALayerTreeMac>> + g_recyclable_ca_layer_tree; } // namespace BrowserCompositorViewMac::BrowserCompositorViewMac( BrowserCompositorViewMacClient* client) : client_(client) { - // Try to use the recyclable BrowserCompositorViewMacInternal if there is one, + // Try to use the recyclable BrowserCompositorCALayerTreeMac if there is one, // otherwise allocate a new one. // TODO(ccameron): If there exists a frame in flight (swap has been called // by the compositor, but the frame has not arrived from the GPU process // yet), then that frame may inappropriately flash in the new view. - internal_view_ = g_recyclable_internal_view.Get().Pass(); - if (!internal_view_) - internal_view_.reset(new BrowserCompositorViewMacInternal); - internal_view_->SetClient(client_); + ca_layer_tree_ = g_recyclable_ca_layer_tree.Get().Pass(); + if (!ca_layer_tree_) + ca_layer_tree_.reset(new BrowserCompositorCALayerTreeMac); + ca_layer_tree_->SetClient(client_); } BrowserCompositorViewMac::~BrowserCompositorViewMac() { - // Make this BrowserCompositorViewMacInternal recyclable for future instances. - internal_view_->ResetClient(); - g_recyclable_internal_view.Get() = internal_view_.Pass(); + // Make this BrowserCompositorCALayerTreeMac recyclable for future instances. + ca_layer_tree_->ResetClient(); + g_recyclable_ca_layer_tree.Get() = ca_layer_tree_.Pass(); // If there are no placeholders allocated, destroy the recyclable - // BrowserCompositorViewMacInternal that we just populated. + // BrowserCompositorCALayerTreeMac that we just populated. if (!g_placeholder_count) - g_recyclable_internal_view.Get().reset(); + g_recyclable_ca_layer_tree.Get().reset(); } ui::Compositor* BrowserCompositorViewMac::GetCompositor() const { - DCHECK(internal_view_); - return internal_view_->compositor(); + DCHECK(ca_layer_tree_); + return ca_layer_tree_->compositor(); } bool BrowserCompositorViewMac::HasFrameOfSize( const gfx::Size& dip_size) const { - if (internal_view_) - return internal_view_->HasFrameOfSize(dip_size); + if (ca_layer_tree_) + return ca_layer_tree_->HasFrameOfSize(dip_size); return false; } void BrowserCompositorViewMac::BeginPumpingFrames() { - if (internal_view_) - internal_view_->BeginPumpingFrames(); + if (ca_layer_tree_) + ca_layer_tree_->BeginPumpingFrames(); } void BrowserCompositorViewMac::EndPumpingFrames() { - if (internal_view_) - internal_view_->EndPumpingFrames(); + if (ca_layer_tree_) + ca_layer_tree_->EndPumpingFrames(); } // static @@ -80,13 +80,13 @@ void BrowserCompositorViewMac::GotAcceleratedFrame( const std::vector<ui::LatencyInfo>& latency_info, gfx::Size pixel_size, float scale_factor, int gpu_host_id, int gpu_route_id) { - BrowserCompositorViewMacInternal* internal_view = - BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); + BrowserCompositorCALayerTreeMac* ca_layer_tree = + BrowserCompositorCALayerTreeMac::FromAcceleratedWidget(widget); int renderer_id = 0; - if (internal_view) { - internal_view->GotAcceleratedFrame( + if (ca_layer_tree) { + ca_layer_tree->GotAcceleratedFrame( surface_handle, surface_id, latency_info, pixel_size, scale_factor); - renderer_id = internal_view->GetRendererID(); + renderer_id = ca_layer_tree->GetRendererID(); } // Acknowledge the swap, now that it has been processed. @@ -103,10 +103,10 @@ void BrowserCompositorViewMac::GotAcceleratedFrame( void BrowserCompositorViewMac::GotSoftwareFrame( gfx::AcceleratedWidget widget, cc::SoftwareFrameData* frame_data, float scale_factor, SkCanvas* canvas) { - BrowserCompositorViewMacInternal* internal_view = - BrowserCompositorViewMacInternal::FromAcceleratedWidget(widget); - if (internal_view) - internal_view->GotSoftwareFrame(frame_data, scale_factor, canvas); + BrowserCompositorCALayerTreeMac* ca_layer_tree = + BrowserCompositorCALayerTreeMac::FromAcceleratedWidget(widget); + if (ca_layer_tree) + ca_layer_tree->GotSoftwareFrame(frame_data, scale_factor, canvas); } //////////////////////////////////////////////////////////////////////////////// @@ -121,9 +121,9 @@ BrowserCompositorViewPlaceholderMac::~BrowserCompositorViewPlaceholderMac() { g_placeholder_count -= 1; // If there are no placeholders allocated, destroy the recyclable - // BrowserCompositorViewMacInternal. + // BrowserCompositorCALayerTreeMac. if (!g_placeholder_count) - g_recyclable_internal_view.Get().reset(); + g_recyclable_ca_layer_tree.Get().reset(); } } // namespace content diff --git a/content/browser/renderer_host/compositing_iosurface_context_mac.h b/content/browser/compositor/io_surface_context_mac.h index 5468da2..d3662a7 100644 --- a/content/browser/renderer_host/compositing_iosurface_context_mac.h +++ b/content/browser/compositor/io_surface_context_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ -#define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ +#ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ +#define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ #import <AppKit/NSOpenGL.h> #include <OpenGL/OpenGL.h> @@ -19,60 +19,55 @@ namespace content { -class CompositingIOSurfaceContext - : public base::RefCounted<CompositingIOSurfaceContext>, +class IOSurfaceContext + : public base::RefCounted<IOSurfaceContext>, public content::GpuDataManagerObserver { public: - enum { + enum Type { // The number used to look up the context used for async readback and for // initializing the IOSurface. - kOffscreenContextWindowNumber = -2, + kOffscreenContext = -2, // The number used to look up the context used by CAOpenGLLayers. - kCALayerContextWindowNumber = -3, + kCALayerContext = -3, }; - // Get or create a GL context for the specified window with the specified - // surface ordering. Share these GL contexts as much as possible because - // creating and destroying them can be expensive + // Get or create a GL context of the specified type. Share these GL contexts + // as much as possible because creating and destroying them can be expensive. // http://crbug.com/180463 - static scoped_refptr<CompositingIOSurfaceContext> Get(int window_number); + static scoped_refptr<IOSurfaceContext> Get(Type type); // Mark that all the GL contexts in the same sharegroup as this context as // invalid, so they shouldn't be returned anymore by Get, but rather, new // contexts should be created. This is called as a precaution when unexpected - // GL errors occur. + // GL errors occur, or after a GPU switch. void PoisonContextAndSharegroup(); bool HasBeenPoisoned() const { return poisoned_; } CGLContextObj cgl_context() const { return cgl_context_; } - int window_number() const { return window_number_; } // content::GpuDataManagerObserver implementation. virtual void OnGpuSwitching() OVERRIDE; private: - friend class base::RefCounted<CompositingIOSurfaceContext>; + friend class base::RefCounted<IOSurfaceContext>; - CompositingIOSurfaceContext( - int window_number, - base::ScopedTypeRef<CGLContextObj> clg_context_strong, - CGLContextObj clg_context); - virtual ~CompositingIOSurfaceContext(); + IOSurfaceContext( + Type type, + base::ScopedTypeRef<CGLContextObj> clg_context_strong); + virtual ~IOSurfaceContext(); - int window_number_; - base::ScopedTypeRef<CGLContextObj> cgl_context_strong_; - // Weak, backed by |cgl_context_strong_|. - CGLContextObj cgl_context_; + Type type_; + base::ScopedTypeRef<CGLContextObj> cgl_context_; bool poisoned_; // The global map from window number and window ordering to // context data. - typedef std::map<int, CompositingIOSurfaceContext*> WindowMap; - static base::LazyInstance<WindowMap> window_map_; - static WindowMap* window_map(); + typedef std::map<Type, IOSurfaceContext*> TypeMap; + static base::LazyInstance<TypeMap> type_map_; + static TypeMap* type_map(); }; } // namespace content -#endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_CONTEXT_MAC_H_ +#endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_CONTEXT_MAC_H_ diff --git a/content/browser/renderer_host/compositing_iosurface_context_mac.mm b/content/browser/compositor/io_surface_context_mac.mm index 5f09792..623d590 100644 --- a/content/browser/renderer_host/compositing_iosurface_context_mac.mm +++ b/content/browser/compositor/io_surface_context_mac.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/renderer_host/compositing_iosurface_context_mac.h" +#include "content/browser/compositor/io_surface_context_mac.h" #include <OpenGL/gl.h> #include <OpenGL/OpenGL.h> @@ -19,19 +19,18 @@ namespace content { // static -scoped_refptr<CompositingIOSurfaceContext> -CompositingIOSurfaceContext::Get(int window_number) { - TRACE_EVENT0("browser", "CompositingIOSurfaceContext::Get"); +scoped_refptr<IOSurfaceContext> +IOSurfaceContext::Get(Type type) { + TRACE_EVENT0("browser", "IOSurfaceContext::Get"); - // Return the context for this window_number, if it exists. - WindowMap::iterator found = window_map()->find(window_number); - if (found != window_map()->end()) { + // Return the context for this type, if it exists. + TypeMap::iterator found = type_map()->find(type); + if (found != type_map()->end()) { DCHECK(!found->second->poisoned_); return found->second; } - base::ScopedTypeRef<CGLContextObj> cgl_context_strong; - CGLContextObj cgl_context = NULL; + base::ScopedTypeRef<CGLContextObj> cgl_context; CGLError error = kCGLNoError; // Create the pixel format object for the context. @@ -56,66 +55,54 @@ CompositingIOSurfaceContext::Get(int window_number) { // Create all contexts in the same share group so that the textures don't // need to be recreated when transitioning contexts. CGLContextObj share_context = NULL; - if (!window_map()->empty()) - share_context = window_map()->begin()->second->cgl_context(); + if (!type_map()->empty()) + share_context = type_map()->begin()->second->cgl_context(); error = CGLCreateContext( - pixel_format, share_context, cgl_context_strong.InitializeInto()); + pixel_format, share_context, cgl_context.InitializeInto()); if (error != kCGLNoError) { LOG(ERROR) << "Failed to create context object."; return NULL; } - cgl_context = cgl_context_strong; - // Note that VSync is ignored because CoreAnimation will automatically - // rate limit draws. - - return new CompositingIOSurfaceContext( - window_number, - cgl_context_strong, - cgl_context); + return new IOSurfaceContext(type, cgl_context); } -void CompositingIOSurfaceContext::PoisonContextAndSharegroup() { +void IOSurfaceContext::PoisonContextAndSharegroup() { if (poisoned_) return; - for (WindowMap::iterator it = window_map()->begin(); - it != window_map()->end(); + for (TypeMap::iterator it = type_map()->begin(); + it != type_map()->end(); ++it) { it->second->poisoned_ = true; } - window_map()->clear(); + type_map()->clear(); } -CompositingIOSurfaceContext::CompositingIOSurfaceContext( - int window_number, - base::ScopedTypeRef<CGLContextObj> cgl_context_strong, - CGLContextObj cgl_context) - : window_number_(window_number), - cgl_context_strong_(cgl_context_strong), - cgl_context_(cgl_context), - poisoned_(false) { - DCHECK(window_map()->find(window_number_) == window_map()->end()); - window_map()->insert(std::make_pair(window_number_, this)); +IOSurfaceContext::IOSurfaceContext( + Type type, base::ScopedTypeRef<CGLContextObj> cgl_context) + : type_(type), cgl_context_(cgl_context), poisoned_(false) { + DCHECK(type_map()->find(type_) == type_map()->end()); + type_map()->insert(std::make_pair(type_, this)); GpuDataManager::GetInstance()->AddObserver(this); } -CompositingIOSurfaceContext::~CompositingIOSurfaceContext() { +IOSurfaceContext::~IOSurfaceContext() { GpuDataManager::GetInstance()->RemoveObserver(this); if (!poisoned_) { - DCHECK(window_map()->find(window_number_) != window_map()->end()); - DCHECK(window_map()->find(window_number_)->second == this); - window_map()->erase(window_number_); + DCHECK(type_map()->find(type_) != type_map()->end()); + DCHECK(type_map()->find(type_)->second == this); + type_map()->erase(type_); } else { - WindowMap::const_iterator found = window_map()->find(window_number_); - if (found != window_map()->end()) + TypeMap::const_iterator found = type_map()->find(type_); + if (found != type_map()->end()) DCHECK(found->second != this); } } -void CompositingIOSurfaceContext::OnGpuSwitching() { +void IOSurfaceContext::OnGpuSwitching() { // Recreate all browser-side GL contexts whenever the GPU switches. If this // is not done, performance will suffer. // http://crbug.com/361493 @@ -123,13 +110,13 @@ void CompositingIOSurfaceContext::OnGpuSwitching() { } // static -CompositingIOSurfaceContext::WindowMap* - CompositingIOSurfaceContext::window_map() { - return window_map_.Pointer(); +IOSurfaceContext::TypeMap* + IOSurfaceContext::type_map() { + return type_map_.Pointer(); } // static -base::LazyInstance<CompositingIOSurfaceContext::WindowMap> - CompositingIOSurfaceContext::window_map_; +base::LazyInstance<IOSurfaceContext::TypeMap> + IOSurfaceContext::type_map_; } // namespace content diff --git a/content/browser/compositor/io_surface_layer_mac.h b/content/browser/compositor/io_surface_layer_mac.h index 83a6e43..5a218e8 100644 --- a/content/browser/compositor/io_surface_layer_mac.h +++ b/content/browser/compositor/io_surface_layer_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ -#define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ +#ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ +#define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ #import <Cocoa/Cocoa.h> @@ -15,8 +15,8 @@ @class IOSurfaceLayer; namespace content { -class CompositingIOSurfaceMac; -class CompositingIOSurfaceContext; +class IOSurfaceTexture; +class IOSurfaceContext; // The interface through which the IOSurfaceLayer calls back into // the structrue that created it (RenderWidgetHostViewMac or @@ -116,8 +116,8 @@ class IOSurfaceLayerHelper { // The CoreAnimation layer for drawing accelerated content. @interface IOSurfaceLayer : CAOpenGLLayer { @private - scoped_refptr<content::CompositingIOSurfaceMac> iosurface_; - scoped_refptr<content::CompositingIOSurfaceContext> context_; + scoped_refptr<content::IOSurfaceTexture> iosurface_; + scoped_refptr<content::IOSurfaceContext> context_; scoped_ptr<content::IOSurfaceLayerHelper> helper_; } @@ -158,4 +158,4 @@ class IOSurfaceLayerHelper { - (void)endPumpingFrames; @end -#endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_LAYER_MAC_H_ +#endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_LAYER_MAC_H_ diff --git a/content/browser/compositor/io_surface_layer_mac.mm b/content/browser/compositor/io_surface_layer_mac.mm index 357c65e..16fab0e 100644 --- a/content/browser/compositor/io_surface_layer_mac.mm +++ b/content/browser/compositor/io_surface_layer_mac.mm @@ -12,10 +12,10 @@ #include "base/mac/mac_util.h" #include "base/mac/sdk_forward_declarations.h" +#include "content/browser/compositor/io_surface_context_mac.h" +#include "content/browser/compositor/io_surface_texture_mac.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_mac.h" -#include "content/browser/renderer_host/compositing_iosurface_context_mac.h" -#include "content/browser/renderer_host/compositing_iosurface_mac.h" #include "ui/base/cocoa/animation_utils.h" #include "ui/gfx/size_conversions.h" #include "ui/gl/gpu_switching_manager.h" @@ -168,11 +168,11 @@ void IOSurfaceLayerHelper::EndPumpingFrames() { @implementation IOSurfaceLayer -- (content::CompositingIOSurfaceMac*)iosurface { +- (content::IOSurfaceTexture*)iosurface { return iosurface_.get(); } -- (content::CompositingIOSurfaceContext*)context { +- (content::IOSurfaceContext*)context { return context_.get(); } @@ -181,9 +181,9 @@ void IOSurfaceLayerHelper::EndPumpingFrames() { if (self = [super init]) { helper_.reset(new content::IOSurfaceLayerHelper(client, self)); - iosurface_ = content::CompositingIOSurfaceMac::Create(); - context_ = content::CompositingIOSurfaceContext::Get( - content::CompositingIOSurfaceContext::kCALayerContextWindowNumber); + iosurface_ = content::IOSurfaceTexture::Create(); + context_ = content::IOSurfaceContext::Get( + content::IOSurfaceContext::kCALayerContext); if (!iosurface_.get() || !context_.get()) { LOG(ERROR) << "Failed create CompositingIOSurface or context"; [self resetClient]; diff --git a/content/browser/renderer_host/compositing_iosurface_mac.h b/content/browser/compositor/io_surface_texture_mac.h index 21e33ce..4f5392d1 100644 --- a/content/browser/renderer_host/compositing_iosurface_mac.h +++ b/content/browser/compositor/io_surface_texture_mac.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_ -#define CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_ +#ifndef CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ +#define CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ #include <deque> #include <list> @@ -34,22 +34,22 @@ class Rect; namespace content { -class CompositingIOSurfaceContext; +class IOSurfaceContext; class RenderWidgetHostViewFrameSubscriber; class RenderWidgetHostViewMac; -// This class manages an OpenGL context and IOSurface for the accelerated +// This class manages an OpenGL context and IOSurfaceTexture for the accelerated // compositing code path. The GL context is attached to -// RenderWidgetHostViewCocoa for blitting the IOSurface. -class CompositingIOSurfaceMac - : public base::RefCounted<CompositingIOSurfaceMac> { +// RenderWidgetHostViewCocoa for blitting the IOSurfaceTexture. +class IOSurfaceTexture + : public base::RefCounted<IOSurfaceTexture> { public: - // Returns NULL if IOSurface or GL API calls fail. - static scoped_refptr<CompositingIOSurfaceMac> Create(); + // Returns NULL if IOSurfaceTexture or GL API calls fail. + static scoped_refptr<IOSurfaceTexture> Create(); - // Set IOSurface that will be drawn on the next NSView drawRect. + // Set IOSurfaceTexture that will be drawn on the next NSView drawRect. bool SetIOSurfaceWithContextCurrent( - scoped_refptr<CompositingIOSurfaceContext> current_context, + scoped_refptr<IOSurfaceContext> current_context, IOSurfaceID io_surface_handle, const gfx::Size& size, float scale_factor) WARN_UNUSED_RESULT; @@ -62,33 +62,10 @@ class CompositingIOSurfaceMac // larger than the IOSurface, the remaining right and bottom edges will be // white. |window_scale_factor| is 1 in normal views, 2 in HiDPI views. bool DrawIOSurface( - scoped_refptr<CompositingIOSurfaceContext> drawing_context, + scoped_refptr<IOSurfaceContext> drawing_context, const gfx::Rect& window_rect, float window_scale_factor) WARN_UNUSED_RESULT; - // Copy the data of the "live" OpenGL texture referring to this IOSurfaceRef - // into |out|. The copied region is specified with |src_pixel_subrect| and - // the data is transformed so that it fits in |dst_pixel_size|. - // |src_pixel_subrect| and |dst_pixel_size| are not in DIP but in pixel. - // Caller must ensure that |out| is allocated to dimensions that match - // dst_pixel_size, with no additional padding. - // |callback| is invoked when the operation is completed or failed. - // Do no call this method again before |callback| is invoked. - void CopyTo(const gfx::Rect& src_pixel_subrect, - const gfx::Size& dst_pixel_size, - const base::Callback<void(bool, const SkBitmap&)>& callback); - - // Transfer the contents of the surface to an already-allocated YV12 - // VideoFrame, and invoke a callback to indicate success or failure. - void CopyToVideoFrame( - const gfx::Rect& src_subrect, - const scoped_refptr<media::VideoFrame>& target, - const base::Callback<void(bool)>& callback); - - // Unref the IOSurface and delete the associated GL texture. If the GPU - // process is no longer referencing it, this will delete the IOSurface. - void UnrefIOSurface(); - bool HasIOSurface() { return !!io_surface_.get(); } const gfx::Size& pixel_io_surface_size() const { @@ -111,7 +88,11 @@ class CompositingIOSurfaceMac bool HasBeenPoisoned() const; private: - friend class base::RefCounted<CompositingIOSurfaceMac>; + // Unref the IOSurfaceTexture and delete the associated GL texture. If the GPU + // process is no longer referencing it, this will delete the IOSurfaceTexture. + void UnrefIOSurface(); + + friend class base::RefCounted<IOSurfaceTexture>; // Vertex structure for use in glDraw calls. struct SurfaceVertex { @@ -167,13 +148,13 @@ class CompositingIOSurfaceMac SurfaceVertex verts_[4]; }; - CompositingIOSurfaceMac( - const scoped_refptr<CompositingIOSurfaceContext>& context); - ~CompositingIOSurfaceMac(); + IOSurfaceTexture( + const scoped_refptr<IOSurfaceContext>& context); + ~IOSurfaceTexture(); - // Returns true if IOSurface is ready to render. False otherwise. + // Returns true if IOSurfaceTexture is ready to render. False otherwise. bool MapIOSurfaceToTextureWithContextCurrent( - const scoped_refptr<CompositingIOSurfaceContext>& current_context, + const scoped_refptr<IOSurfaceContext>& current_context, const gfx::Size pixel_size, float scale_factor, IOSurfaceID io_surface_handle) WARN_UNUSED_RESULT; @@ -189,9 +170,9 @@ class CompositingIOSurfaceMac // Offscreen context used for all operations other than drawing to the // screen. This is in the same share group as the contexts used for // drawing, and is the same for all IOSurfaces in all windows. - scoped_refptr<CompositingIOSurfaceContext> offscreen_context_; + scoped_refptr<IOSurfaceContext> offscreen_context_; - // IOSurface data. + // IOSurfaceTexture data. IOSurfaceID io_surface_handle_; base::ScopedCFTypeRef<IOSurfaceRef> io_surface_; @@ -219,7 +200,7 @@ class CompositingIOSurfaceMac enum { kMaximumUnevictedSurfaces = 8, }; - typedef std::list<CompositingIOSurfaceMac*> EvictionQueue; + typedef std::list<IOSurfaceTexture*> EvictionQueue; void EvictionMarkUpdated(); void EvictionMarkEvicted(); EvictionQueue::iterator eviction_queue_iterator_; @@ -233,4 +214,4 @@ class CompositingIOSurfaceMac } // namespace content -#endif // CONTENT_BROWSER_RENDERER_HOST_COMPOSITING_IOSURFACE_MAC_H_ +#endif // CONTENT_BROWSER_COMPOSITOR_IO_SURFACE_TEXTURE_MAC_H_ diff --git a/content/browser/renderer_host/compositing_iosurface_mac.mm b/content/browser/compositor/io_surface_texture_mac.mm index ba67fc9..6670d08 100644 --- a/content/browser/renderer_host/compositing_iosurface_mac.mm +++ b/content/browser/compositor/io_surface_texture_mac.mm @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/browser/renderer_host/compositing_iosurface_mac.h" +#include "content/browser/compositor/io_surface_texture_mac.h" #include <OpenGL/CGLIOSurface.h> #include <OpenGL/CGLRenderers.h> @@ -16,8 +16,8 @@ #include "base/mac/mac_util.h" #include "base/message_loop/message_loop.h" #include "base/threading/platform_thread.h" +#include "content/browser/compositor/io_surface_context_mac.h" #include "content/browser/gpu/gpu_data_manager_impl.h" -#include "content/browser/renderer_host/compositing_iosurface_context_mac.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_view_mac.h" #include "content/common/content_constants_internal.h" @@ -46,20 +46,20 @@ namespace content { // static -scoped_refptr<CompositingIOSurfaceMac> CompositingIOSurfaceMac::Create() { - scoped_refptr<CompositingIOSurfaceContext> offscreen_context = - CompositingIOSurfaceContext::Get( - CompositingIOSurfaceContext::kOffscreenContextWindowNumber); +scoped_refptr<IOSurfaceTexture> IOSurfaceTexture::Create() { + scoped_refptr<IOSurfaceContext> offscreen_context = + IOSurfaceContext::Get( + IOSurfaceContext::kOffscreenContext); if (!offscreen_context.get()) { LOG(ERROR) << "Failed to create context for offscreen operations"; return NULL; } - return new CompositingIOSurfaceMac(offscreen_context); + return new IOSurfaceTexture(offscreen_context); } -CompositingIOSurfaceMac::CompositingIOSurfaceMac( - const scoped_refptr<CompositingIOSurfaceContext>& offscreen_context) +IOSurfaceTexture::IOSurfaceTexture( + const scoped_refptr<IOSurfaceContext>& offscreen_context) : offscreen_context_(offscreen_context), io_surface_handle_(0), scale_factor_(1.f), @@ -70,7 +70,7 @@ CompositingIOSurfaceMac::CompositingIOSurfaceMac( CHECK(offscreen_context_.get()); } -CompositingIOSurfaceMac::~CompositingIOSurfaceMac() { +IOSurfaceTexture::~IOSurfaceTexture() { { gfx::ScopedCGLSetCurrentContext scoped_set_current_context( offscreen_context_->cgl_context()); @@ -80,8 +80,8 @@ CompositingIOSurfaceMac::~CompositingIOSurfaceMac() { DCHECK(eviction_queue_iterator_ == eviction_queue_.Get().end()); } -bool CompositingIOSurfaceMac::SetIOSurfaceWithContextCurrent( - scoped_refptr<CompositingIOSurfaceContext> current_context, +bool IOSurfaceTexture::SetIOSurfaceWithContextCurrent( + scoped_refptr<IOSurfaceContext> current_context, IOSurfaceID io_surface_handle, const gfx::Size& size, float scale_factor) { @@ -91,7 +91,7 @@ bool CompositingIOSurfaceMac::SetIOSurfaceWithContextCurrent( return result; } -int CompositingIOSurfaceMac::GetRendererID() { +int IOSurfaceTexture::GetRendererID() { GLint current_renderer_id = -1; if (CGLGetParameter(offscreen_context_->cgl_context(), kCGLCPCurrentRendererID, @@ -100,14 +100,14 @@ int CompositingIOSurfaceMac::GetRendererID() { return -1; } -bool CompositingIOSurfaceMac::DrawIOSurface( - scoped_refptr<CompositingIOSurfaceContext> drawing_context, +bool IOSurfaceTexture::DrawIOSurface( + scoped_refptr<IOSurfaceContext> drawing_context, const gfx::Rect& window_rect, float window_scale_factor) { DCHECK_EQ(CGLGetCurrentContext(), drawing_context->cgl_context()); bool has_io_surface = HasIOSurface(); - TRACE_EVENT1("browser", "CompositingIOSurfaceMac::DrawIOSurface", + TRACE_EVENT1("browser", "IOSurfaceTexture::DrawIOSurface", "has_io_surface", has_io_surface); gfx::Rect pixel_window_rect = @@ -152,7 +152,7 @@ bool CompositingIOSurfaceMac::DrawIOSurface( DrawQuad(filler_quad); } if (window_rect.height() > dip_io_surface_size_.height()) { - // Draw bottom gutter to the width of the IOSurface. + // Draw bottom gutter to the width of the IOSurfaceTexture. filler_quad.set_rect( 0.0f, dip_io_surface_size_.height(), dip_io_surface_size_.width(), window_rect.height()); @@ -198,12 +198,12 @@ bool CompositingIOSurfaceMac::DrawIOSurface( return result; } -bool CompositingIOSurfaceMac::MapIOSurfaceToTextureWithContextCurrent( - const scoped_refptr<CompositingIOSurfaceContext>& current_context, +bool IOSurfaceTexture::MapIOSurfaceToTextureWithContextCurrent( + const scoped_refptr<IOSurfaceContext>& current_context, const gfx::Size pixel_size, float scale_factor, IOSurfaceID io_surface_handle) { - TRACE_EVENT0("browser", "CompositingIOSurfaceMac::MapIOSurfaceToTexture"); + TRACE_EVENT0("browser", "IOSurfaceTexture::MapIOSurfaceToTexture"); if (!io_surface_ || io_surface_handle != io_surface_handle_) UnrefIOSurfaceWithContextCurrent(); @@ -265,14 +265,14 @@ bool CompositingIOSurfaceMac::MapIOSurfaceToTextureWithContextCurrent( return true; } -void CompositingIOSurfaceMac::UnrefIOSurface() { +void IOSurfaceTexture::UnrefIOSurface() { gfx::ScopedCGLSetCurrentContext scoped_set_current_context( offscreen_context_->cgl_context()); UnrefIOSurfaceWithContextCurrent(); } -void CompositingIOSurfaceMac::DrawQuad(const SurfaceQuad& quad) { - TRACE_EVENT0("gpu", "CompositingIOSurfaceMac::DrawQuad"); +void IOSurfaceTexture::DrawQuad(const SurfaceQuad& quad) { + TRACE_EVENT0("gpu", "IOSurfaceTexture::DrawQuad"); glEnableClientState(GL_VERTEX_ARRAY); CHECK_AND_SAVE_GL_ERROR(); glEnableClientState(GL_TEXTURE_COORD_ARRAY); CHECK_AND_SAVE_GL_ERROR(); @@ -285,7 +285,7 @@ void CompositingIOSurfaceMac::DrawQuad(const SurfaceQuad& quad) { glDisableClientState(GL_TEXTURE_COORD_ARRAY); } -void CompositingIOSurfaceMac::UnrefIOSurfaceWithContextCurrent() { +void IOSurfaceTexture::UnrefIOSurfaceWithContextCurrent() { if (texture_) { glDeleteTextures(1, &texture_); texture_ = 0; @@ -303,18 +303,18 @@ void CompositingIOSurfaceMac::UnrefIOSurfaceWithContextCurrent() { EvictionMarkEvicted(); } -bool CompositingIOSurfaceMac::HasBeenPoisoned() const { +bool IOSurfaceTexture::HasBeenPoisoned() const { return offscreen_context_->HasBeenPoisoned(); } -GLenum CompositingIOSurfaceMac::GetAndSaveGLError() { +GLenum IOSurfaceTexture::GetAndSaveGLError() { GLenum gl_error = glGetError(); if (gl_error_ == GL_NO_ERROR) gl_error_ = gl_error; return gl_error; } -void CompositingIOSurfaceMac::EvictionMarkUpdated() { +void IOSurfaceTexture::EvictionMarkUpdated() { EvictionMarkEvicted(); eviction_queue_.Get().push_back(this); eviction_queue_iterator_ = --eviction_queue_.Get().end(); @@ -322,7 +322,7 @@ void CompositingIOSurfaceMac::EvictionMarkUpdated() { EvictionScheduleDoEvict(); } -void CompositingIOSurfaceMac::EvictionMarkEvicted() { +void IOSurfaceTexture::EvictionMarkEvicted() { if (eviction_queue_iterator_ == eviction_queue_.Get().end()) return; eviction_queue_.Get().erase(eviction_queue_iterator_); @@ -331,7 +331,7 @@ void CompositingIOSurfaceMac::EvictionMarkEvicted() { } // static -void CompositingIOSurfaceMac::EvictionScheduleDoEvict() { +void IOSurfaceTexture::EvictionScheduleDoEvict() { if (eviction_scheduled_) return; if (eviction_queue_.Get().size() <= kMaximumUnevictedSurfaces) @@ -340,17 +340,17 @@ void CompositingIOSurfaceMac::EvictionScheduleDoEvict() { eviction_scheduled_ = true; base::MessageLoop::current()->PostTask( FROM_HERE, - base::Bind(&CompositingIOSurfaceMac::EvictionDoEvict)); + base::Bind(&IOSurfaceTexture::EvictionDoEvict)); } // static -void CompositingIOSurfaceMac::EvictionDoEvict() { +void IOSurfaceTexture::EvictionDoEvict() { eviction_scheduled_ = false; // Walk the list of allocated surfaces from least recently used to most // recently used. for (EvictionQueue::iterator it = eviction_queue_.Get().begin(); it != eviction_queue_.Get().end();) { - CompositingIOSurfaceMac* surface = *it; + IOSurfaceTexture* surface = *it; ++it; // If the number of IOSurfaces allocated is less than the threshold, @@ -368,10 +368,10 @@ void CompositingIOSurfaceMac::EvictionDoEvict() { } // static -base::LazyInstance<CompositingIOSurfaceMac::EvictionQueue> - CompositingIOSurfaceMac::eviction_queue_; +base::LazyInstance<IOSurfaceTexture::EvictionQueue> + IOSurfaceTexture::eviction_queue_; // static -bool CompositingIOSurfaceMac::eviction_scheduled_ = false; +bool IOSurfaceTexture::eviction_scheduled_ = false; } // namespace content diff --git a/content/content_browser.gypi b/content/content_browser.gypi index 467ab21..81a6a96 100644 --- a/content/content_browser.gypi +++ b/content/content_browser.gypi @@ -924,10 +924,6 @@ 'browser/renderer_host/clipboard_message_filter.cc', 'browser/renderer_host/clipboard_message_filter.h', 'browser/renderer_host/clipboard_message_filter_mac.mm', - 'browser/renderer_host/compositing_iosurface_context_mac.h', - 'browser/renderer_host/compositing_iosurface_context_mac.mm', - 'browser/renderer_host/compositing_iosurface_mac.h', - 'browser/renderer_host/compositing_iosurface_mac.mm', 'browser/renderer_host/compositor_impl_android.cc', 'browser/renderer_host/compositor_impl_android.h', 'browser/renderer_host/compositor_resize_lock_aura.cc', @@ -1420,14 +1416,14 @@ 'browser/renderer_host/p2p/socket_dispatcher_host.h', ], 'compositor_browser_sources': [ + 'browser/compositor/browser_compositor_ca_layer_tree_mac.mm', + 'browser/compositor/browser_compositor_ca_layer_tree_mac.h', 'browser/compositor/browser_compositor_output_surface.cc', 'browser/compositor/browser_compositor_output_surface.h', 'browser/compositor/browser_compositor_output_surface_proxy.cc', 'browser/compositor/browser_compositor_output_surface_proxy.h', 'browser/compositor/browser_compositor_view_mac.mm', 'browser/compositor/browser_compositor_view_mac.h', - 'browser/compositor/browser_compositor_view_private_mac.mm', - 'browser/compositor/browser_compositor_view_private_mac.h', 'browser/compositor/buffer_queue.cc', 'browser/compositor/buffer_queue.h', 'browser/compositor/delegated_frame_host.cc', @@ -1436,8 +1432,12 @@ 'browser/compositor/gpu_process_transport_factory.h', 'browser/compositor/image_transport_factory.cc', 'browser/compositor/image_transport_factory.h', + 'browser/compositor/io_surface_context_mac.h', + 'browser/compositor/io_surface_context_mac.mm', 'browser/compositor/io_surface_layer_mac.h', 'browser/compositor/io_surface_layer_mac.mm', + 'browser/compositor/io_surface_texture_mac.h', + 'browser/compositor/io_surface_texture_mac.mm', 'browser/compositor/onscreen_display_client.cc', 'browser/compositor/onscreen_display_client.h', 'browser/compositor/overlay_candidate_validator_ozone.cc', |