Chromium Code Reviews| 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 52% |
| rename from blimp/client/core/compositor/blimp_compositor_manager.h |
| rename to blimp/client/core/render_widget/blimp_document_manager.h |
| index a8601082744d080fe9351ae5cd8e8a253720e896..39a8cfb7f1efa1e7bbb3bb3265766352b9845dad 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,25 @@ |
| 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 |
| +class BlimpDocument; |
| + |
| +// The BlimpDocumentManager |
| +// 1. Manages multiple BlimpDocument instances, each mapped to a render widget |
| +// on the engine. |
| +// |
| +// 2. The compositor corresponding to the document initialized on the engine |
|
Khushal
2016/10/03 20:04:59
"The document corresponding to the render widget i
xingliu
2016/10/04 18:33:50
Done.
|
| +// will be the |active_document_|. |
| +// Only the |active_document_| holds the accelerated widget and builds the |
| +// output surface from this document to draw to the view. All events from the |
|
Khushal
2016/10/03 20:04:59
You can remove the "Only..draw to the view" part h
xingliu
2016/10/04 18:33:50
Done.
|
| // native view are forwarded to this compositor. |
| -class BlimpCompositorManager |
| - : public RenderWidgetFeature::RenderWidgetFeatureDelegate, |
| - public BlimpCompositorClient { |
| +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 +46,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 render_widget_id, |
| + const blink::WebGestureEvent& gesture_event); |
| + |
| + // Sends compositor message to the engine, virtual for testing. |
| + virtual void SendCompositorMessage( |
| + int render_widget_id, |
| + const cc::proto::CompositorMessage& message); |
| + |
| scoped_refptr<cc::Layer> layer() const { return layer_; } |
| protected: |
| - // virtual for testing. |
| - virtual std::unique_ptr<BlimpCompositor> CreateBlimpCompositor( |
| + // Creates a BlimpDocument, virtual for testing. |
| + virtual std::unique_ptr<BlimpDocument> CreateBlimpDocument( |
| int render_widget_id, |
| - BlimpCompositorDependencies* compositor_dependencies, |
| - BlimpCompositorClient* client); |
| + 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 |render_widget_id|, returns nullptr if |
| + // the document is not found, protected for testing. |
| + BlimpDocument* GetDocument(int render_widget_id); |
| private: |
| // RenderWidgetFeatureDelegate implementation. |
| @@ -66,14 +76,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 +89,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 and has the |window_|. It corresponds to the |
|
Khushal
2016/10/03 20:04:59
Can remove the "and has the window" part. No longe
xingliu
2016/10/04 18:33:50
Done.
|
| // 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_ |