Index: blimp/client/support/compositor/blimp_embedder_compositor.h |
diff --git a/blimp/client/app/compositor/browser_compositor.h b/blimp/client/support/compositor/blimp_embedder_compositor.h |
similarity index 68% |
copy from blimp/client/app/compositor/browser_compositor.h |
copy to blimp/client/support/compositor/blimp_embedder_compositor.h |
index 1a5cdc79b3000646606a30a998a888a7bd8d4fd9..8e23647ca933de97925f8cfab2d053d273ad18a6 100644 |
--- a/blimp/client/app/compositor/browser_compositor.h |
+++ b/blimp/client/support/compositor/blimp_embedder_compositor.h |
@@ -2,20 +2,19 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#ifndef BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ |
-#define BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ |
+#ifndef BLIMP_CLIENT_SUPPORT_COMPOSITOR_BLIMP_EMBEDDER_COMPOSITOR_H_ |
+#define BLIMP_CLIENT_SUPPORT_COMPOSITOR_BLIMP_EMBEDDER_COMPOSITOR_H_ |
-#include "base/macros.h" |
#include "base/callback.h" |
+#include "base/macros.h" |
#include "base/memory/weak_ptr.h" |
+#include "cc/layers/layer.h" |
#include "cc/trees/layer_tree_host_client.h" |
#include "cc/trees/layer_tree_host_single_thread_client.h" |
#include "ui/gfx/geometry/size.h" |
-#include "ui/gfx/native_widget_types.h" |
namespace cc { |
class Display; |
-class Layer; |
class LayerTreeHostInterface; |
class SurfaceIdAllocator; |
class SurfaceManager; |
@@ -26,12 +25,13 @@ namespace client { |
class CompositorDependencies; |
// The parent compositor that embeds the content from the BlimpCompositor for |
-// the current page. |
-class BrowserCompositor : public cc::LayerTreeHostClient, |
- public cc::LayerTreeHostSingleThreadClient { |
+// the current page and draws it to a display. |
+class BlimpEmbedderCompositor : public cc::LayerTreeHostClient, |
+ public cc::LayerTreeHostSingleThreadClient { |
public: |
- explicit BrowserCompositor(CompositorDependencies* compositor_dependencies); |
- ~BrowserCompositor() override; |
+ explicit BlimpEmbedderCompositor( |
+ CompositorDependencies* compositor_dependencies); |
+ ~BlimpEmbedderCompositor() override; |
// Sets the layer with the content from the renderer compositor. |
void SetContentLayer(scoped_refptr<cc::Layer> content_layer); |
@@ -39,18 +39,14 @@ class BrowserCompositor : public cc::LayerTreeHostClient, |
// Sets the size for the display. Should be in physical pixels. |
void SetSize(const gfx::Size& size_in_px); |
- // Sets the widget that the |cc::Display| draws to. On proving it the widget, |
- // the compositor will become visible and start drawing to the widget. When |
- // the widget goes away, we become invisible and drop all resources being |
- // used to draw to the screen. |
- void SetAcceleratedWidget(gfx::AcceleratedWidget widget); |
+ protected: |
+ void SetContextProvider(scoped_refptr<cc::ContextProvider> context_provider); |
- // A callback to get notifed when the compositor performs a successful swap. |
- void set_did_complete_swap_buffers_callback(base::Closure callback) { |
- did_complete_swap_buffers_ = callback; |
+ scoped_refptr<cc::Layer> root_layer() { return root_layer_; } |
+ CompositorDependencies* compositor_dependencies() { |
+ return compositor_dependencies_; |
} |
- private: |
// LayerTreeHostClient implementation. |
void WillBeginMainFrame() override {} |
void DidBeginMainFrame() override {} |
@@ -68,19 +64,21 @@ class BrowserCompositor : public cc::LayerTreeHostClient, |
void WillCommit() override {} |
void DidCommit() override {} |
void DidCommitAndDrawFrame() override {} |
- void DidCompleteSwapBuffers() override; |
+ void DidCompleteSwapBuffers() override {} |
void DidCompletePageScaleAnimation() override {} |
// LayerTreeHostSingleThreadClient implementation. |
void DidPostSwapBuffers() override {} |
void DidAbortSwapBuffers() override {} |
+ private: |
void HandlePendingOutputSurfaceRequest(); |
CompositorDependencies* compositor_dependencies_; |
+ scoped_refptr<cc::ContextProvider> context_provider_; |
+ |
std::unique_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
- gfx::AcceleratedWidget widget_; |
bool output_surface_request_pending_; |
std::unique_ptr<cc::Display> display_; |
@@ -91,10 +89,10 @@ class BrowserCompositor : public cc::LayerTreeHostClient, |
base::Closure did_complete_swap_buffers_; |
- DISALLOW_COPY_AND_ASSIGN(BrowserCompositor); |
+ DISALLOW_COPY_AND_ASSIGN(BlimpEmbedderCompositor); |
}; |
} // namespace client |
} // namespace blimp |
-#endif // BLIMP_CLIENT_APP_COMPOSITOR_BROWSER_COMPOSITOR_H_ |
+#endif // BLIMP_CLIENT_SUPPORT_COMPOSITOR_BLIMP_EMBEDDER_COMPOSITOR_H_ |