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

Unified Diff: blimp/client/feature/compositor/blimp_compositor.h

Issue 1653553002: blimp: Use remote client LayerTreeHost in the BlimpCompositor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 4 years, 11 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: blimp/client/feature/compositor/blimp_compositor.h
diff --git a/blimp/client/feature/compositor/blimp_compositor.h b/blimp/client/feature/compositor/blimp_compositor.h
index a9a00a45bf2364d55c636f5f9252ba12dea6c172..819363560dca741c54e93728aa6844ba86e8fe20 100644
--- a/blimp/client/feature/compositor/blimp_compositor.h
+++ b/blimp/client/feature/compositor/blimp_compositor.h
@@ -14,6 +14,7 @@
#include "blimp/client/feature/compositor/blimp_input_manager.h"
#include "blimp/client/feature/render_widget_feature.h"
#include "cc/layers/layer_settings.h"
+#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_host_client.h"
#include "cc/trees/layer_tree_settings.h"
#include "cc/trees/remote_proto_channel.h"
@@ -26,6 +27,9 @@ class Thread;
}
namespace cc {
+namespace proto {
+class InitializeImpl;
+}
class LayerTreeHost;
}
@@ -41,7 +45,7 @@ namespace client {
// surface this compositor draws to is defined by the gfx::AcceleratedWidget set
// by SetAcceleratedWidget(). This class should only be accessed from the main
// thread. Any interaction with the compositing thread should happen through
-// the LayerTreeHost or RemoteChannelImpl.
+// the LayerTreeHost.
class BLIMP_CLIENT_EXPORT BlimpCompositor
: public cc::LayerTreeHostClient,
public cc::RemoteProtoChannel,
@@ -55,19 +59,12 @@ class BLIMP_CLIENT_EXPORT BlimpCompositor
~BlimpCompositor() override;
- // Default layer settings for all Blimp layer instances.
- static cc::LayerSettings LayerSettings();
-
// Sets whether or not this compositor actually draws to the output surface.
// Setting this to false will make the compositor drop all of its resources
// and the output surface. Setting it to true again will rebuild the output
// surface from the gfx::AcceleratedWidget (see SetAcceleratedWidget).
void SetVisible(bool visible);
- // Sets the size of the viewport on the compositor.
- // TODO(dtrainor): Should this be set from the engine all the time?
- void SetSize(const gfx::Size& size);
-
// Lets this compositor know that it can draw to |widget|. This means that,
// if this compositor is visible, it will build an output surface and GL
// context around |widget| and will draw to it. ReleaseAcceleratedWidget()
@@ -90,6 +87,8 @@ class BLIMP_CLIENT_EXPORT BlimpCompositor
virtual void GenerateLayerTreeSettings(cc::LayerTreeSettings* settings);
private:
+ friend class BlimpCompositorForTesting;
+
// LayerTreeHostClient implementation.
void WillBeginMainFrame() override;
void DidBeginMainFrame() override;
@@ -126,16 +125,24 @@ class BLIMP_CLIENT_EXPORT BlimpCompositor
// BlimpInputManagerClient implementation.
void SendWebInputEvent(const blink::WebInputEvent& input_event) override;
+ // Internal method to correctly set the visibility on the |host_|. It will
+ // make the |host_| visible if |visible| is true and we have a valid |window_|
+ // If |visible_| is false, the host will also release its output surface.
+ void SetVisibleInternal(bool visible);
+
// Helper method to build the internal CC compositor instance from |message|.
- void CreateLayerTreeHost(scoped_ptr<cc::proto::CompositorMessage> message);
+ void CreateLayerTreeHost(
+ const cc::proto::InitializeImpl& initialize_message);
+
+ // Helper method to destroy the internal CC compositor instance and all its
+ // associated state.
+ void DestroyLayerTreeHost();
// Creates (if necessary) and returns a TaskRunner for a thread meant to run
// compositor rendering.
void HandlePendingOutputSurfaceRequest();
scoped_refptr<base::SingleThreadTaskRunner> GetCompositorTaskRunner();
- gfx::Size viewport_size_;
-
// The scale factor used to convert dp units (device independent pixels) to
// pixels.
float device_scale_factor_;

Powered by Google App Engine
This is Rietveld 408576698