| Index: examples/ui/tile/tile_view.h
|
| diff --git a/examples/ui/spinning_cube/spinning_cube_view.h b/examples/ui/tile/tile_view.h
|
| similarity index 50%
|
| copy from examples/ui/spinning_cube/spinning_cube_view.h
|
| copy to examples/ui/tile/tile_view.h
|
| index 1a5b7fe0185870af56982c8e8234887865d6eca8..a0132cf9ac05ead6cf5283ab759ee15555a61796 100644
|
| --- a/examples/ui/spinning_cube/spinning_cube_view.h
|
| +++ b/examples/ui/tile/tile_view.h
|
| @@ -2,25 +2,20 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef EXAMPLES_UI_SPINNING_CUBE_SPINNING_CUBE_VIEW_H_
|
| -#define EXAMPLES_UI_SPINNING_CUBE_SPINNING_CUBE_VIEW_H_
|
| +#ifndef EXAMPLES_UI_TILE_TILE_VIEW_H_
|
| +#define EXAMPLES_UI_TILE_TILE_VIEW_H_
|
|
|
| +#include <map>
|
| #include <memory>
|
|
|
| #include "base/bind.h"
|
| #include "base/memory/weak_ptr.h"
|
| -#include "examples/spinning_cube/spinning_cube.h"
|
| -#include "mojo/gpu/gl_context.h"
|
| -#include "mojo/gpu/gl_context_owner.h"
|
| -#include "mojo/gpu/gl_texture.h"
|
| -#include "mojo/gpu/texture_cache.h"
|
| -#include "mojo/gpu/texture_uploader.h"
|
| #include "mojo/public/cpp/application/application_impl.h"
|
| #include "mojo/public/cpp/bindings/strong_binding.h"
|
| #include "mojo/public/cpp/environment/environment.h"
|
| #include "mojo/public/cpp/system/core.h"
|
| #include "mojo/public/cpp/system/macros.h"
|
| -#include "mojo/services/surfaces/interfaces/quads.mojom.h"
|
| +#include "mojo/services/geometry/interfaces/geometry.mojom.h"
|
| #include "mojo/services/surfaces/interfaces/surfaces.mojom.h"
|
| #include "mojo/services/ui/views/interfaces/view_manager.mojom.h"
|
| #include "mojo/services/ui/views/interfaces/view_provider.mojom.h"
|
| @@ -28,14 +23,27 @@
|
|
|
| namespace examples {
|
|
|
| -class SpinningCubeView : public mojo::ui::View {
|
| +class TileView : public mojo::ui::View {
|
| public:
|
| - SpinningCubeView(mojo::ApplicationImpl* app,
|
| - const mojo::ui::ViewProvider::CreateViewCallback& callback);
|
| + TileView(mojo::ApplicationImpl* app_impl_,
|
| + const std::vector<std::string>& view_urls,
|
| + const mojo::ui::ViewProvider::CreateViewCallback& callback);
|
|
|
| - ~SpinningCubeView() override;
|
| + ~TileView() override;
|
|
|
| private:
|
| + struct ViewData {
|
| + explicit ViewData(const std::string& url);
|
| + ~ViewData();
|
| +
|
| + const std::string url;
|
| +
|
| + bool layout_pending;
|
| + mojo::ui::ViewLayoutParamsPtr layout_params;
|
| + mojo::ui::ViewLayoutInfoPtr layout_info;
|
| + mojo::Rect layout_bounds;
|
| + };
|
| +
|
| // |View|:
|
| void OnLayout(mojo::ui::ViewLayoutParamsPtr layout_params,
|
| mojo::Array<uint32_t> children_needing_layout,
|
| @@ -46,38 +54,41 @@ class SpinningCubeView : public mojo::ui::View {
|
| void OnSurfaceIdNamespaceAvailable(uint32_t id_namespace);
|
|
|
| void InitView();
|
| -
|
| - void InitCube();
|
| - void DrawCube();
|
| - void OnSurfaceSubmitted();
|
| - void ScheduleDraw();
|
| -
|
| + void OnChildConnectionError(uint32_t child_key, const std::string& url);
|
| + void OnChildCreated(uint32_t child_key,
|
| + const std::string& url,
|
| + mojo::ui::ViewProviderPtr provider,
|
| + mojo::ui::ViewTokenPtr token);
|
| + void OnChildLayoutFinished(uint32_t child_key,
|
| + mojo::ui::ViewLayoutInfoPtr child_layout_info);
|
| + void FinishLayout();
|
| +
|
| + void OnFrameSubmitted();
|
| +
|
| + mojo::ApplicationImpl* app_impl_;
|
| + std::vector<std::string> view_urls_;
|
| mojo::ui::ViewProvider::CreateViewCallback callback_;
|
| mojo::StrongBinding<mojo::ui::View> binding_;
|
|
|
| - mojo::GLContextOwner context_owner_;
|
| - mojo::ResourceReturnerPtr resource_returner_; // must be before texture cache
|
| - mojo::TextureCache texture_cache_;
|
| -
|
| mojo::SurfacePtr surfaces_;
|
| mojo::SurfaceIdPtr surface_id_;
|
| uint32_t surface_id_namespace_;
|
|
|
| mojo::ui::ViewManagerPtr view_manager_;
|
| mojo::ui::ViewHostPtr view_host_;
|
| - mojo::ServiceProviderPtr view_service_provider_;
|
|
|
| - mojo::Size size_;
|
| + std::map<uint32_t, std::unique_ptr<ViewData>> views_;
|
|
|
| - SpinningCube cube_;
|
| - MojoTimeTicks last_draw_;
|
| - bool draw_scheduled_;
|
| + mojo::Size size_;
|
| + OnLayoutCallback pending_layout_callback_;
|
| + uint32_t pending_child_layout_count_;
|
| + bool frame_pending_;
|
|
|
| - base::WeakPtrFactory<SpinningCubeView> weak_ptr_factory_;
|
| + base::WeakPtrFactory<TileView> weak_ptr_factory_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(SpinningCubeView);
|
| + DISALLOW_COPY_AND_ASSIGN(TileView);
|
| };
|
|
|
| } // namespace examples
|
|
|
| -#endif // EXAMPLES_UI_SPINNING_CUBE_SPINNING_CUBE_VIEW_H_
|
| +#endif // EXAMPLES_UI_TILE_TILE_VIEW_H_
|
|
|