| Index: blimp/client/core/render_widget/blimp_document_manager.h
|
| diff --git a/blimp/client/core/compositor/blimp_compositor_manager.h b/blimp/client/core/render_widget/blimp_document_manager.h
|
| similarity index 50%
|
| rename from blimp/client/core/compositor/blimp_compositor_manager.h
|
| rename to blimp/client/core/render_widget/blimp_document_manager.h
|
| index a8601082744d080fe9351ae5cd8e8a253720e896..6d54143f455d0a59ac2056b7637e028654ed6164 100644
|
| --- a/blimp/client/core/compositor/blimp_compositor_manager.h
|
| +++ b/blimp/client/core/render_widget/blimp_document_manager.h
|
| @@ -2,14 +2,13 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_
|
| -#define BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_
|
| +#ifndef BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_DOCUMENT_MANAGER_H_
|
| +#define BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_DOCUMENT_MANAGER_H_
|
|
|
| #include <map>
|
|
|
| #include "base/macros.h"
|
| #include "blimp/client/core/compositor/blimp_compositor.h"
|
| -#include "blimp/client/core/compositor/blob_image_serialization_processor.h"
|
| #include "blimp/client/core/render_widget/render_widget_feature.h"
|
| #include "cc/layers/layer.h"
|
| #include "cc/trees/layer_tree_settings.h"
|
| @@ -17,21 +16,24 @@
|
| namespace blimp {
|
| namespace client {
|
|
|
| -// The BlimpCompositorManager manages multiple BlimpCompositor instances, each
|
| -// mapped to a render widget on the engine. The compositor corresponding to
|
| -// the render widget initialized on the engine will be the |active_compositor_|.
|
| -// Only the |active_compositor_| holds the accelerated widget and builds the
|
| -// output surface from this widget to draw to the view. All events from the
|
| -// native view are forwarded to this compositor.
|
| -class BlimpCompositorManager
|
| - : public RenderWidgetFeature::RenderWidgetFeatureDelegate,
|
| - public BlimpCompositorClient {
|
| +class BlimpDocument;
|
| +
|
| +// The BlimpDocumentManager is responsible for managing multiple BlimpDocument
|
| +// instances, each mapped to a render widget on the engine.
|
| +// The |document_id_| matches the |render_widget_id| of the
|
| +// render widget messages which are routed to the engine side render widget.
|
| +//
|
| +// The compositor corresponding to the render widget initialized on the
|
| +// engine will be the |active_document_|.
|
| +// All events from the native view are forwarded to this compositor.
|
| +class BlimpDocumentManager
|
| + : public RenderWidgetFeature::RenderWidgetFeatureDelegate {
|
| public:
|
| - explicit BlimpCompositorManager(
|
| + explicit BlimpDocumentManager(
|
| int blimp_contents_id,
|
| RenderWidgetFeature* render_widget_feature,
|
| BlimpCompositorDependencies* compositor_dependencies);
|
| - ~BlimpCompositorManager() override;
|
| + ~BlimpDocumentManager() override;
|
|
|
| void SetVisible(bool visible);
|
| bool visible() const { return visible_; }
|
| @@ -43,19 +45,26 @@ class BlimpCompositorManager
|
| // becomes hidden |callback| will be notified.
|
| void NotifyWhenDonePendingCommits(base::Closure callback);
|
|
|
| + // Sends input event to the engine, virtual for testing.
|
| + virtual void SendWebGestureEvent(int document_id,
|
| + const blink::WebGestureEvent& gesture_event);
|
| +
|
| + // Sends compositor message to the engine, virtual for testing.
|
| + virtual void SendCompositorMessage(
|
| + int document_id,
|
| + const cc::proto::CompositorMessage& message);
|
| +
|
| scoped_refptr<cc::Layer> layer() const { return layer_; }
|
|
|
| protected:
|
| - // virtual for testing.
|
| - virtual std::unique_ptr<BlimpCompositor> CreateBlimpCompositor(
|
| - int render_widget_id,
|
| - BlimpCompositorDependencies* compositor_dependencies,
|
| - BlimpCompositorClient* client);
|
| + // Creates a BlimpDocument, virtual for testing.
|
| + virtual std::unique_ptr<BlimpDocument> CreateBlimpDocument(
|
| + int document_id,
|
| + BlimpCompositorDependencies* compositor_dependencies);
|
|
|
| - // Returns the compositor for the |render_widget_id|. Will return nullptr if
|
| - // no compositor is found.
|
| - // protected for testing.
|
| - BlimpCompositor* GetCompositor(int render_widget_id);
|
| + // Returns the blimp document from |document_id|, returns nullptr if
|
| + // the document is not found, protected for testing.
|
| + BlimpDocument* GetDocument(int document_id);
|
|
|
| private:
|
| // RenderWidgetFeatureDelegate implementation.
|
| @@ -66,14 +75,7 @@ class BlimpCompositorManager
|
| int render_widget_id,
|
| std::unique_ptr<cc::proto::CompositorMessage> message) override;
|
|
|
| - // BlimpCompositorClient implementation.
|
| - void SendWebGestureEvent(
|
| - int render_widget_id,
|
| - const blink::WebGestureEvent& gesture_event) override;
|
| - void SendCompositorMessage(
|
| - int render_widget_id,
|
| - const cc::proto::CompositorMessage& message) override;
|
| -
|
| + // The unique id of BlimpContentImpl which owns this document manager.
|
| int blimp_contents_id_;
|
|
|
| // The bridge to the network layer that does the proto/RenderWidget id work.
|
| @@ -86,21 +88,21 @@ class BlimpCompositorManager
|
| // The layer which holds the content from the active compositor.
|
| scoped_refptr<cc::Layer> layer_;
|
|
|
| - // A map of render_widget_ids to the BlimpCompositor instance.
|
| - using CompositorMap = std::map<int, std::unique_ptr<BlimpCompositor>>;
|
| - CompositorMap compositors_;
|
| + // A map of document id to the BlimpDocument instance.
|
| + using DocumentMap = std::map<int, std::unique_ptr<BlimpDocument>>;
|
| + DocumentMap documents_;
|
|
|
| - // The |active_compositor_| represents the compositor from the CompositorMap
|
| - // that is currently visible and has the |window_|. It corresponds to the
|
| + // The |active_document_| holds the compositor from the that is currently
|
| + // visible. It corresponds to the
|
| // render widget currently initialized on the engine.
|
| - BlimpCompositor* active_compositor_;
|
| + BlimpDocument* active_document_;
|
|
|
| BlimpCompositorDependencies* compositor_dependencies_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(BlimpCompositorManager);
|
| + DISALLOW_COPY_AND_ASSIGN(BlimpDocumentManager);
|
| };
|
|
|
| } // namespace client
|
| } // namespace blimp
|
|
|
| -#endif // BLIMP_CLIENT_CORE_COMPOSITOR_BLIMP_COMPOSITOR_MANAGER_H_
|
| +#endif // BLIMP_CLIENT_CORE_RENDER_WIDGET_BLIMP_DOCUMENT_MANAGER_H_
|
|
|